feat(hwobs): 返回华为obs参数

This commit is contained in:
2025-05-18 10:47:10 +08:00
parent e420668a44
commit 6c4fc6bff6
3 changed files with 24 additions and 18 deletions

View File

@@ -30,7 +30,7 @@ return [
'title' => '存储桶名称', 'title' => '存储桶名称',
'type' => 'string', 'type' => 'string',
'content' => [], 'content' => [],
'value' => 'zhongyi542', 'value' => 'doxixi',
'rule' => 'required', 'rule' => 'required',
'msg' => '', 'msg' => '',
'tip' => '存储桶名称', 'tip' => '存储桶名称',
@@ -54,7 +54,7 @@ return [
'title' => '上传接口地址', 'title' => '上传接口地址',
'type' => 'string', 'type' => 'string',
'content' => [], 'content' => [],
'value' => 'https://zhongyi542.obs.cn-south-1.myhuaweicloud.com', 'value' => 'https://doxixi.obs.cn-south-1.myhuaweicloud.com',
'rule' => 'required;uploadurl', 'rule' => 'required;uploadurl',
'msg' => '', 'msg' => '',
'tip' => '请使用存储桶->基本信息->访问域名的值并在前面加上http://或https://', 'tip' => '请使用存储桶->基本信息->访问域名的值并在前面加上http://或https://',
@@ -66,7 +66,7 @@ return [
'title' => 'CDN地址', 'title' => 'CDN地址',
'type' => 'string', 'type' => 'string',
'content' => [], 'content' => [],
'value' => 'https://zhongyi542.obs.cn-south-1.myhuaweicloud.com', 'value' => 'https://doxixi.obs.cn-south-1.myhuaweicloud.com',
'rule' => 'required;cdnurl', 'rule' => 'required;cdnurl',
'msg' => '', 'msg' => '',
'tip' => '如果你的云存储有绑定自定义域名,请输入自定义域名', 'tip' => '如果你的云存储有绑定自定义域名,请输入自定义域名',
@@ -183,7 +183,7 @@ return [
1 => '开启', 1 => '开启',
0 => '关闭', 0 => '关闭',
], ],
'value' => '0', 'value' => '1',
'rule' => 'required', 'rule' => 'required',
'msg' => '', 'msg' => '',
'tip' => '', 'tip' => '',
@@ -235,7 +235,7 @@ return [
'index' => '前台', 'index' => '前台',
'admin' => '后台', 'admin' => '后台',
], ],
'value' => '', 'value' => 'api,index',
'rule' => '', 'rule' => '',
'msg' => '', 'msg' => '',
'tip' => '', 'tip' => '',

View File

@@ -2,16 +2,17 @@
namespace addons\hwobs\controller; 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 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 class Index extends Controller
{ {
@@ -31,6 +32,13 @@ class Index extends Controller
$this->error("当前插件暂无前台页面"); $this->error("当前插件暂无前台页面");
} }
public function config()
{
$upload = [];
(new Hwobs)->uploadConfigInit($upload);
$this->success('', null, $upload);
}
public function params() public function params()
{ {
$this->check(); $this->check();
@@ -83,8 +91,7 @@ class Index extends Controller
$signature = $obs->createPostSignature([ $signature = $obs->createPostSignature([
'Bucket' => $config['bucket'], 'Bucket' => $config['bucket'],
'Key' => $key, 'Key' => $key,
'FormParams' => [ 'FormParams' => []
]
]); ]);
$params['key'] = $key; $params['key'] = $key;
$params['AccessKeyId'] = $config['accessKey']; $params['AccessKeyId'] = $config['accessKey'];
@@ -328,5 +335,4 @@ class Index extends Controller
$this->error("请求已经超时"); $this->error("请求已经超时");
} }
} }
} }

View File

@@ -63,7 +63,7 @@ class Controller extends \think\Controller
* @param Request $request Request对象 * @param Request $request Request对象
* @access public * @access public
*/ */
public function __construct(Request $request = null) public function __construct(?Request $request = null)
{ {
if (is_null($request)) { if (is_null($request)) {
$request = Request::instance(); $request = Request::instance();