From 6c4fc6bff69f1201d104c25dd6be6eb69c1190cf Mon Sep 17 00:00:00 2001 From: xiadc <251308692@qq.com> Date: Sun, 18 May 2025 10:47:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(hwobs):=20=E8=BF=94=E5=9B=9E=E5=8D=8E?= =?UTF-8?q?=E4=B8=BAobs=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/hwobs/config.php | 10 +++---- addons/hwobs/controller/Index.php | 30 +++++++++++-------- .../src/addons/Controller.php | 2 +- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/addons/hwobs/config.php b/addons/hwobs/config.php index 0d957bc..65d8a17 100644 --- a/addons/hwobs/config.php +++ b/addons/hwobs/config.php @@ -30,7 +30,7 @@ return [ 'title' => '存储桶名称', 'type' => 'string', 'content' => [], - 'value' => 'zhongyi542', + 'value' => 'doxixi', 'rule' => 'required', 'msg' => '', 'tip' => '存储桶名称', @@ -54,7 +54,7 @@ return [ 'title' => '上传接口地址', 'type' => 'string', 'content' => [], - 'value' => 'https://zhongyi542.obs.cn-south-1.myhuaweicloud.com', + 'value' => 'https://doxixi.obs.cn-south-1.myhuaweicloud.com', 'rule' => 'required;uploadurl', 'msg' => '', 'tip' => '请使用存储桶->基本信息->访问域名的值,并在前面加上http://或https://', @@ -66,7 +66,7 @@ return [ 'title' => 'CDN地址', 'type' => 'string', 'content' => [], - 'value' => 'https://zhongyi542.obs.cn-south-1.myhuaweicloud.com', + 'value' => 'https://doxixi.obs.cn-south-1.myhuaweicloud.com', 'rule' => 'required;cdnurl', 'msg' => '', 'tip' => '如果你的云存储有绑定自定义域名,请输入自定义域名', @@ -183,7 +183,7 @@ return [ 1 => '开启', 0 => '关闭', ], - 'value' => '0', + 'value' => '1', 'rule' => 'required', 'msg' => '', 'tip' => '', @@ -235,7 +235,7 @@ return [ 'index' => '前台', 'admin' => '后台', ], - 'value' => '', + 'value' => 'api,index', 'rule' => '', 'msg' => '', 'tip' => '', diff --git a/addons/hwobs/controller/Index.php b/addons/hwobs/controller/Index.php index e630c82..734675e 100644 --- a/addons/hwobs/controller/Index.php +++ b/addons/hwobs/controller/Index.php @@ -2,16 +2,17 @@ namespace addons\hwobs\controller; -use addons\hwobs\library\Auth; -use addons\hwobs\library\Signer; -use app\common\exception\UploadException; -use app\common\library\Upload; -use app\common\model\Attachment; -use Obs\Internal\Common\Model; -use Obs\Internal\Signature\DefaultSignature; -use Obs\ObsClient; -use think\addons\Controller; use think\Config; +use Obs\ObsClient; +use addons\hwobs\Hwobs; +use think\addons\Controller; +use addons\hwobs\library\Auth; +use app\common\library\Upload; +use Obs\Internal\Common\Model; +use addons\hwobs\library\Signer; +use app\common\model\Attachment; +use app\common\exception\UploadException; +use Obs\Internal\Signature\DefaultSignature; class Index extends Controller { @@ -31,6 +32,13 @@ class Index extends Controller $this->error("当前插件暂无前台页面"); } + public function config() + { + $upload = []; + (new Hwobs)->uploadConfigInit($upload); + $this->success('', null, $upload); + } + public function params() { $this->check(); @@ -83,8 +91,7 @@ class Index extends Controller $signature = $obs->createPostSignature([ 'Bucket' => $config['bucket'], 'Key' => $key, - 'FormParams' => [ - ] + 'FormParams' => [] ]); $params['key'] = $key; $params['AccessKeyId'] = $config['accessKey']; @@ -328,5 +335,4 @@ class Index extends Controller $this->error("请求已经超时"); } } - } diff --git a/vendor/fastadminnet/fastadmin-addons/src/addons/Controller.php b/vendor/fastadminnet/fastadmin-addons/src/addons/Controller.php index fea2c4f..457ff5c 100644 --- a/vendor/fastadminnet/fastadmin-addons/src/addons/Controller.php +++ b/vendor/fastadminnet/fastadmin-addons/src/addons/Controller.php @@ -63,7 +63,7 @@ class Controller extends \think\Controller * @param Request $request Request对象 * @access public */ - public function __construct(Request $request = null) + public function __construct(?Request $request = null) { if (is_null($request)) { $request = Request::instance();