mirror of
http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore.git
synced 2026-01-15 05:35:09 +08:00
Compare commits
9 Commits
v1.0.0-bet
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6464880c4 | ||
|
|
29ad0ab1c9 | ||
|
|
d1702f7726 | ||
|
|
45824755c6 | ||
|
|
7237cc3d03 | ||
|
|
bc9977a16f | ||
|
|
115a6b154d | ||
|
|
b2cf757bf6 | ||
|
|
3a1f912520 |
@@ -19,10 +19,10 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install zip
|
apt-get install zip
|
||||||
zip -r hdk-core.dist.zip *
|
zip -r dist.zip *
|
||||||
- name: Publish to registry
|
- name: Publish to registry
|
||||||
run: |
|
run: |
|
||||||
curl --user ch4o5:4fd300672472e666014314c1c94c604c634165a9 \
|
curl --user ch4o5:4fd300672472e666014314c1c94c604c634165a9 \
|
||||||
--upload-file ./hdk-core.dist.zip \
|
--upload-file ./dist.zip \
|
||||||
https://nest.doylee.cn/api/packages/HDK/composer?version=${{ gitea.ref_name }}-alpha
|
https://nest.doylee.cn/api/packages/HDK/composer?version=${{ gitea.ref_name }}
|
||||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||||
6
.idea/phpspec.xml
generated
6
.idea/phpspec.xml
generated
@@ -5,6 +5,12 @@
|
|||||||
<PhpSpecSuiteConfiguration>
|
<PhpSpecSuiteConfiguration>
|
||||||
<option name="myPath" value="$PROJECT_DIR$" />
|
<option name="myPath" value="$PROJECT_DIR$" />
|
||||||
</PhpSpecSuiteConfiguration>
|
</PhpSpecSuiteConfiguration>
|
||||||
|
<PhpSpecSuiteConfiguration>
|
||||||
|
<option name="myPath" value="$PROJECT_DIR$" />
|
||||||
|
</PhpSpecSuiteConfiguration>
|
||||||
|
<PhpSpecSuiteConfiguration>
|
||||||
|
<option name="myPath" value="$PROJECT_DIR$" />
|
||||||
|
</PhpSpecSuiteConfiguration>
|
||||||
</suites>
|
</suites>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
25
CHANGELOG.md
25
CHANGELOG.md
@@ -1,4 +1,29 @@
|
|||||||
# 版本更新日志
|
# 版本更新日志
|
||||||
|
### [1.0.3](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.2...v1.0.3) (2025-11-25)
|
||||||
|
|
||||||
|
|
||||||
|
### 🚀 Chore | 构建/工程依赖/工具
|
||||||
|
|
||||||
|
* **deps:** 更新 roave/dont 依赖版本约束 ([29ad0ab](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/29ad0ab1c9c7bd8a634505a390efda82d954a929))
|
||||||
|
|
||||||
|
### [1.0.2](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.1...v1.0.2) (2025-09-26)
|
||||||
|
|
||||||
|
### [1.0.1](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0...v1.0.1) (2025-08-19)
|
||||||
|
|
||||||
|
|
||||||
|
### 👷 Continuous Integration | CI 配置
|
||||||
|
|
||||||
|
* **gitea:** 更新发布流程并简化版本号 ([bc9977a](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/bc9977a16f0a996aebccda403ceb51b65c28dddd))
|
||||||
|
|
||||||
|
## [1.0.0](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-beta.14...v1.0.0) (2025-08-18)
|
||||||
|
|
||||||
|
## [1.0.0-beta.14](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-beta.13...v1.0.0-beta.14) (2025-08-12)
|
||||||
|
|
||||||
|
|
||||||
|
### ♻️ Code Refactoring | 代码重构
|
||||||
|
|
||||||
|
* **exception:** 重构异常处理逻辑 ([3a1f912](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/3a1f912520999ec947295efed564448a85ad1039))
|
||||||
|
|
||||||
## [1.0.0-beta.13](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-beta.12...v1.0.0-beta.13) (2025-08-08)
|
## [1.0.0-beta.13](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-beta.12...v1.0.0-beta.13) (2025-08-08)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
1.0.0-beta.13
|
1.0.3
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
"jetbrains/phpstorm-attributes": "^1.0",
|
"jetbrains/phpstorm-attributes": "^1.0",
|
||||||
"lmc/http-constants": "^1.2.0",
|
"lmc/http-constants": "^1.2.0",
|
||||||
"myclabs/php-enum": "^1.8.4",
|
"myclabs/php-enum": "^1.8.4",
|
||||||
"roave/dont": "^1.6.0",
|
"roave/dont": "*",
|
||||||
"symfony/http-foundation": "^6.4",
|
"symfony/http-foundation": "^6.4",
|
||||||
"symfony/polyfill-php81": "^1.28",
|
"symfony/polyfill-php81": "^1.28",
|
||||||
"symfony/polyfill-php82": "^1.28",
|
"symfony/polyfill-php82": "^1.28",
|
||||||
@@ -136,5 +136,5 @@
|
|||||||
"url": "https://mirrors.aliyun.com/composer/"
|
"url": "https://mirrors.aliyun.com/composer/"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"version": "1.0.0-beta.13"
|
"version": "1.0.3"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ class CommonErrorCode extends AbstractConstants
|
|||||||
|
|
||||||
// 500 业务错误
|
// 500 业务错误
|
||||||
|
|
||||||
#[Message('common_error.business.defaul')]
|
#[Message('common_error.business.default')]
|
||||||
public const BUSINESS_ERROR = 500001;
|
public const BUSINESS_ERROR = 500001;
|
||||||
// 501 版本问题
|
// 501 版本问题
|
||||||
#[Message('common_error.business.old_version')]
|
#[Message('common_error.business.old_version')]
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ use Teapot\StatusCode\RFC\RFC7231;
|
|||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
use function Hyperf\Config\config;
|
use function Hyperf\Config\config;
|
||||||
|
use function Hyperf\Support\make;
|
||||||
use function Hyperf\Translation\__;
|
use function Hyperf\Translation\__;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,9 +55,6 @@ use function Hyperf\Translation\__;
|
|||||||
*/
|
*/
|
||||||
class CommonHandler extends ExceptionHandler
|
class CommonHandler extends ExceptionHandler
|
||||||
{
|
{
|
||||||
#[Inject(required: false)]
|
|
||||||
private ?RequestInterface $request;
|
|
||||||
|
|
||||||
#[Inject]
|
#[Inject]
|
||||||
private StdoutLogger $logger;
|
private StdoutLogger $logger;
|
||||||
|
|
||||||
@@ -70,18 +68,23 @@ class CommonHandler extends ExceptionHandler
|
|||||||
{
|
{
|
||||||
// 阻止异常冒泡
|
// 阻止异常冒泡
|
||||||
$this->stopPropagation();
|
$this->stopPropagation();
|
||||||
|
if ($throwable instanceof BadRequestHttpException) {
|
||||||
|
$request = $throwable->getRequest();
|
||||||
|
} else {
|
||||||
|
$request = make(RequestInterface::class);
|
||||||
|
}
|
||||||
$restful = $this->apiStyleService->get();
|
$restful = $this->apiStyleService->get();
|
||||||
// $restful = config('common.response.restful');
|
// $restful = config('common.response.restful');
|
||||||
$code_name = config('common.response.code_name');
|
$code_name = config('common.response.code_name');
|
||||||
$message_name = config('common.response.message_name');
|
$message_name = config('common.response.message_name');
|
||||||
$is_testing = config('app_status') === true;
|
$is_testing = config('app_status') === true;
|
||||||
$this->request?->url();
|
$request?->url();
|
||||||
|
|
||||||
$is_debug = $is_testing;
|
$is_debug = $is_testing;
|
||||||
$error_type = $throwable::class;
|
$error_type = $throwable::class;
|
||||||
$request_time = Carbon::now()->toDateTimeString();
|
$request_time = Carbon::now()->toDateTimeString();
|
||||||
$request_data = Json::encode($this->request?->getParsedBody());
|
$request_data = $request?->getBody()->getContents();
|
||||||
$request_headers = Json::encode($this->request?->getHeaders());
|
$request_headers = Json::encode($request?->getHeaders());
|
||||||
// 901 程序语法错误
|
// 901 程序语法错误
|
||||||
// 902 SQL 语法错误
|
// 902 SQL 语法错误
|
||||||
if ($throwable instanceof QueryException) {
|
if ($throwable instanceof QueryException) {
|
||||||
@@ -125,7 +128,7 @@ class CommonHandler extends ExceptionHandler
|
|||||||
$data = [
|
$data = [
|
||||||
$code_name => $code,
|
$code_name => $code,
|
||||||
$message_name => CommonErrorCode::getMessage($code, ['methods' => join(', ', $allow_method)]),
|
$message_name => CommonErrorCode::getMessage($code, ['methods' => join(', ', $allow_method)]),
|
||||||
'currentMethod' => $this->request?->getMethod(),
|
'currentMethod' => $request?->getMethod(),
|
||||||
'allowedMethod' => $allow_method,
|
'allowedMethod' => $allow_method,
|
||||||
];
|
];
|
||||||
$status_code = RFC7231::METHOD_NOT_ALLOWED;
|
$status_code = RFC7231::METHOD_NOT_ALLOWED;
|
||||||
@@ -257,37 +260,37 @@ class CommonHandler extends ExceptionHandler
|
|||||||
if ($is_debug && $is_testing) {
|
if ($is_debug && $is_testing) {
|
||||||
$data += ['errorType' => $error_type, 'errorTrack' => $throwable->getTrace()];
|
$data += ['errorType' => $error_type, 'errorTrack' => $throwable->getTrace()];
|
||||||
}
|
}
|
||||||
$cookies = json_encode($this->request->getCookieParams(), JSON_UNESCAPED_UNICODE);
|
$cookies = json_encode($request->getCookieParams(), JSON_UNESCAPED_UNICODE);
|
||||||
$this->logger->error(
|
$this->logger->error(
|
||||||
<<<ERROR_LOG
|
<<<ERROR_LOG
|
||||||
TYPE: {$error_type}
|
TYPE: {$error_type}
|
||||||
[$data[$code_name]] $data[$message_name]
|
[$data[$code_name]] $data[$message_name]
|
||||||
{$throwable->getMessage()}
|
{$throwable->getMessage()}
|
||||||
-------------------------------
|
-------------------------------
|
||||||
REQUEST_TIME: {$request_time}
|
REQUEST_TIME: {$request_time}
|
||||||
-------------------------------
|
-------------------------------
|
||||||
REQUEST_HEADERS:
|
REQUEST_HEADERS:
|
||||||
{$request_headers}
|
{$request_headers}
|
||||||
-------------------------------
|
-------------------------------
|
||||||
REQUEST_COOKIES:
|
REQUEST_COOKIES:
|
||||||
{$cookies}
|
{$cookies}
|
||||||
-------------------------------
|
-------------------------------
|
||||||
REQUEST_METHOD:
|
REQUEST_METHOD:
|
||||||
{$this->request?->getMethod()}
|
{$request?->getMethod()}
|
||||||
-------------------------------
|
-------------------------------
|
||||||
REQUEST_URL:
|
REQUEST_URL:
|
||||||
{$this->request?->getUri()}
|
{$request?->getUri()}
|
||||||
-------------------------------
|
-------------------------------
|
||||||
REQUEST_QUERY:
|
REQUEST_QUERY:
|
||||||
{$this->request?->getQueryString()}
|
{$request?->getUri()->getQuery()}
|
||||||
-------------------------------
|
-------------------------------
|
||||||
REQUEST_DATA:
|
REQUEST_DATA:
|
||||||
{$request_data}
|
{$request_data}
|
||||||
-------------------------------
|
-------------------------------
|
||||||
TRACE:
|
TRACE:
|
||||||
{$throwable->getTraceAsString()}
|
{$throwable->getTraceAsString()}
|
||||||
===============================
|
===============================
|
||||||
ERROR_LOG,
|
ERROR_LOG,
|
||||||
);
|
);
|
||||||
$data = Json::encode($data);
|
$data = Json::encode($data);
|
||||||
if ($restful === ApiStyleService::RESTFUL) {
|
if ($restful === ApiStyleService::RESTFUL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user