Compare commits

..

8 Commits

Author SHA1 Message Date
ch4o5
0705d1bef3 chore(release): 0.2.4 2023-01-13 20:20:00 +00:00
李东云
922c780c49 fix(oss): 修复了oss的配置缺失和错误 2023-01-14 04:19:46 +08:00
李东云
cdb193778f revert(constant): 移除冗余的http头authentication的枚举类型 2023-01-14 04:18:48 +08:00
ch4o5
9633fa6b8d chore(release): 0.2.3 2023-01-13 18:54:16 +00:00
李东云
08c1f6609c feat(constant): 增加http头authentication的枚举类型 2023-01-14 02:52:52 +08:00
李东云
3a1f2695fe docs(link): 增加错误码对应的语雀文档 2023-01-14 02:52:10 +08:00
ch4o5
50885c57e2 chore(release): 0.2.2 2023-01-13 18:17:21 +00:00
李东云
9f9ff31a83 perf(exceptions.handler): 优化trace显示格式 2023-01-14 02:16:37 +08:00
8 changed files with 47 additions and 10 deletions

View File

@@ -1,4 +1,35 @@
# 版本更新日志
### [0.2.4](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v0.2.3...v0.2.4) (2023-01-13)
### ⏪ Revert | 回退
* **constant:** 移除冗余的http头authentication的枚举类型 ([cdb1937](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/cdb193778fb888851682bb1671bc55dd8f0e3423))
### 🐛 Bug Fixes | Bug 修复
* **oss:** 修复了oss的配置缺失和错误 ([922c780](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/922c780c49edc2cddbce3e66e6b9dfde7be364f8))
### [0.2.3](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v0.2.2...v0.2.3) (2023-01-13)
### ✏️ Documentation | 文档
* **link:** 增加错误码对应的语雀文档 ([3a1f269](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/3a1f2695fef03840d9afe3578f3e7ed33da45926))
### ✨ Features | 新功能
* **constant:** 增加http头authentication的枚举类型 ([08c1f66](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/08c1f6609c3035dd7d7f39e8389b66a8ba2e34a5))
### [0.2.2](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v0.2.1...v0.2.2) (2023-01-13)
### ⚡ Performance Improvements | 性能优化
* **exceptions.handler:** 优化trace显示格式 ([9f9ff31](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/9f9ff31a83ea5662500c688471b78f02ff67eb15))
### 0.2.1 (2023-01-13)

View File

@@ -1 +1 @@
0.2.1
0.2.4

View File

@@ -107,5 +107,5 @@
"url": "https://repo.huaweicloud.com/repository/php/"
}
},
"version": "0.2.1"
"version": "0.2.4"
}

View File

@@ -76,6 +76,8 @@ return [
'oss' => [
'access_key_id' => env('ACCESS_KEY_ID', ''),
'access_key_secret' => env('ACCESS_KEY_SECRET', ''),
'oss_host' => env('OSS_HOST', ''),
'oss_callback' => env('OSS_CALLBACK'), // 可选
],
],
],

View File

@@ -19,6 +19,8 @@ use Hyperf\Constants\Annotation\Constants;
* @author 李东云<dongyun.li@luxcreo.cn>
* Powered by PhpStorm
* Created on 2022/4/25
*
* @see https://lux-software.yuque.com/htnx76/vcm2oc/pkzgpv
*/
#[Constants]
class CommonErrorCode extends AbstractConstants

View File

@@ -153,7 +153,7 @@ class CommonHandler extends ExceptionHandler
}
$response = $response->withHeader(Header::CONTENT_TYPE, 'application/json; charset=utf-8');
if ($is_debug && $is_testing) {
$data['trace'] = ['errorType' => $error_type, 'errorTrack' => $throwable->getTrace()];
$data += ['errorType' => $error_type, 'errorTrack' => $throwable->getTrace()];
}
$cookies = json_encode($this->request->getCookieParams(), JSON_UNESCAPED_UNICODE);
$this->logger->error(

View File

@@ -29,7 +29,7 @@ class OssService
$this->accessKeyId ??= config('common.third_party.storage.oss.access_key_id');
$this->accessKeySecret ??= config('common.third_party.storage.oss.access_key_secret');
$this->host ??= config('common.third_party.storage.oss.oss_host');
$this->callbackUrl ??= config('oss_callback');
$this->callbackUrl ??= config('common.third_party.storage.oss.oss_callback') ?? null;
}
/**
@@ -84,7 +84,7 @@ class OssService
$string_to_sign = $base64_policy;
$signature = base64_encode(hash_hmac('sha1', $string_to_sign, $this->accessKeySecret, true));
$callback = Json::encode([
$callback = isset($this->callbackUrl) ? Json::encode([
'callbackUrl' => $this->callbackUrl,
'callbackBody' => $isImage ? <<<'callbackBody'
{
@@ -102,7 +102,7 @@ class OssService
"name": ${x:name},
"hash": ${x:hash}
}
callbackBody : <<<'callbackBody'
callbackBody: <<<'callbackBody'
{
"bucket": ${bucket},
"object": ${object},
@@ -115,17 +115,20 @@ callbackBody : <<<'callbackBody'
}
callbackBody,
'callbackBodyType' => 'application/json',
]);
]) : null;
return [
$result = [
'accessid' => $this->accessKeyId,
'host' => $this->host,
'policy' => $base64_policy,
'signature' => $signature,
'expire' => $expire_time,
'dir' => $dir,
'callback' => base64_encode($callback),
];
if (isset($callback)) {
$result += ['callback' => base64_encode($callback),];
}
return $result;
}
/**

View File

@@ -25,7 +25,6 @@ class UtilsService
* @return string
* @throws Exception
*/
#[Pure]
public function generateSecureCode(int $length = 4): string
{
$code = '';