Compare commits

...

47 Commits

Author SHA1 Message Date
李东云
f1957b5156 chore(release): 1.0.0-alpha.12 2023-10-23 11:38:04 +00:00
李东云
418f4c47c9 ci(GiteaActions): 现在只会根据 tag确定是否发布
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 19:37:19 +08:00
李东云
635804e117 ci(GiteaActions): 修复推送的组织名错误问题
All checks were successful
Publish when Pushed / Explore-Gitea-Actions (push) Successful in 21s
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 19:21:33 +08:00
李东云
82d9a95691 ci(GiteaActions): 使用密钥推送包
All checks were successful
Publish when Pushed / Explore-Gitea-Actions (push) Successful in 22s
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 19:19:58 +08:00
李东云
063c1d7ea1 ci(GiteaActions): 安装 zip
All checks were successful
Publish when Pushed / Explore-Gitea-Actions (push) Successful in 22s
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 19:11:07 +08:00
李东云
9cdbd6a2c8 ci(GiteaActions): 修复错误的action 写法
Some checks failed
Publish when Pushed / Explore-Gitea-Actions (push) Failing after 22s
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 19:09:59 +08:00
李东云
4cc1473d38 ci(GiteaActions): 不切换分支
Some checks failed
Publish when Pushed / Explore-Gitea-Actions (push) Failing after 4s
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 19:07:56 +08:00
李东云
895b028017 ci(GiteaActions): 修复镜像不包含 zip 的问题
Some checks failed
Publish when Pushed / Explore-Gitea-Actions (push) Failing after 3s
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 19:02:36 +08:00
李东云
094589b87e ci(GiteaActions): 修复镜像不包含 zip 的问题
All checks were successful
Publish when Pushed / Explore-Gitea-Actions (push) Has been cancelled
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 18:59:33 +08:00
李东云
85ae11e295 ci(GiteaActions): 修复镜像不包含 zip 的问题
All checks were successful
Publish when Pushed / Explore-Gitea-Actions (push) Has been cancelled
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 18:58:34 +08:00
李东云
6cb24a84b2 ci(GiteaActions): 修改触发条件
All checks were successful
Publish when Pushed / Explore-Gitea-Actions (push) Has been cancelled
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 18:50:21 +08:00
李东云
118f0b789f ci(GiteaActions): 修复镜像不包含 zip 的问题
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 18:49:54 +08:00
李东云
7dfb3933f6 ci(GiteaActions): 尝试增加推送触发的 actions
Some checks failed
Publish when Released / Explore-Gitea-Actions (push) Has been cancelled
Publish when Pushed / Explore-Gitea-Actions (push) Failing after 1m5s
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 18:33:10 +08:00
李东云
b32afe38b4 ci(GiteaActions): 增加了 actions
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-23 17:36:28 +08:00
李东云
a46659f62b chore(release): 1.0.0-alpha.11 2023-10-17 02:55:37 +00:00
李东云
f80da66185 ci(docker): 兼容 ext-redis:6.0
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-17 10:55:26 +08:00
李东云
4e5b0fdbb4 chore(release): 1.0.0-alpha.10 2023-10-16 09:36:18 +00:00
李东云
17c0518680 feat(rest): 增加多表关联的兼容
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-16 17:35:30 +08:00
李东云
37d42c17cc build(composer): 更新依赖
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-16 17:34:24 +08:00
李东云
12e99604c9 build(script): root 用户可以使用 composer
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-16 17:31:24 +08:00
李东云
217178003a chore(release): 1.0.0-alpha.9 2023-10-13 07:40:37 +00:00
李东云
359b13e718 build(config): 更新了默认的发件邮箱
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-13 15:40:06 +08:00
李东云
e9927fafb1 build(composer): 更新依赖
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-08 15:45:44 +08:00
李东云
02655228ae chore(release): 1.0.0-alpha.8 2023-10-08 07:44:10 +00:00
李东云
9f7d4effb7 feat(email): 增加了对邮件优先级的兼容
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-10-08 15:43:47 +08:00
李东云
5980ea773b chore(release): 1.0.0-alpha.7 2023-09-28 08:06:29 +00:00
李东云
110679448f fix(rest): 修复不存在的具名参数
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-09-28 15:50:47 +08:00
李东云
64f936ab36 chore(release): 1.0.0-alpha.6 2023-09-28 06:59:13 +00:00
李东云
2afc3ad45b fix(rest): 修复没有返回值的问题
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-09-28 14:59:01 +08:00
李东云
cff919a21e fix(i18n): 修复了无法正确无视大小写导致无法识别的问题
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-09-26 16:23:52 +08:00
李东云
2d6d12e1c3 chore(release): 1.0.0-alpha.5 2023-09-26 08:23:29 +00:00
李东云
73420153d3 fix(i18n): 修复了无法正确无视大小写导致无法识别的问题
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-09-26 16:23:16 +08:00
李东云
fcb0cd8852 chore(release): 1.0.0-alpha.4 2023-09-26 02:55:03 +00:00
李东云
7a209e876f test(http): 完成并通过了 http 请求的测试
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-09-26 10:54:44 +08:00
李东云
4032d67f1e feat(i18n): 增加枚举值,更新中间件调用方式
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-09-26 10:44:00 +08:00
李东云
dbbe278aa6 build(composer): 引入 pest 并升级到 php8.1
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-09-26 10:43:20 +08:00
李东云
d84855f038 chore(release): 1.0.0-alpha.3 2023-08-30 03:42:37 +00:00
李东云
2d95fbae9e refactor(http): 整理了 Http 请求服务
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-08-30 11:41:59 +08:00
李东云
3042ce0054 chore(release): 1.0.0-alpha.2 2023-07-21 08:22:48 +00:00
李东云
b30c84488b fix(controller): 修复方法访问级别不足以继承的问题
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-07-21 16:22:36 +08:00
李东云
c262d38ad0 chore(release): 1.0.0-alpha.1 2023-07-21 03:39:01 +00:00
李东云
a8ec7d8255 build(composer): 更新依赖
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-07-21 11:38:31 +08:00
李东云
f1948ab0fe build(release): 增加 alpha 标识,准备正式版
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-07-21 11:04:39 +08:00
李东云
ae8001a595 chore(release): 1.0.0-alpha.0 2023-07-21 03:01:22 +00:00
李东云
68844a6132 feat(controller): 增加了一个 Rest 风格的 trait
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-07-21 10:55:10 +08:00
李东云
fd788a7eb8 feat(trait): 增加了分页响应的统一处理方法
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-07-19 15:52:35 +08:00
李东云
7ccf36b398 docs(utils): 移除了导致编辑器出错的注解
Signed-off-by: 李东云 <dongyu.li@luxcreo.ai>
2023-07-07 10:31:31 +08:00
32 changed files with 10610 additions and 9713 deletions

View File

@@ -0,0 +1,25 @@
name: Release to registry
on: [ release ]
jobs:
Publish on Released:
runs-on: ubuntu-latest
steps:
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- name: Zip files in the repository
run: |
apt-get update
apt-get install zip
zip hdk-core.dist.zip *
- name: Publish to registry
run: |
curl --user ch4o5:4fd300672472e666014314c1c94c604c634165a9 \
--upload-file ./hdk-core.dist.zip \
https://nest.doylee.cn/api/packages/HDK/composer?version=${{ gitea.ref_name }}
- run: echo "🍏 This job's status is ${{ job.status }}."

View File

@@ -0,0 +1,25 @@
name: Release development version to registry
on: [ tag ]
jobs:
Publish on Tagged:
runs-on: ubuntu-latest
steps:
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v4
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- name: Zip files in the repository
run: |
apt-get update
apt-get install zip
zip hdk-core.dist.zip *
- name: Publish to registry
run: |
curl --user ch4o5:4fd300672472e666014314c1c94c604c634165a9 \
--upload-file ./hdk-core.dist.zip \
https://nest.doylee.cn/api/packages/HDK/composer?version=${{ gitea.ref_name }}-alpha
- run: echo "🍏 This job's status is ${{ job.status }}."

3
.gitignore vendored
View File

@@ -1,3 +1,4 @@
vendor/
.phpunit.result.cache
.php-cs-fixer.cache
.php-cs-fixer.cache
runtime/

8
.idea/HDK-Core.iml generated
View File

@@ -2,8 +2,8 @@
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" packagePrefix="Singularity\HDK\Core\" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" packagePrefix="Singularity\HDK\Test\Core\" />
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/recursion-context" />
<excludeFolder url="file://$MODULE_DIR$/vendor/sebastian/lines-of-code" />
@@ -31,7 +31,6 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/fig/http-message-util" />
<excludeFolder url="file://$MODULE_DIR$/vendor/lmc/http-constants" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/cache" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-server-handler" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/event-dispatcher" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/http-server-middleware" />
@@ -111,7 +110,6 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/theseer/tokenizer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/lexer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/inflector" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/annotations" />
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/instantiator" />
<excludeFolder url="file://$MODULE_DIR$/vendor/ergebnis/http-method" />
<excludeFolder url="file://$MODULE_DIR$/vendor/firebase/php-jwt" />
@@ -158,6 +156,10 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/hyperf/serializer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/hyperf/stringable" />
<excludeFolder url="file://$MODULE_DIR$/vendor/hyperf/support" />
<excludeFolder url="file://$MODULE_DIR$/vendor/cooper/hyperf-pest" />
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/clock" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php83" />
<excludeFolder url="file://$MODULE_DIR$/runtime" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

12
.idea/codeception.xml generated Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Codeception">
<option name="configurations">
<list>
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
</list>
</option>
</component>
</project>

6
.idea/pest.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PestSettings">
<option name="preferredTestFlavor" value="TEST" />
</component>
</project>

7
.idea/php.xml generated
View File

@@ -46,7 +46,6 @@
<path value="$PROJECT_DIR$/vendor/composer" />
<path value="$PROJECT_DIR$/vendor/fig/http-message-util" />
<path value="$PROJECT_DIR$/vendor/lmc/http-constants" />
<path value="$PROJECT_DIR$/vendor/psr/cache" />
<path value="$PROJECT_DIR$/vendor/psr/http-server-handler" />
<path value="$PROJECT_DIR$/vendor/psr/event-dispatcher" />
<path value="$PROJECT_DIR$/vendor/psr/http-server-middleware" />
@@ -130,7 +129,6 @@
<path value="$PROJECT_DIR$/vendor/theseer/tokenizer" />
<path value="$PROJECT_DIR$/vendor/doctrine/lexer" />
<path value="$PROJECT_DIR$/vendor/doctrine/inflector" />
<path value="$PROJECT_DIR$/vendor/doctrine/annotations" />
<path value="$PROJECT_DIR$/vendor/doctrine/instantiator" />
<path value="$PROJECT_DIR$/vendor/ergebnis/http-method" />
<path value="$PROJECT_DIR$/vendor/firebase/php-jwt" />
@@ -175,9 +173,12 @@
<path value="$PROJECT_DIR$/vendor/hyperf/stringable" />
<path value="$PROJECT_DIR$/vendor/hyperf/support" />
<path value="$PROJECT_DIR$/vendor/ralouphie/getallheaders" />
<path value="$PROJECT_DIR$/vendor/cooper/hyperf-pest" />
<path value="$PROJECT_DIR$/vendor/psr/clock" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php83" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.0" />
<component name="PhpProjectSharedConfiguration" php_language_level="8.1" />
<component name="PhpStan">
<PhpStan_settings>
<PhpStanConfiguration tool_path="$PROJECT_DIR$/vendor/bin/phpstan" />

31
.idea/phpspec.xml generated Normal file
View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PHPSpec">
<suites>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
</suites>
</component>
</project>

View File

@@ -1,4 +1,132 @@
# 版本更新日志
## [1.0.0-alpha.12](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-alpha.11...v1.0.0-alpha.12) (2023-10-23)
### 👷 Continuous Integration | CI 配置
* **GiteaActions:** 不切换分支 ([4cc1473](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/4cc1473d386cf92bead68b59b123f34b25cc875b))
* **GiteaActions:** 使用密钥推送包 ([82d9a95](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/82d9a956915f2d66c5c531bab8cebb7e49e1e3fe))
* **GiteaActions:** 修复推送的组织名错误问题 ([635804e](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/635804e1176565e56e34b5ceb05225e7b4d5f318))
* **GiteaActions:** 修复错误的action 写法 ([9cdbd6a](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/9cdbd6a2c8859d20740df949bff208331887d3f6))
* **GiteaActions:** 修复镜像不包含 zip 的问题 ([895b028](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/895b0280174f96e00404bc3a0278bc318f0c119a))
* **GiteaActions:** 修复镜像不包含 zip 的问题 ([094589b](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/094589b87e52f716485b21bb737cecadcad33c12))
* **GiteaActions:** 修复镜像不包含 zip 的问题 ([85ae11e](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/85ae11e295326bbe39150cc7578cd47662b8de35))
* **GiteaActions:** 修复镜像不包含 zip 的问题 ([118f0b7](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/118f0b789f2932503af8e3e7810be805308f5429))
* **GiteaActions:** 修改触发条件 ([6cb24a8](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/6cb24a84b2dc23b3d5cc5e2682e81bc7a992140e))
* **GiteaActions:** 增加了 actions ([b32afe3](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/b32afe38b4b26660581f7ab91039ce64bff6eb60))
* **GiteaActions:** 安装 zip ([063c1d7](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/063c1d7ea190676d02d099fb9e3445982be3d4e8))
* **GiteaActions:** 尝试增加推送触发的 actions ([7dfb393](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/7dfb3933f600558f71ce295b23d950058ece5e73))
* **GiteaActions:** 现在只会根据 tag确定是否发布 ([418f4c4](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/418f4c47c9e027eb806e4321f3ec23eb04de8c0f))
## [1.0.0-alpha.11](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-alpha.10...v1.0.0-alpha.11) (2023-10-17)
### 👷 Continuous Integration | CI 配置
* **docker:** 兼容 ext-redis:6.0 ([f80da66](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/f80da661859333acff005241d2abcfd7c9f09c71))
## [1.0.0-alpha.10](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2023-10-16)
### 📦‍ Build System | 打包构建
* **composer:** 更新依赖 ([37d42c1](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/37d42c17cc8707b17f1dd0fd8e0df5b8f4048bd2))
* **script:** root 用户可以使用 composer ([12e9960](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/12e99604c99fee38aa82aa1fbc865201be09127f))
### ✨ Features | 新功能
* **rest:** 增加多表关联的兼容 ([17c0518](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/17c051868026981031abf3e88e86f7475ce06807))
## [1.0.0-alpha.9](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2023-10-13)
### 📦‍ Build System | 打包构建
* **composer:** 更新依赖 ([e9927fa](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/e9927fafb1630e759d3a55c0143b48db91ffdcae))
* **config:** 更新了默认的发件邮箱 ([359b13e](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/359b13e71803c87854ec6e54b119cb3bbd65ef3f))
## [1.0.0-alpha.8](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2023-10-08)
### ✨ Features | 新功能
* **email:** 增加了对邮件优先级的兼容 ([9f7d4ef](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/9f7d4effb7e39500d0f65d35788551cc4e7a91f1))
## [1.0.0-alpha.7](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-alpha.6...v1.0.0-alpha.7) (2023-09-28)
### 🐛 Bug Fixes | Bug 修复
* **rest:** 修复不存在的具名参数 ([1106794](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/110679448f310e1d4e25f370b74f2901ca9425d0))
## [1.0.0-alpha.6](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-alpha.5...v1.0.0-alpha.6) (2023-09-28)
### 🐛 Bug Fixes | Bug 修复
* **i18n:** 修复了无法正确无视大小写导致无法识别的问题 ([cff919a](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/cff919a21e6d50e396a0d5ceaeefbe3b7c0e3095))
* **rest:** 修复没有返回值的问题 ([2afc3ad](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/2afc3ad45b97e3df97827efdd9d16d6dedb3238a))
## [1.0.0-alpha.5](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-alpha.4...v1.0.0-alpha.5) (2023-09-26)
### 🐛 Bug Fixes | Bug 修复
* **i18n:** 修复了无法正确无视大小写导致无法识别的问题 ([7342015](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/73420153d3791bff38ddd57b5a17120a4ed3cd08))
## [1.0.0-alpha.4](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-alpha.3...v1.0.0-alpha.4) (2023-09-26)
### 📦‍ Build System | 打包构建
* **composer:** 引入 pest 并升级到 php8.1 ([dbbe278](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/dbbe278aa6c96634ed5792b5782825770c5cabe8))
### ✨ Features | 新功能
* **i18n:** 增加枚举值,更新中间件调用方式 ([4032d67](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/4032d67f1e56b8ce29fbfa5bd77ead2636a6ffd3))
### ✅ Tests | 测试
* **http:** 完成并通过了 http 请求的测试 ([7a209e8](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/7a209e876f8b4301b7bc78f05b68798eb65e77f7))
## [1.0.0-alpha.3](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-alpha.2...v1.0.0-alpha.3) (2023-08-30)
### ♻️ Code Refactoring | 代码重构
* **http:** 整理了 Http 请求服务 ([2d95fba](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/2d95fbae9e926788402c24266ab0d232732a7754))
## [1.0.0-alpha.2](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2023-07-21)
### 🐛 Bug Fixes | Bug 修复
* **controller:** 修复方法访问级别不足以继承的问题 ([b30c844](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/b30c84488b7f85447bd802df77c9decbf315ed85))
## [1.0.0-alpha.1](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v1.0.0-alpha.0...v1.0.0-alpha.1) (2023-07-21)
### 📦‍ Build System | 打包构建
* **composer:** 更新依赖 ([a8ec7d8](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/a8ec7d82556c2fb8fbe1e356eb6d1936401c810a))
* **release:** 增加 alpha 标识,准备正式版 ([f1948ab](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/f1948ab0fe4594140eede8e52f113963d98a8338))
## [1.0.0-alpha.0](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v0.2.23...v1.0.0-alpha.0) (2023-07-21)
### ✏️ Documentation | 文档
* **utils:** 移除了导致编辑器出错的注解 ([7ccf36b](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/7ccf36b398f86a31c7d8dde6ff24f0d9828cfb80))
### ✨ Features | 新功能
* **controller:** 增加了一个 Rest 风格的 trait ([68844a6](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/68844a6132059da89f69a34ba59229c40e5bcace))
* **trait:** 增加了分页响应的统一处理方法 ([fd788a7](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/commit/fd788a7eb804b7fe085346d817123c04c8bd0d01))
### [0.2.23](http://124.126.16.154:8888/singularity/HyperfDevelopmentKitCore/compare/v0.2.22...v0.2.23) (2023-07-07)

View File

@@ -1 +1 @@
0.2.23
1.0.0-alpha.12

View File

@@ -15,8 +15,8 @@
}
],
"require": {
"php": "^8.0",
"ext-redis": "^5.3",
"php": "^8.1",
"ext-redis": "^5.3|^6.0",
"ext-swoole": "*",
"composer/composer": ">=2.0",
"ergebnis/http-method": "^2.2",
@@ -41,6 +41,7 @@
},
"require-dev": {
"alibabacloud/dysmsapi-20170525": "^2.0",
"cooper/hyperf-pest": "^1.1",
"firebase/php-jwt": "^6.1",
"friendsofphp/php-cs-fixer": "^3.13",
"guzzlehttp/guzzle": "^7.5",
@@ -87,11 +88,28 @@
"Singularity\\HDK\\Test\\Core\\": "tests/"
}
},
"minimum-stability": "dev",
"minimum-stability": "alpha",
"archive": {
"exclude": [
".idea",
"tests",
"scripts",
"Dockerfile",
".gitignore",
".php-cs-fixer.*",
".phpunit.result.cache",
"phpstan.dist.neon",
"phpunit.xml"
]
},
"prefer-stable": true,
"scripts": {
"post-root-package-install": [],
"test": "vendor/bin/pest $1",
"test": [
"rm -rf runtime",
"Composer\\Config::disableProcessTimeout",
"co-pest --prepend tests/bootstrap.php -c phpunit.xml --colors=always $1"
],
"cs-fix": "vendor/bin/php-cs-fixer fix $1 --rules=@PSR12 --allow-risky=yes",
"analyse": "vendor/bin/phpstan analyse $1",
"ci": [
@@ -111,5 +129,5 @@
"url": "https://mirrors.aliyun.com/composer/"
}
},
"version": "0.2.23"
"version": "1.0.0-alpha.12"
}

19513
composer.lock generated

File diff suppressed because it is too large Load Diff

26
docs/Http 请求.md Normal file
View File

@@ -0,0 +1,26 @@
# Http 请求
## 1 组成
* 单例类
* \Singularity\HDK\Core\Http\RequestService
* 工厂类
* \Singularity\HDK\Core\Http\RequestServiceFactory
## 2 初始化服务
创建一个请求服务的方法有两种,效果是一致的:
* 工厂模式
* `\Singularity\HDK\Core\Http\RequestServiceFactory::make($options)`
* `\Singularity\HDK\Core\Http\RequestServiceFactory::make()->setOptions($options)`
* 单例模式
* `new \Singularity\HDK\Core\Http\RequestService($options)`
* `(new \Singularity\HDK\Core\Http\RequestService())->setOptions($options)`
这两个方法都回返回一个 `\Singularity\HDK\Core\Http\RequestService` 实例
## 3 规范
每个通过本包提供的 Http 请求服务创建的服务,都应该在构建方法中实例化一个 RequestService 服务,
之后该服务中使用的所有请求都基于该服务,这样可以避免共用单例模式导致的 options 污染

12
docs/REST 控制器.md Normal file
View File

@@ -0,0 +1,12 @@
# REST 资源控制器支持
## 列表的筛选、排序
* [**RestfulList**](../src/Traits/RestfulList.php)
### RestfulList
在 AbstractController 中已经默认进行了集成
- parseParameters 用来解析请求
- responseFormatter 用来将 builder 转化成响应
- restSelect 额外的语法糖,调用了上面的两个方法

View File

@@ -62,8 +62,8 @@ return [
// 第三方服务
'third_party' => [
'email' => [
'dsn' => 'smtp://account@luxcreo.ai:Qfsd8866@smtp.qiye.aliyun.com:465',
'mailer_sender' => 'account@luxcreo.ai', // 发件邮箱
'dsn' => 'smtp://noreply@luxcreo.ai:Qfsd8866@smtp.qiye.aliyun.com:465',
'mailer_sender' => 'noreply@luxcreo.ai', // 发件邮箱
'mailer_sender_name' => 'LuxCreo', // 发件人名称
],
'sms' => [

View File

@@ -2,9 +2,9 @@
docker run \
--pull always \
-ti --rm --name "hyperf-development-kit" \
-ti --rm --name "hdk-core" \
-w "/srv/www" \
-v "$(pwd)":/srv/www \
-v ~/.ssh:/root/.ssh \
-v ~/.gitconfig:/root/.gitconfig \
harbor.luxcreo.cn/library/hyperf:8.0-swoole /bin/ash
harbor.luxcreo.cn/library/hyperf:8.1-swoole /bin/ash

View File

@@ -2,4 +2,4 @@
docker run --rm -it \
-v $(pwd):/app -e "GIT_AUTHOR_NAME=$(git config user.name)" -e "EMAIL=$(git config user.email)" \
detouched/standard-version:latest $1
detouched/standard-version:latest -p=alpha $1

View File

@@ -21,8 +21,8 @@ use Dont\DontToString;
use Hyperf\Contract\ContainerInterface;
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use Singularity\HDK\Core\Traits\RestfulList;
/**
* 抽象控制器基类
@@ -42,13 +42,11 @@ abstract class AbstractController
use DontSerialise;
use DontDeserialise;
use DontToString;
use RestfulList;
#[Inject]
protected ContainerInterface $container;
#[Inject]
protected RequestInterface $request;
#[Inject]
protected ResponseInterface $response;

View File

@@ -9,6 +9,8 @@
namespace Singularity\HDK\Core\Events;
use Symfony\Component\Mime\Email;
/**
* Singularity\HDK\Core\Events\EmailWillSent@HDK-Core
*
@@ -44,7 +46,13 @@ class EmailWillSent
/**
* @var 'text'|'html' $type
*/
public string $type = 'text'
public string $type = 'text',
/**
* @var int
* @see Email::priority()
*/
public int $priority = Email::PRIORITY_NORMAL
) {
}
}

191
src/Http/RequestService.php Normal file
View File

@@ -0,0 +1,191 @@
<?php
declare(strict_types=1);
namespace Singularity\HDK\Core\Http;
use Ergebnis\Http\Method;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Utils;
use Hyperf\Codec\Json;
use Hyperf\Guzzle\ClientFactory;
use Psr\Http\Message\ResponseInterface;
use Singularity\HDK\Core\Service\AbstractSingleton;
/**
* Singularity\HDK\Core\Service\Http\RequestService@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2023/8/30
*
* @template Options of array<literal-string, mixed>
*/
final class RequestService extends AbstractSingleton
{
// public const TIMEOUT = 20;
private ClientFactory $client;
/**
* @var Options
*/
private array $options = [];
/**
* @param Options $options
*/
public function __construct(array $options = [])
{
$this->setOptions($options);
/** @var ClientFactory $client */
$client = \Hyperf\Support\make(ClientFactory::class);
$this->client = $client;
}
/**
* 定制 options
* @param Options $options
* @return $this
*/
public function setOptions(array $options): self
{
$this->options = array_replace_recursive($this->options, $options);
return $this;
}
/**
* @param string $url
* @param array<string, string|int> $params
* @param array $data
* @param Options $options
* @return ResponseInterface
* @throws GuzzleException
*/
public function requestGet(
string $url,
array $params = [],
array $data = [],
array $options = []
): ResponseInterface {
$request = new Request(
method: Method\Rfc\Rfc7231::GET, uri: $url
);
return $this->getClient($options)->send($request, ['query' => $params, 'json' => $data,]);
}
/**
* 工厂模式初始化请求
* @param Options $options
* @return Client
*/
private function getClient(array $options): Client
{
$options = array_replace_recursive($this->options, $options);
return $this->client->create($options);
}
/**
* @param string $url
* @param array<string, string|int> $params
* @param array<string, mixed> $data
* @param Options $options
* @return ResponseInterface
* @throws GuzzleException
*/
public function requestPost(
string $url,
array $params = [],
array $data = [],
array $options = []
): ResponseInterface {
$data = Json::encode($data);
$request = new Request(
method: Method\Rfc\Rfc7231::POST,
uri: $url,
headers: ['Content-Type' => 'application/json'],
body: Utils::streamFor($data),
);
return $this->getClient($options)->send($request, ['query' => $params,]);
}
/**
* @param string $url
* @param array<string, mixed> $data
* @param array<string, string|int> $params
* @param Options $options
* @return ResponseInterface
* @throws GuzzleException
*/
public function requestPut(
string $url,
array $params = [],
array $data = [],
array $options = []
): ResponseInterface {
$data = Json::encode($data);
$request = new Request(
method: Method\Rfc\Rfc7231::PUT,
uri: $url,
headers: ['Content-Type' => 'application/json'],
body: Utils::streamFor($data)
);
return $this->getClient($options)->send(
$request, ['query' => $params,]
);
}
/**
* @param string $url
* @param array<string, mixed> $data
* @param array<string, string|int> $params
* @param Options $options
* @return ResponseInterface
* @throws GuzzleException
*/
public function requestPatch(
string $url,
array $params = [],
array $data = [],
array $options = []
): ResponseInterface {
$data = Json::encode($data);
$request = new Request(
method: Method\Rfc\Rfc5789::PATCH,
uri: $url,
headers: ['Content-Type' => 'application/json'],
body: Utils::streamFor($data)
);
return $this->getClient($options)->send(
$request, ['query' => $params,]
);
}
/**
* @param string $url
* @param array<string, mixed> $data
* @param array<string, string|int> $params
* @param Options $options
* @return ResponseInterface
* @throws GuzzleException
*/
public function requestDelete(
string $url,
array $params = [],
array $data = [],
array $options = []
): ResponseInterface {
$data = Json::encode($data);
$request = new Request(
method: Method\Rfc\Rfc7231::DELETE,
uri: $url,
headers: ['Content-Type' => 'application/json'],
body: Utils::streamFor($data)
);
return $this->getClient($options)->send(
$request, ['query' => $params,]
);
}
}

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
/**
* RequestFactory.php@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2023/8/30
*/
namespace Singularity\HDK\Core\Http;
use Singularity\HDK\Core\Service\AbstractFactory;
final class RequestServiceFactory extends AbstractFactory
{
public static function make(array $options = []): RequestService
{
return new RequestService($options);
}
}

View File

@@ -0,0 +1,28 @@
<?php
/**
* Languages.php@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2023/9/26
*/
namespace Singularity\HDK\Core\I18n\Enum;
use function Hyperf\Config\config;
enum Languages: string
{
case ZH_CN = 'zh_CN';
case EN = 'en';
public static function getLanguage(string $language): Languages
{
return match (mb_strtolower($language)) {
'en', 'en_us', 'en-us', 'en-uk', 'en_uk' => self::EN,
'zh', 'zh_cn', 'zh-cn' => self::ZH_CN,
default => self::from(config('translation.locale')),
};
}
}

View File

@@ -62,18 +62,21 @@ class EmailWillSentListener implements ListenerInterface
target: $event->target,
subject: $event->subject,
html: $event->content,
cc: $event->cc
cc: $event->cc,
priority: $event->priority
)
: $emailService->sendText(
target: $event->target,
subject: $event->subject,
text: $event->content,
cc: $event->cc
cc: $event->cc,
priority: $event->priority
);
$stdoutLogger->info('邮件发送成功!');
$stdoutLogger->info("To: $event->target");
$stdoutLogger->info("Subject: $event->subject");
$stdoutLogger->info("Priority: $event->priority");
$stdoutLogger->debug('Content: ');
$stdoutLogger->debug($event->content);
} catch (TransportExceptionInterface $e) {

View File

@@ -12,10 +12,9 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Singularity\HDK\Core\I18n\Enum\Languages;
use Symfony\Component\HttpFoundation\Request;
use function Hyperf\Config\config;
/**
* Singularity\HDK\Utils\Middleware\InternationalizationMiddleware@HDK
*
@@ -41,12 +40,8 @@ class InternationalizationMiddleware implements MiddlewareInterface
$language = $req->getPreferredLanguage();
if (!empty($language)) {
$language = match (strtolower($language)) {
'en', 'en_us', 'en-us', 'en-uk', 'en_uk' => 'en',
'zh', 'zh_cn', 'zh-cn' => 'zh_CN',
default => config('translation.locale'),
};
$this->translator->setLocale($language);
$language = Languages::getLanguage($language);
$this->translator->setLocale($language->value);
}
$response = Context::get(ResponseInterface::class);
$response = $response->withAddedHeader(

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
/**
* AbstractFactory.php@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2023/8/30
*/
namespace Singularity\HDK\Core\Service;
use Dont\DontCall;
use Dont\DontInstantiate;
/**
* Singularity\HDK\Core\Service\AbstractFactory@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2023/8/30
*/
abstract class AbstractFactory
{
use DontInstantiate;
use DontCall;
abstract static function make();
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* SingletonInterface.php@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2023/8/30
*/
namespace Singularity\HDK\Core\Service;
use Dont\DontCallStatic;
use Dont\DontClone;
/**
* Singularity\HDK\Core\Service\SingletonInterface@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2023/8/30
*/
abstract class AbstractSingleton
{
use DontCallStatic;
use DontClone;
}

View File

@@ -79,12 +79,14 @@ class EmailService
string|array $target,
string $subject,
string $text,
array $cc = []
array $cc = [],
int $priority = Email::PRIORITY_NORMAL
): bool {
$email = (new Email())
->from(Address::create($this->from))
->to(...(is_array($target) ? $target : [$target]))
->cc(...$cc)
->priority($priority)
->subject($subject)
->text($text);
@@ -100,7 +102,7 @@ class EmailService
* @param string $subject
* @param string $html
* @param array<string> $cc
*
* @param int $priority
* @return bool
* @throws TransportExceptionInterface
*/
@@ -108,12 +110,14 @@ class EmailService
string|array $target,
string $subject,
string $html,
array $cc = []
array $cc = [],
int $priority = Email::PRIORITY_NORMAL
): bool {
$email = (new Email())
->from(Address::create($this->from))
->to(...(is_array($target) ? $target : [$target]))
->cc(...$cc)
->priority($priority)
->subject($subject)
->html($html);

View File

@@ -16,6 +16,7 @@ use Psr\Http\Message\ResponseInterface;
/**
* 发起 Http 请求的类
* @deprecated since version 1.0-alpha.3, to be removed in 1.0
*/
class HttpRequestService
{

View File

@@ -8,7 +8,6 @@ use Closure;
use Exception;
use Generator;
use Hyperf\HttpServer\Contract\RequestInterface;
use JetBrains\PhpStorm\NoReturn;
use JetBrains\PhpStorm\Pure;
use Psr\Http\Message\ResponseInterface;
@@ -236,7 +235,6 @@ class UtilsService
*
* @return void
*/
#[NoReturn]
public function unlimitedSubCategoriesQuicklyWithLevel(
array &$list,
int $level = 1,

View File

@@ -0,0 +1,81 @@
<?php
/**
* Paginatable.php@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2023/7/18
*/
namespace Singularity\HDK\Core\Traits;
use Closure;
use Hyperf\Contract\LengthAwarePaginatorInterface;
use Hyperf\Database\Model\Builder;
use Hyperf\Database\Model\Relations\Relation;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\Stringable\Str;
use Singularity\HDK\Core\Service\ExtendService;
trait RestfulList
{
#[Inject]
protected ExtendService $extend;
#[Inject]
protected RequestInterface $request;
protected function restSelect(Closure $callback, ?Closure $filter = null)
{
$parsed_options = [];
$result = $this->parseParameters(
callback: function ($query, $options) use ($callback, &$parsed_options) {
$parsed_options = $options;
return $callback($query, $options);
}
);
return $this->responseFormatter($parsed_options, $result, $filter);
}
protected function parseParameters(Closure $callback): mixed
{
$query = $this->request->getQueryParams();
$options = [
'size' => $this->request->query('size'),
'page' => $this->request->query('page'),
'order' => $this->request->query('order', 'created_at'),
'sort' => $this->request->query('sort', 'desc'),
'group' => $this->request->query('group'),
'extends' => $this->extend->getExtends(),
];
unset($query['sort'], $query['page'], $query['size'], $query['order'], $query['group'], $query['extends']);
return $callback(query: $query, options: $options);
}
protected function responseFormatter(
array $options,
Builder|Relation $builder,
?Closure $filter = null
) {
$perPage = $options['size'] ?? null;
$order = $options['order'] ?? 'created_at';
$sort = $options['sort'] ?? 'desc';
$pagination = !!($options['page'] ?? $perPage ?? false);
// $group = $options['group'] ?? null;
$builder = $builder->orderBy(Str::snake($order), $sort);
$result = $pagination ? $builder->paginate($perPage) : $builder->get();
if (is_null($filter)) {
return $result;
}
if ($result instanceof LengthAwarePaginatorInterface) {
$collection = $result->getCollection();
$collection = $filter($collection);
return $result->setCollection($collection);
}
return $filter($result);
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* RequestServiceTest.php@Core
*
* @author 李东云 <Dongyun.Li@LuxCreo.Ai>
* Powered by PhpStorm
* Created on 2023/9/20
*/
namespace Singularity\HDK\Test\Core\Unit;
use Singularity\HDK\Core\Http\RequestService;
use Singularity\HDK\Core\Http\RequestServiceFactory;
class RequestServiceTest
{
private RequestService $service;
public function __construct()
{
$this->service = RequestServiceFactory::make();
}
public function getInstance(): RequestService
{
return $this->service;
}
}
test('Http 请求服务可以正常使用', function () {
/** @var RequestServiceTest $class */
$class = \Hyperf\Support\make(RequestServiceTest::class);
$response = $class->getInstance()->requestGet('http://baidu.com/');
$content = $response->getBody()->getContents();
expect($content)->toBe(<<<HTML
<html>
<meta http-equiv="refresh" content="0;url=http://www.baidu.com/">
</html>
HTML);
});

View File

@@ -9,8 +9,29 @@ declare(strict_types=1);
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\Context\ApplicationContext;
use Hyperf\Di\Container;
use Hyperf\Di\Definition\DefinitionSource;
use Psr\Container\ContainerInterface;
ini_set('display_errors', 'on');
ini_set('display_startup_errors', 'on');
error_reporting(E_ALL);
date_default_timezone_set('Asia/Shanghai');
!defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));
!defined('SWOOLE_HOOK_FLAGS') && define('SWOOLE_HOOK_FLAGS', SWOOLE_HOOK_ALL);
Swoole\Runtime::enableCoroutine(true);
require BASE_PATH . '/vendor/autoload.php';
Hyperf\Di\ClassLoader::init();
$container = new Container(new DefinitionSource([]));
if (!$container instanceof ContainerInterface) {
throw new RuntimeException('The dependency injection container is invalid.');
}
$container = ApplicationContext::setContainer($container);