修正oss类

This commit is contained in:
wucongxing 2023-02-22 11:54:08 +08:00
parent fe23aee366
commit 2c04c5e192
2 changed files with 17 additions and 3 deletions

View File

@ -17,7 +17,7 @@ class SafeService extends BaseService
public function getOssSign(): array public function getOssSign(): array
{ {
$user_type = $this->request->input('user_type'); $user_type = $this->request->input('user_type');
$path = $this->request->input('path'); $scene = $this->request->input('scene');
$user_info = $this->request->getAttribute("userInfo") ?? []; $user_info = $this->request->getAttribute("userInfo") ?? [];
if (empty($user_info)){ if (empty($user_info)){
@ -32,7 +32,21 @@ class SafeService extends BaseService
$dir = "applet/pharmacist/"; $dir = "applet/pharmacist/";
} }
$dir = $dir . $path; $dir = $dir . $scene;
switch ($scene) {
case 1:
// 头像
$dir = $dir . 'avatar/';
break;
case 2:
// 证书
$dir = $dir . 'cert/';
break;
default:
// code...
break;
}
// 获取用户数据 // 获取用户数据
$params = array(); $params = array();

View File

@ -57,7 +57,7 @@ class Oss
$response = array(); $response = array();
$response['accessid'] = $this->config['accessKey']; $response['accessid'] = $this->config['accessKey'];
$response['host'] = $this->config['bucket'] . '.' . $this->config['endpoint']; $response['host'] = "https://" . $this->config['bucket'] . '.' . $this->config['endpoint'];
$response['policy'] = $base64_policy; $response['policy'] = $base64_policy;
$response['signature'] = $signature; $response['signature'] = $signature;
$response['expire'] = $end; $response['expire'] = $end;