Commit 7425af1c authored by 刘小敏's avatar 刘小敏

上传文件设置公共读权限;obs插件状态开;

parent bf77467c
......@@ -70,6 +70,7 @@ class Index extends Controller
$ret = $obs->initiateMultipartUpload([
'Bucket' => $config['bucket'],
'Key' => $key,
'ACL' => 'public-read', // 设置公共读权限
]);
} catch (\Exception $e) {
$this->error("上传失败");
......@@ -84,12 +85,14 @@ class Index extends Controller
'Bucket' => $config['bucket'],
'Key' => $key,
'FormParams' => [
'acl' => 'public-read' // 设置公共读权限
]
]);
$params['key'] = $key;
$params['AccessKeyId'] = $config['accessKey'];
$params['policy'] = $signature['Policy'];
$params['signature'] = $signature['Signature'];
$params['acl'] = 'public-read'; // 传递 ACL 参数给前端
}
$params['headers'] = $headers;
$params['date'] = $date;
......@@ -237,7 +240,8 @@ class Index extends Controller
$ret = $obs->putObject([
'Bucket' => $config['bucket'],
'Key' => ltrim($attachment->url, '/'),
'SourceFile' => $filePath
'SourceFile' => $filePath,
'ACL' => 'public-read', // 设置公共读权限
]);
//成功不做任何操作
} catch (\Exception $e) {
......
......@@ -4,7 +4,7 @@ intro = 使用华为OBS作为默认云储存
author = FastAdmin
website =
version = 1.2.10
state = 0
state = 1
url = /addons/hwobs
license = regular
licenseto = 114257
<?php
return [
'autoload' => false,
'hooks' => [
'epay_config_init' => [
'epay',
],
'addon_action_begin' => [
'epay',
],
'action_begin' => [
'epay',
],
'upgrade' => [
'shopro',
'simditor',
],
'app_init' => [
'shopro',
],
'config_init' => [
'shopro',
'simditor',
],
],
'route' => [
'/example$' => 'example/index/index',
'/example/d/[:name]' => 'example/demo/index',
'/example/d1/[:name]' => 'example/demo/demo1',
'/example/d2/[:name]' => 'example/demo/demo2',
],
'priority' => [],
'domain' => '',
];
return array (
'autoload' => false,
'hooks' =>
array (
'epay_config_init' =>
array (
0 => 'epay',
),
'addon_action_begin' =>
array (
0 => 'epay',
),
'action_begin' =>
array (
0 => 'epay',
),
'module_init' =>
array (
0 => 'hwobs',
),
'upload_config_init' =>
array (
0 => 'hwobs',
),
'upload_delete' =>
array (
0 => 'hwobs',
),
'app_init' =>
array (
0 => 'hwobs',
1 => 'shopro',
),
'upgrade' =>
array (
0 => 'shopro',
1 => 'simditor',
),
'config_init' =>
array (
0 => 'shopro',
1 => 'simditor',
),
),
'route' =>
array (
'/example$' => 'example/index/index',
'/example/d/[:name]' => 'example/demo/index',
'/example/d1/[:name]' => 'example/demo/demo1',
'/example/d2/[:name]' => 'example/demo/demo2',
),
'priority' =>
array (
),
'domain' => '',
);
......@@ -7,9 +7,9 @@ return [
*/
'uploadurl' => 'ajax/upload',
/**
* CDN地址
* CDN地址(华为云OBS域名)
*/
'cdnurl' => '',
'cdnurl' => 'https://beevera.obs.cn-east-3.myhuaweicloud.com',
/**
* 文件保存格式
*/
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment