ComposerUpdate

This commit is contained in:
Anyon 2020-01-14 10:31:57 +08:00
parent 82dc391f20
commit e791601c00
8 changed files with 41 additions and 32 deletions

View File

@ -41,7 +41,7 @@ define(['md5'], function (SparkMD5, allowExtsMimes) {
uploader.config.data.signature = ret.data.signature; uploader.config.data.signature = ret.data.signature;
uploader.config.data.OSSAccessKeyId = ret.data.OSSAccessKeyId; uploader.config.data.OSSAccessKeyId = ret.data.OSSAccessKeyId;
uploader.config.data.success_action_status = 200; uploader.config.data.success_action_status = 200;
uploader.config.data['Content-Disposition'] = 'attachment;filename=' + encodeURIComponent(file.name); uploader.config.data['Content-Disposition'] = 'inline;filename=' + encodeURIComponent(file.name);
} }
object.upload(index, file); object.upload(index, file);
} else if (parseInt(ret.code) === 200) { } else if (parseInt(ret.code) === 200) {

8
composer.lock generated
View File

@ -909,12 +909,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "92ed0becfcfd239929b0ec64afca3618b6a3383c" "reference": "4b5d056a51c18261255b728d7ef2f40c5779805b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/92ed0becfcfd239929b0ec64afca3618b6a3383c", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/4b5d056a51c18261255b728d7ef2f40c5779805b",
"reference": "92ed0becfcfd239929b0ec64afca3618b6a3383c", "reference": "4b5d056a51c18261255b728d7ef2f40c5779805b",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -958,7 +958,7 @@
], ],
"description": "ThinkPHP v6.0 Development Library", "description": "ThinkPHP v6.0 Development Library",
"homepage": "http://framework.thinkadmin.top", "homepage": "http://framework.thinkadmin.top",
"time": "2020-01-13T09:00:03+00:00" "time": "2020-01-14T02:21:11+00:00"
}, },
{ {
"name": "zoujingli/wechat-developer", "name": "zoujingli/wechat-developer",

View File

@ -935,12 +935,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "92ed0becfcfd239929b0ec64afca3618b6a3383c" "reference": "4b5d056a51c18261255b728d7ef2f40c5779805b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/92ed0becfcfd239929b0ec64afca3618b6a3383c", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/4b5d056a51c18261255b728d7ef2f40c5779805b",
"reference": "92ed0becfcfd239929b0ec64afca3618b6a3383c", "reference": "4b5d056a51c18261255b728d7ef2f40c5779805b",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -956,7 +956,7 @@
"ext-json": "*", "ext-json": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2020-01-13T09:00:03+00:00", "time": "2020-01-14T02:21:11+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2020-01-13 17:23:44 // This file is automatically generated at:2020-01-14 10:30:36
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\app\\Service', 0 => 'think\\app\\Service',

View File

@ -41,11 +41,17 @@ abstract class Storage
protected $app; protected $app;
/** /**
* 存储域名前缀 * 链接前缀
* @var string * @var string
*/ */
protected $prefix; protected $prefix;
/**
* 链接类型
* @var string
*/
protected $linkType;
/** /**
* Storage constructor. * Storage constructor.
* @param App $app * @param App $app
@ -58,9 +64,13 @@ abstract class Storage
/** /**
* 存储初始化 * 存储初始化
* @return Storage * @return Storage
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
protected function initialize(): Storage protected function initialize(): Storage
{ {
$this->linkType = sysconf('storage.link_type');
return $this; return $this;
} }
@ -167,30 +177,14 @@ abstract class Storage
return $mimes = include __DIR__ . '/storage/bin/mimes.php'; return $mimes = include __DIR__ . '/storage/bin/mimes.php';
} }
/**
* 获取文件基础名称
* @param string $name 文件名称
* @return string
*/
protected function delSuffix($name)
{
if (strpos($name, '?') !== false) {
list($name) = explode('?', $name);
}
return $name;
}
/** /**
* 获取下载链接后缀 * 获取下载链接后缀
* @param string $attname 下载名称 * @param string $attname 下载名称
* @return string * @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/ */
protected function getSuffix($attname = null) protected function getSuffix($attname = null)
{ {
if (sysconf('storage.link_type') === 'full') { if ($this->linkType === 'full') {
if (is_string($attname) && strlen($attname) > 0) { if (is_string($attname) && strlen($attname) > 0) {
return "?attname=" . urlencode($attname); return "?attname=" . urlencode($attname);
} }
@ -198,4 +192,16 @@ abstract class Storage
return ''; return '';
} }
/**
* 获取文件基础名称
* @param string $name 文件名称
* @return string
*/
protected function delSuffix($name)
{
if (strpos($name, '?') !== false) {
return strstr($name, '?', true);
}
return $name;
}
} }

View File

@ -77,7 +77,8 @@ class AliossStorage extends Storage
elseif ($type === 'http') $this->prefix = "http://{$this->domain}"; elseif ($type === 'http') $this->prefix = "http://{$this->domain}";
elseif ($type === 'https') $this->prefix = "https://{$this->domain}"; elseif ($type === 'https') $this->prefix = "https://{$this->domain}";
else throw new \think\Exception('未配置阿里云URL域名哦'); else throw new \think\Exception('未配置阿里云URL域名哦');
return $this; // 初始化配置并返回当前实例
return parent::initialize();
} }
/** /**
@ -112,7 +113,7 @@ class AliossStorage extends Storage
$data['success_action_status'] = '200'; $data['success_action_status'] = '200';
if (is_string($attname) && strlen($attname) > 0) { if (is_string($attname) && strlen($attname) > 0) {
$filename = urlencode($attname); $filename = urlencode($attname);
$data['Content-Disposition'] = "attachment;filename={$filename}"; $data['Content-Disposition'] = "inline;filename={$filename}";
} }
$file = ['field' => 'file', 'name' => $name, 'content' => $file]; $file = ['field' => 'file', 'name' => $name, 'content' => $file];
if (is_numeric(stripos(HttpExtend::submit($this->upload(), $data, $file), '200 OK'))) { if (is_numeric(stripos(HttpExtend::submit($this->upload(), $data, $file), '200 OK'))) {

View File

@ -46,7 +46,8 @@ class LocalStorage extends Storage
elseif ($type === 'http') $this->prefix = "http://{$domain}"; elseif ($type === 'http') $this->prefix = "http://{$domain}";
elseif ($type === 'https') $this->prefix = "https://{$domain}"; elseif ($type === 'https') $this->prefix = "https://{$domain}";
} }
return $this; // 初始化配置并返回当前实例
return parent::initialize();
} }
/** /**

View File

@ -51,7 +51,8 @@ class QiniuStorage extends Storage
elseif ($type === 'http') $this->prefix = "http://{$this->domain}"; elseif ($type === 'http') $this->prefix = "http://{$this->domain}";
elseif ($type === 'https') $this->prefix = "https://{$this->domain}"; elseif ($type === 'https') $this->prefix = "https://{$this->domain}";
else throw new \think\Exception('未配置七牛云URL域名哦'); else throw new \think\Exception('未配置七牛云URL域名哦');
return $this; // 初始化配置并返回当前实例
return parent::initialize();
} }
/** /**