mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-01 15:32:48 +08:00
升级TP6.1;升级第三方上传;
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -15,4 +15,6 @@ runtime
|
||||
ul.db
|
||||
/app/tools/controller/Install.php
|
||||
/app/common/command/curd/migrate_output.php
|
||||
/dist
|
||||
/dist
|
||||
/composer.lock
|
||||
/public/storage
|
||||
@@ -231,6 +231,13 @@ $ul_system_config = array(
|
||||
"remark" => "访问域名",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "txcos_appid",
|
||||
"group" => "upload",
|
||||
"value" => "填你的",
|
||||
"remark" => "APPID",
|
||||
"sort" => 0,
|
||||
),
|
||||
array(
|
||||
"name" => "file",
|
||||
"group" => "site",
|
||||
|
||||
@@ -71,6 +71,13 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item show-type-item txcos">
|
||||
<label class="layui-form-label required">APPID</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="txcos_appid" class="layui-input" lay-verify="required" lay-reqtext="请输入APPID" placeholder="请输入APPID" value="{:sysconfig('upload','txcos_appid')}">
|
||||
<tip>开发者访问 COS 服务时拥有的用户维度唯一资源标识,用以标识资源,可在 API 密钥管理 页面获取</tip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item show-type-item txcos">
|
||||
<label class="layui-form-label required">公钥信息</label>
|
||||
<div class="layui-input-block">
|
||||
|
||||
@@ -27,10 +27,11 @@
|
||||
"guzzlehttp/guzzle": "^7.4",
|
||||
"phpoffice/phpspreadsheet": "^1.22",
|
||||
"topthink/think-migration": "^3.0",
|
||||
"overtrue/flysystem-qiniu": "*",
|
||||
"xxtime/flysystem-aliyun-oss": "^1.5",
|
||||
"chunpat/flysystem-tencent-cos": "^0.0.1",
|
||||
"doctrine/annotations": "^1.13"
|
||||
"doctrine/annotations": "^1.13",
|
||||
"topthink/think-filesystem": "^2.0",
|
||||
"overtrue/flysystem-qiniu": "^2.0",
|
||||
"overtrue/flysystem-cos": "^4.0",
|
||||
"iidestiny/flysystem-oss": "^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/var-dumper": "^4.2"
|
||||
|
||||
2318
composer.lock
generated
2318
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -33,13 +33,16 @@ return [
|
||||
'visibility' => 'public',
|
||||
],
|
||||
'qnoss' => [
|
||||
'type' => 'Qiniu'
|
||||
'type' => 'Qiniu',
|
||||
'visibility' => 'public',
|
||||
],
|
||||
'alioss' => [
|
||||
'type' => 'Alioss'
|
||||
'type' => 'Alioss',
|
||||
'visibility' => 'public',
|
||||
],
|
||||
'txcos' => [
|
||||
'type' => 'Txcos'
|
||||
'type' => 'Txcos',
|
||||
'visibility' => 'public',
|
||||
],
|
||||
// 更多的磁盘配置信息
|
||||
],
|
||||
|
||||
@@ -2,24 +2,21 @@
|
||||
|
||||
namespace think\filesystem\driver;
|
||||
|
||||
use League\Flysystem\AdapterInterface;
|
||||
|
||||
use Iidestiny\Flysystem\Oss\OssAdapter;
|
||||
use League\Flysystem\FilesystemAdapter;
|
||||
use think\filesystem\Driver;
|
||||
use Xxtime\Flysystem\Aliyun\OssAdapter;
|
||||
|
||||
class Alioss extends Driver
|
||||
{
|
||||
protected function createAdapter(): AdapterInterface
|
||||
protected function createAdapter(): FilesystemAdapter
|
||||
{
|
||||
|
||||
$config = [
|
||||
'accessId' => sysconfig('upload', 'alioss_access_key_id'),
|
||||
'accessSecret' => sysconfig('upload', 'alioss_access_key_secret'),
|
||||
'endpoint' => sysconfig('upload', 'alioss_endpoint'),
|
||||
'bucket' => sysconfig('upload', 'alioss_bucket'),
|
||||
];
|
||||
|
||||
return new OssAdapter(
|
||||
$config
|
||||
sysconfig('upload', 'alioss_access_key_id'),
|
||||
sysconfig('upload', 'alioss_access_key_secret'),
|
||||
sysconfig('upload', 'alioss_endpoint'),
|
||||
sysconfig('upload', 'alioss_bucket')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace think\filesystem\driver;
|
||||
|
||||
use League\Flysystem\AdapterInterface;
|
||||
use League\Flysystem\FilesystemAdapter;
|
||||
use think\filesystem\Driver;
|
||||
use Overtrue\Flysystem\Qiniu\QiniuAdapter;
|
||||
|
||||
class Qiniu extends Driver
|
||||
{
|
||||
protected function createAdapter(): AdapterInterface
|
||||
protected function createAdapter(): FilesystemAdapter
|
||||
{
|
||||
return new QiniuAdapter(
|
||||
sysconfig('upload','qnoss_access_key'),
|
||||
sysconfig('upload','qnoss_secret_key'),
|
||||
sysconfig('upload','qnoss_bucket'),
|
||||
sysconfig('upload','qnoss_domain')
|
||||
sysconfig('upload', 'qnoss_access_key'),
|
||||
sysconfig('upload', 'qnoss_secret_key'),
|
||||
sysconfig('upload', 'qnoss_bucket'),
|
||||
sysconfig('upload', 'qnoss_domain')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,4 +23,3 @@ class Qiniu extends Driver
|
||||
return $this->concatPathToUrl(sysconfig('upload', 'qnoss_domain'), $path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,33 +2,38 @@
|
||||
|
||||
namespace think\filesystem\driver;;
|
||||
|
||||
use League\Flysystem\AdapterInterface;
|
||||
use Qcloud\Cos\Client;
|
||||
use League\Flysystem\FilesystemAdapter;
|
||||
use think\filesystem\Driver;
|
||||
use Overtrue\Flysystem\Cos\CosAdapter;
|
||||
|
||||
class Txcos extends Driver
|
||||
{
|
||||
protected function createAdapter(): AdapterInterface
|
||||
protected function createAdapter(): FilesystemAdapter
|
||||
{
|
||||
$appid = sysconfig('upload', 'txcos_appid');
|
||||
$secretId = sysconfig('upload', 'txcos_secret_id');
|
||||
$secretKey = sysconfig('upload', 'txcos_secret_key');
|
||||
$region = sysconfig('upload', 'txcos_region'); //set a default bucket region 设置一个默认的存储桶地域
|
||||
$cosClient = new Client(
|
||||
array(
|
||||
'region' => $region,
|
||||
'schema' => 'https', //协议头部,默认为http
|
||||
'credentials' => array(
|
||||
'secretId' => $secretId,
|
||||
'secretKey' => $secretKey
|
||||
),
|
||||
'signHost' => false
|
||||
)
|
||||
);
|
||||
$bucket = sysconfig('upload', 'txcos_bucket'); //存储桶名称 格式:BucketName-APPID
|
||||
|
||||
$config = [
|
||||
// 必填,app_id、secret_id、secret_key
|
||||
// 可在个人秘钥管理页查看:https://console.cloud.tencent.com/capi
|
||||
'app_id' => $appid,
|
||||
'secret_id' => $secretId,
|
||||
'secret_key' => $secretKey,
|
||||
'region' => $region,
|
||||
'bucket' => $bucket,
|
||||
|
||||
// 可选,如果 bucket 为私有访问请打开此项
|
||||
'signed_url' => false,
|
||||
|
||||
// 可选,是否使用 https,默认 false
|
||||
'use_https' => true,
|
||||
];
|
||||
|
||||
$adapter = new CosAdapter($config);
|
||||
|
||||
$adapter = new \Chunpat\FlysystemTencentCos\Adapter($cosClient, $bucket);
|
||||
|
||||
return $adapter;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user