LiuJ 2 일 전
부모
커밋
debe55d2a5
73개의 변경된 파일2252개의 추가작업 그리고 535개의 파일을 삭제
  1. 52 0
      .devcontainer/Dockerfile
  2. 7 0
      .devcontainer/devcontainer.json
  3. 5 0
      .dockerignore
  4. 2 2
      .github/workflows/Dockerfile
  5. 3 0
      .gitignore
  6. 19 4
      .php-cs-fixer.php
  7. 8 7
      .phpstorm.meta.php
  8. 2 2
      Dockerfile
  9. 21 0
      LICENSE
  10. 39 12
      README.md
  11. 2 3
      app/Constants/ErrorCode.php
  12. 7 15
      app/Controller/AbstractController.php
  13. 1 0
      app/Controller/IndexController.php
  14. 1 0
      app/Exception/BusinessException.php
  15. 2 7
      app/Exception/Handler/AppExceptionHandler.php
  16. 721 3
      app/JsonRpc/ClientService.php
  17. 1 4
      app/JsonRpc/ClientServiceInterface.php
  18. 13 8
      app/Listener/DbQueryExecutedListener.php
  19. 35 0
      app/Listener/ResumeExitCoordinatorListener.php
  20. 27 0
      app/Model/Article.php
  21. 27 0
      app/Model/ArticleData.php
  22. 27 0
      app/Model/ArticleSurvey.php
  23. 27 0
      app/Model/Book.php
  24. 27 0
      app/Model/Category.php
  25. 27 0
      app/Model/ChatGroups.php
  26. 27 0
      app/Model/ChatGroupsMember.php
  27. 27 0
      app/Model/ChatRecords.php
  28. 31 0
      app/Model/Complaint.php
  29. 27 0
      app/Model/District.php
  30. 29 0
      app/Model/Good.php
  31. 27 0
      app/Model/JobApply.php
  32. 27 0
      app/Model/JobCompany.php
  33. 27 0
      app/Model/JobEnum.php
  34. 27 0
      app/Model/JobHunting.php
  35. 27 0
      app/Model/JobIndustry.php
  36. 27 0
      app/Model/JobNature.php
  37. 27 0
      app/Model/JobPosition.php
  38. 27 0
      app/Model/JobRecruiting.php
  39. 28 0
      app/Model/JobRemuse.php
  40. 27 0
      app/Model/Link.php
  41. 1 0
      app/Model/Model copy.php
  42. 27 0
      app/Model/Notice.php
  43. 29 0
      app/Model/User.php
  44. 27 0
      app/Model/UserInfo.php
  45. 27 0
      app/Model/Web.php
  46. 27 0
      app/Model/Website.php
  47. 32 0
      app/Model/WebsiteCategory.php
  48. 27 0
      app/Model/WebsiteColumn.php
  49. 27 0
      app/Model/WebsiteGroup.php
  50. 27 0
      app/Model/WebsiteRole.php
  51. 27 0
      app/Model/WebsiteRoleUser.php
  52. 27 0
      app/Model/jobResume.php
  53. 2 1
      bin/hyperf.php
  54. 29 28
      composer.json
  55. 274 394
      composer.lock
  56. 2 1
      config/autoload/cache.php
  57. 15 3
      config/autoload/databases.php
  58. 0 1
      config/autoload/dependencies.php
  59. 2 0
      config/autoload/listeners.php
  60. 0 16
      config/autoload/logger.php
  61. 1 1
      config/autoload/middlewares.php
  62. 7 4
      config/autoload/opentracing.php
  63. 29 0
      config/autoload/redis.php
  64. 4 4
      config/autoload/server.php
  65. 4 1
      config/config.php
  66. 2 5
      config/container.php
  67. 2 2
      deploy.test.yml
  68. 18 0
      docker-compose.yml
  69. 14 0
      phpstan.neon.dist
  70. 16 0
      phpunit.xml.dist
  71. 4 4
      test/Cases/ExampleTest.php
  72. 3 0
      test/HttpTestCase.php
  73. 4 3
      test/bootstrap.php

+ 52 - 0
.devcontainer/Dockerfile

@@ -0,0 +1,52 @@
+# Dev Container Dockerfile
+#
+# @link     https://www.hyperf.io
+# @document https://hyperf.wiki
+# @contact  group@hyperf.io
+# @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
+
+FROM hyperf/hyperf:8.3-alpine-v3.19-swoole
+LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"
+
+##
+# ---------- env settings ----------
+##
+# --build-arg timezone=Asia/Shanghai
+ARG timezone
+
+ENV TIMEZONE=${timezone:-"Asia/Shanghai"} \
+    APP_ENV=dev \
+    SCAN_CACHEABLE=(false)
+
+# update
+RUN set -ex \
+    # show php version and extensions
+    && php -v \
+    && php -m \
+    && php --ri swoole \
+    #  ---------- some config ----------
+    && cd /etc/php* \
+    # - config PHP
+    && { \
+        echo "upload_max_filesize=128M"; \
+        echo "post_max_size=128M"; \
+        echo "memory_limit=1G"; \
+        echo "date.timezone=${TIMEZONE}"; \
+    } | tee conf.d/99_overrides.ini \
+    # - config timezone
+    && ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
+    && echo "${TIMEZONE}" > /etc/timezone \
+    # ---------- clear works ----------
+    && rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
+    && echo -e "\033[42;37m Build Completed :).\033[0m\n"
+
+WORKDIR /opt/www
+
+# Composer Cache
+# COPY ./composer.* /opt/www/
+# RUN composer install --no-dev --no-scripts
+
+COPY . /opt/www
+RUN composer install && php bin/hyperf.php
+
+EXPOSE 9501

+ 7 - 0
.devcontainer/devcontainer.json

@@ -0,0 +1,7 @@
+{
+    "build": {
+        "context": "..",
+        "dockerfile": "./Dockerfile"
+    },
+    "forwardPorts": [9501]
+}

+ 5 - 0
.dockerignore

@@ -0,0 +1,5 @@
+**
+!app/
+!bin/
+!config/
+!composer.*

+ 2 - 2
.github/workflows/Dockerfile

@@ -5,7 +5,7 @@
 # @contact  group@hyperf.io
 # @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 
-FROM hyperf/hyperf:8.0-alpine-v3.12-swoole
+FROM hyperf/hyperf:8.3-alpine-v3.19-swoole
 LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"
 
 ##
@@ -25,7 +25,7 @@ RUN set -ex \
     && php -m \
     && php --ri swoole \
     #  ---------- some config ----------
-    && cd /etc/php8 \
+    && cd /etc/php* \
     # - config PHP
     && { \
         echo "upload_max_filesize=128M"; \

+ 3 - 0
.gitignore

@@ -11,3 +11,6 @@ vendor/
 .DS_Store
 .phpunit*
 *.cache
+.vscode/
+/phpstan.neon
+/phpunit.xml

+ 19 - 4
.php-cs-fixer.php

@@ -1,5 +1,14 @@
 <?php
 
+declare(strict_types=1);
+/**
+ * This file is part of Hyperf.
+ *
+ * @link     https://www.hyperf.io
+ * @document https://hyperf.wiki
+ * @contact  group@hyperf.io
+ * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
+ */
 $header = <<<'EOF'
 This file is part of Hyperf.
 
@@ -23,13 +32,18 @@ return (new PhpCsFixer\Config())
             'location' => 'after_declare_strict',
         ],
         'array_syntax' => [
-            'syntax' => 'short'
+            'syntax' => 'short',
         ],
         'list_syntax' => [
-            'syntax' => 'short'
+            'syntax' => 'short',
         ],
         'concat_space' => [
-            'spacing' => 'one'
+            'spacing' => 'one',
+        ],
+        'global_namespace_import' => [
+            'import_classes' => true,
+            'import_constants' => true,
+            'import_functions' => null,
         ],
         'blank_line_before_statement' => [
             'statements' => [
@@ -38,7 +52,7 @@ return (new PhpCsFixer\Config())
         ],
         'general_phpdoc_annotation_remove' => [
             'annotations' => [
-                'author'
+                'author',
             ],
         ],
         'ordered_imports' => [
@@ -80,6 +94,7 @@ return (new PhpCsFixer\Config())
         'single_quote' => true,
         'standardize_not_equals' => true,
         'multiline_comment_opening_closing' => true,
+        'single_line_empty_body' => false,
     ])
     ->setFinder(
         PhpCsFixer\Finder::create()

+ 8 - 7
.phpstorm.meta.php

@@ -1,11 +1,12 @@
 <?php
 
 namespace PHPSTORM_META {
-
     // Reflect
-    override(\Psr\Container\ContainerInterface::get(0), map('@'));
-    override(\Hyperf\Utils\Context::get(0), map('@'));
-    override(\make(0), map('@'));
-    override(\di(0), map('@'));
-
-}
+    override(\Psr\Container\ContainerInterface::get(0), map(['' => '@']));
+    override(\Hyperf\Context\Context::get(0), map(['' => '@']));
+    override(\make(0), map(['' => '@']));
+    override(\di(0), map(['' => '@']));
+    override(\Hyperf\Support\make(0), map(['' => '@']));
+    override(\Hyperf\Support\optional(0), type(0));
+    override(\Hyperf\Tappable\tap(0), type(0));
+}

+ 2 - 2
Dockerfile

@@ -5,7 +5,7 @@
 # @contact  group@hyperf.io
 # @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 
-FROM hyperf/hyperf:8.0-alpine-v3.12-swoole
+FROM hyperf/hyperf:8.3-alpine-v3.19-swoole
 LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"
 
 ##
@@ -25,7 +25,7 @@ RUN set -ex \
     && php -m \
     && php --ri swoole \
     #  ---------- some config ----------
-    && cd /etc/php8 \
+    && cd /etc/php* \
     # - config PHP
     && { \
         echo "upload_max_filesize=128M"; \

+ 21 - 0
LICENSE

@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Hyperf
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 39 - 12
README.md

@@ -10,27 +10,54 @@ The various versions of Dockerfile have been prepared for you in the [hyperf/hyp
 
 When you don't want to use Docker as the basis for your running environment, you need to make sure that your operating environment meets the following requirements:  
 
- - PHP >= 7.3
- - Swoole PHP extension >= 4.5,and Disabled `Short Name`
- - OpenSSL PHP extension
+ - PHP >= 8.1
+ - Any of the following network engines
+   - Swoole PHP extension >= 5.0,with `swoole.use_shortname` set to `Off` in your `php.ini`
+   - Swow PHP extension >= 1.3
  - JSON PHP extension
- - PDO PHP extension (If you need to use MySQL Client)
- - Redis PHP extension (If you need to use Redis Client)
- - Protobuf PHP extension (If you need to use gRPC Server of Client)
+ - Pcntl PHP extension
+ - OpenSSL PHP extension (If you need to use the HTTPS)
+ - PDO PHP extension (If you need to use the MySQL Client)
+ - Redis PHP extension (If you need to use the Redis Client)
+ - Protobuf PHP extension (If you need to use the gRPC Server or Client)
 
 # Installation using Composer
 
-The easiest way to create a new Hyperf project is to use Composer. If you don't have it already installed, then please install as per the documentation.
+The easiest way to create a new Hyperf project is to use [Composer](https://getcomposer.org/). If you don't have it already installed, then please install as per [the documentation](https://getcomposer.org/download/).
 
 To create your new Hyperf project:
 
-$ composer create-project hyperf/hyperf-skeleton path/to/install
+```bash
+composer create-project hyperf/hyperf-skeleton path/to/install
+```
+
+If your development environment is based on Docker you can use the official Composer image to create a new Hyperf project:
+
+```bash
+docker run --rm -it -v $(pwd):/app composer create-project --ignore-platform-reqs hyperf/hyperf-skeleton path/to/install
+```
+
+# Getting started
 
 Once installed, you can run the server immediately using the command below.
 
-$ cd path/to/install
-$ php bin/hyperf.php start
+```bash
+cd path/to/install
+php bin/hyperf.php start
+```
+
+Or if in a Docker based environment you can use the `docker-compose.yml` provided by the template:
+
+```bash
+cd path/to/install
+docker-compose up
+```
+
+This will start the cli-server on port `9501`, and bind it to all network interfaces. You can then visit the site at `http://localhost:9501/` which will bring up Hyperf default home page.
+
+## Hints
 
-This will start the cli-server on port `9501`, and bind it to all network interfaces. You can then visit the site at `http://localhost:9501/`
+- A nice tip is to rename `hyperf-skeleton` of files like `composer.json` and `docker-compose.yml` to your actual project name.
+- Take a look at `config/routes.php` and `app/Controller/IndexController.php` to see an example of a HTTP entrypoint.
 
-which will bring up Hyperf default home page.
+**Remember:** you can always replace the contents of this README.md file to something that fits your project description.

+ 2 - 3
app/Constants/ErrorCode.php

@@ -9,14 +9,13 @@ declare(strict_types=1);
  * @contact  group@hyperf.io
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
+
 namespace App\Constants;
 
 use Hyperf\Constants\AbstractConstants;
 use Hyperf\Constants\Annotation\Constants;
 
-/**
- * @Constants
- */
+#[Constants]
 class ErrorCode extends AbstractConstants
 {
     /**

+ 7 - 15
app/Controller/AbstractController.php

@@ -9,6 +9,7 @@ declare(strict_types=1);
  * @contact  group@hyperf.io
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
+
 namespace App\Controller;
 
 use Hyperf\Di\Annotation\Inject;
@@ -18,21 +19,12 @@ use Psr\Container\ContainerInterface;
 
 abstract class AbstractController
 {
-    /**
-     * @Inject
-     * @var ContainerInterface
-     */
-    protected $container;
+    #[Inject]
+    protected ContainerInterface $container;
 
-    /**
-     * @Inject
-     * @var RequestInterface
-     */
-    protected $request;
+    #[Inject]
+    protected RequestInterface $request;
 
-    /**
-     * @Inject
-     * @var ResponseInterface
-     */
-    protected $response;
+    #[Inject]
+    protected ResponseInterface $response;
 }

+ 1 - 0
app/Controller/IndexController.php

@@ -9,6 +9,7 @@ declare(strict_types=1);
  * @contact  group@hyperf.io
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
+
 namespace App\Controller;
 
 class IndexController extends AbstractController

+ 1 - 0
app/Exception/BusinessException.php

@@ -9,6 +9,7 @@ declare(strict_types=1);
  * @contact  group@hyperf.io
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
+
 namespace App\Exception;
 
 use App\Constants\ErrorCode;

+ 2 - 7
app/Exception/Handler/AppExceptionHandler.php

@@ -9,6 +9,7 @@ declare(strict_types=1);
  * @contact  group@hyperf.io
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
+
 namespace App\Exception\Handler;
 
 use Hyperf\Contract\StdoutLoggerInterface;
@@ -19,14 +20,8 @@ use Throwable;
 
 class AppExceptionHandler extends ExceptionHandler
 {
-    /**
-     * @var StdoutLoggerInterface
-     */
-    protected $logger;
-
-    public function __construct(StdoutLoggerInterface $logger)
+    public function __construct(protected StdoutLoggerInterface $logger)
     {
-        $this->logger = $logger;
     }
 
     public function handle(Throwable $throwable, ResponseInterface $response)

+ 721 - 3
app/JsonRpc/ClientService.php

@@ -5,10 +5,23 @@ namespace App\JsonRpc;
 use Hyperf\RpcServer\Annotation\RpcService;
 use App\Tools\Result;
 use Hyperf\DbConnection\Db;
+//mocle
+use App\Model\Complaint;
+use App\Model\JobEnum;
+use App\Model\User;
+use App\Model\webisitecategory;
+use Hyperf\Coroutine\Coroutine;
+use Hyperf\Redis\Redis;
+use Hyperf\Di\Annotation\Inject;
+
 
 #[RpcService(name: "ClientService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
+
 class ClientService implements ClientServiceInterface
 {
+
+    #[Inject]
+    protected Redis $redis;
     /**
      * @param array $data
      *  @return array
@@ -16,7 +29,7 @@ class ClientService implements ClientServiceInterface
     public function test(array $data): array
     {
 
-        var_dump($data, '---------------');
+        var_dump($data, '-------1--------');
         $time = date('Y-m-d H:i:s', time());
         $data = [
             'code' => 200,
@@ -29,8 +42,713 @@ class ClientService implements ClientServiceInterface
         //mysql直接查询连接数
         $activeConnections = Db::select("SHOW STATUS LIKE 'Threads_connected'");
         // $activeConnectionsCount = $activeConnections[0]->Value ?? 0;
-        $users = Db::select('SELECT * FROM article;');
+        // $users = Db::select('SELECT * FROM article;');
         return ['code' => 200, 'msg' => 'success', 'data' => $activeConnections];
     }
-    //test git
+
+    public function indexData(array $data): array
+    {
+        $time1 = microtime(true);
+        $data = json_decode($data['template'], true);
+        $wetbsite_id = $data['base']['website_id'] ?? 2;
+        //设置缓存
+        $websiteInfoCacheKey = "awebsite:category:{$wetbsite_id}";
+        $websiteInfo =  $this->redis->get($websiteInfoCacheKey);  //false; 
+        if ($websiteInfo === false) {
+            // Redis 中没有缓存,从数据库中查询
+            $websiteInfo = Db::table('website_category')->where('website_id', $wetbsite_id)->get()->toArray();
+            // 将查询结果存入 Redis,设置缓存时间为 3600 秒(1 小时)
+            $this->redis->setex($websiteInfoCacheKey, 3600,  json_encode($websiteInfo));
+        } else {
+            // 从 Redis 中获取的数据需要反序列化
+            $websiteInfo = json_decode($websiteInfo, true);
+        }
+        $websiteInfo = Db::table('website_category')->where('website_id', $wetbsite_id)->get()->toArray();
+        //取出website
+        var_dump($websiteInfo, 'websiteInfo');
+        //取出category_id 对应的数据
+        $websiteInfoIndexed = array_column($websiteInfo, null, 'category_id');
+        // 取出category_id 对应的aLIas_pinyin 
+        $categoryIds = array_column($websiteInfo, 'category_id');
+        $aliasPinyins = array_column($websiteInfo, 'aLIas_pinyin');
+        $cat_arr = array_combine($categoryIds, $aliasPinyins);
+        // var_dump($cat_arr, 'cat_arr');
+        //根据 category_arr_id 组合出 aLIas_pinyin
+        $catiall = [];
+        //一级所有子级的记录
+        $cat_1st_arr = [];
+        foreach ($websiteInfo as $key => $value) {
+            //算出路由拼音
+            $category_arr_id = json_decode($value->category_arr_id);
+            $pinyin_str = '';
+            foreach ($category_arr_id as $k => $v) {
+                $pinyin_str .= $cat_arr[$v] . '/';
+            }
+            $pinyin_str = rtrim($pinyin_str, '/');
+            $catiall[$value->category_id][] = $pinyin_str;
+            // $cat_id = $value->category_id;
+            $websiteInfoIndexed[$value->category_id]->pinyin = $pinyin_str;
+            // 算出一级  并且算出子级
+            if ($value->pid == 0) {
+                $cat_1st_arr[$value->category_id] = [];
+            } else {
+                $cat_1st_arr[$value->pid][] = $value->category_id;
+            }
+        }
+        $time2 = microtime(true);
+        $time_ = ($time2 - $time1);
+        var_dump($time2, $time1, $time_, '返回路由需要多少时间');
+
+        //获取
+        $getpage = $data['base']['getpage'] ?? 'index';
+
+
+        // index = 首页
+        // class = 频道页
+        // list = 列表页
+        // article = 详情页
+        // search = 搜索页
+        // aboutList = 底部导航列表页
+        // aboutArticle = 底部导航详情页
+        // return $cat_1st_arr;
+        // return $cat_1st_arr;
+        // var_dump($cat_1st_arr, 'cat_1st_arr');//一级所有子级的记录
+        // var_dump($catiall, 'catiall');//拼音
+        $templateData = [];
+        switch ($getpage) {
+
+            case 'index':
+                $componetList = $data['template']['index'][0]['componentList'];
+                //计算一级的所有子级;组成一个数据,key是一级的category_id,value是所有的子级数据,加上个二级的pinyin属性,放的是catiall的数据
+                foreach ($componetList as $key => $value) {
+                    //取出componentData
+                    $componentData = $value['componentData'];
+                    // $page = $componentData['page'];
+                    // $pageSize = $componentData['pageSize'];
+                    $listType = $componentData['listType'];
+
+                    $category_id = $componentData['category_id'];
+                    $imgSize = $componentData['imgSize'];
+                    $textSize = $componentData['textSize'];
+                    $level = $componentData['level'];
+                    $child = $componentData['child'];
+                    //获取子级
+                    if ($child) {
+                    }
+                    $child_id = $child['id'];
+                    $child_imgSize = $child['imgSize'];
+                    $child_textSize = $child['textSize'];
+
+                    // 拼音就是路由----
+                    unset($listType['pinyin']);
+                    //查询查询数据,返回到data字段里,根据这几个
+                    if ($category_id > 0) {
+                        // 第一次查询:imgurl 不为空的数据
+                        $imgArticles = Db::table('article')
+                            // ->whereIn('catid', [$category_id])
+                            ->whereIn('catid', $temp_arr = array_merge([$category_id], $cat_1st_arr[$category_id]))
+                            ->where('status', 1)
+                            ->whereNotNull('imgurl')
+                            ->limit($imgSize)
+                            ->orderBy('updated_at', 'desc')
+                            ->get()
+                            ->toArray();
+                        //拼接上拼音
+                        foreach ($imgArticles as $k => $v) {
+                            $imgArticles[$k]->pinyin = $catiall[$v->catid][0];
+                        }
+
+                        // 第二次查询:imgurl 为空的数据
+                        $textArticles = Db::table('article')
+                            // ->whereIn('catid', [$category_id])
+                            ->whereIn('catid', $temp_arr = array_merge([$category_id], $cat_1st_arr[$category_id]))
+                            ->where('status', 1)
+                            ->whereNull('imgurl')
+                            ->limit($textSize)
+                            ->orderBy('updated_at', 'desc')
+                            ->get()
+                            ->toArray();
+                        //拼接上拼音
+                        foreach ($textArticles as $k => $v) {
+                            $textArticles[$k]->pinyin = $catiall[$v->catid][0];
+                        }
+                    }
+                    var_dump($level, 'level');
+                    if ($level > 0) {
+                        // 取出一级的所有子级
+                        //取出所有的子级的imgurl 不为空的数据
+                        $imgArticles = Db::table('article')
+                            // ->where('level', 'like', "%$level%")
+                            // ->whereJsonContains('level', [$level])
+                            ->whereRaw('MATCH(level_text) AGAINST(? IN NATURAL LANGUAGE MODE)', [$level])
+                            ->where('status', 1)
+                            ->whereIn('catid', $categoryIds)
+                            ->whereNotNull('imgurl')
+                            ->limit($imgSize)
+                            ->orderBy('updated_at', 'desc')
+                            ->get()
+                            ->toArray();
+                        //拼接上拼音
+                        foreach ($imgArticles as $k => $v) {
+                            $imgArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                        }
+                        //取出所有的子级的imgurl 为空的数据
+                        $textArticles = Db::table('article')
+                            ->where('status', 1)
+                            // ->where('level', 'like', "%$level%")
+                            // ->whereJsonContains('level', [$level])
+                            ->whereRaw('MATCH(level_text) AGAINST(? IN NATURAL LANGUAGE MODE)', [$level])
+                            ->whereIn('catid', $categoryIds)
+                            ->whereNull('imgurl')
+                            ->limit($textSize)
+                            ->orderBy('updated_at', 'desc')
+                            ->get()
+                            ->toArray();
+                        //拼接上拼音
+                        foreach ($textArticles as $k => $v) {
+                            $textArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                        }
+                    }
+                    //将查询到的数据放到componentData里
+                    $componetList[$key]['componentData']['data']['alias'] = $websiteInfoIndexed[$category_id]->alias ?? 'aliasnull' . $category_id;
+                    $componetList[$key]['componentData']['data']['pinyin'] = $websiteInfoIndexed[$category_id]->pinyin ?? 'aliasnull' . $category_id;
+                    $componetList[$key]['componentData']['data']['category_id'] = $category_id;
+                    $componetList[$key]['componentData']['data']['textnum'] = $textArticles;
+                    $componetList[$key]['componentData']['data']['imgnum'] = $imgArticles;
+                    //判断child 
+                    if ($child_id > 0) {
+                        //取出子级的imgurl 不为空的数据
+                        $child_imgArticles = Db::table('article')
+                            ->where('catid', $child_id)
+                            ->whereNotNull('imgurl')
+                            ->limit($child_imgSize)
+                            ->orderBy('updated_at', 'desc')
+                            ->get()
+                            ->toArray();
+                        //取出子级的imgurl 为空的数据
+                        $child_textArticles = Db::table('article')
+                            ->where('catid', $child_id)
+                            ->whereNull('imgurl')
+                            ->limit($child_textSize)
+                            ->orderBy('updated_at', 'desc')
+                            ->get()
+                            ->toArray();
+                        //将查询到的数据放到componentData里
+                        $componetList[$key]['componentData']['data']['child']['alias'] = $websiteInfoIndexed[$child_id]->alias;
+                        $componetList[$key]['componentData']['data']['child']['pinyin'] = $websiteInfoIndexed[$child_id]->pinyin;
+                        $componetList[$key]['componentData']['data']['child']['category_id'] = $child_id;
+                        $componetList[$key]['componentData']['data']['child']['textnum'] = $child_textArticles;
+                        $componetList[$key]['componentData']['data']['child']['imgnum'] = $child_imgArticles;
+                        //取出自己
+                        $all_childcat = $cat_1st_arr[$category_id];
+                        $processedChildCat = array_map(function ($v) use ($websiteInfoIndexed) {
+                            // 从 $websiteInfoIndexed 中获取对应的数据
+                            $info = $websiteInfoIndexed[$v];
+                            // 返回一个包含所需信息的数组
+                            return [
+                                'pinyin' => $info->pinyin,
+                                'alias' => $info->alias,
+                                'category_id' => $info->category_id,
+                                'aLIas_pinyin' => $info->aLIas_pinyin,
+                                'pid' => $info->pid,
+                                'cat_arr_id' => $info->category_arr_id ?? ['出错'],
+                            ];
+                        }, $all_childcat);
+
+                        $componetList[$key]['componentData']['data']['child']['all_childcat'] = $processedChildCat ?? [];
+                    }
+                }
+                //将修改后的数据放到template里
+                $data['template']['index'][0]['componentList'] = $componetList;
+                break;
+            case 'class':
+                $componetList = $data['template']['class']['data'][0]['componentList'];
+                $class_count = count($componetList);
+                $parent_id = $data['template']['class']['parent_id'] ?? 0;
+
+                //获取子级;
+                $child = $cat_1st_arr[$parent_id]; //获取子级
+                // var_dump($child, 'child');
+                //如果$child的数量小于$class_count,就填充一样多的数据给child,如果大于就截取一样的数量给child
+                if (count($child) < $class_count) {
+                    $child = array_pad($child, $class_count, end($child) ?? 0);
+                } elseif (count($child) > $class_count) {
+                    $child = array_slice($child, 0, $class_count);
+                }
+                foreach ($componetList as $key => $value) {
+                    $componentData = $value['componentData'];
+                    //取出imgSize和textSize,获取相应的文章,
+                    $category_id = $child[$key] ?? 0;
+                    $imgSize = $componentData['imgSize'] ?? 0;
+                    $textSize = $componentData['textSize'] ?? 0;
+                    $listType = $componentData['listType'] ?? [];
+                    var_dump($listType, 'before unset listType');
+                    // 定义要移除的元素数组
+                    $valuesToRemove = ['category_name', 'pinyin'];
+                    // 循环移除每个元素
+                    foreach ($valuesToRemove as $value) {
+                        while (($key = array_search($value, $listType)) !== false) {
+                            // 移除该元素
+                            unset($listType[$key]);
+                        }
+                    }
+                    var_dump($listType, 'listType');
+                    //child
+                    $child = $componentData['child'] ?? [];
+
+                    $data_class = [];
+                    //查询imgurl不为空的数据
+                    $imgArticles = Db::table('article')
+                        ->where('catid', $category_id)
+                        ->whereNotNull('imgurl')
+                        ->limit($imgSize)
+                        // ->select($listType)
+                        ->orderBy('updated_at', 'desc')
+                        ->get()
+                        ->toArray();
+                    //拼接上拼音
+                    foreach ($imgArticles as $k => $v) {
+                        $imgArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                    }
+                    //查询imgurl为空的数据
+                    $textArticles = Db::table('article')
+                        ->where('catid', $category_id)
+                        ->whereNull('imgurl')
+                        ->limit($textSize)
+                        ->orderBy('updated_at', 'desc')
+                        ->get()
+                        ->toArray();
+                    //拼接上拼音
+                    foreach ($textArticles as $k => $v) {
+                        $textArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                    }
+
+                    $data_class['alias'] = $websiteInfoIndexed[$category_id]->alias ?? 'aliasnull' . $category_id;
+                    $data_class['pinyin'] = $websiteInfoIndexed[$category_id]->pinyin ?? 'aliasnull' . $category_id;
+                    $data_class['category_id'] = $category_id;
+                    $data_class['textnum'] = $textArticles;
+                    $data_class['imgnum'] = $imgArticles;
+                    $data['data'] = $data_class;
+                }
+                break;
+            case 'list':
+                $componetListdata = $data['template']['list']['data'];
+                $category_id = $data['template']['list']['category_id'] ?? 0;
+
+                foreach ($componetListdata as $k => $v) {
+                    if (!isset($v['componentList']) || !is_array($v['componentList'])) {
+                        continue; // 如果 componentList 不存在或不是数组,跳过当前循环
+                    }
+                    $componentList = &$data['template']['list']['data'][$k]['componentList'];
+                    var_dump(count($componentList), 'componentList111');
+                    foreach ($componentList as $key => $value) {
+                        $componentData = $value['componentData'];
+                        if (isset($value['componentData']['category_id'])) {
+                            $value['componentData']['category_id'] = $category_id;
+                            $page = $componentData['papageTypege']['page'] ?? 1;
+                            $pageSize = $componentData['papageTypege']['pageSize'] ?? 10;
+                            $listType = $componentData['listType'];
+                            $articals = Db::table('article')
+                                ->where('catid', $category_id)
+                                ->where('status', 1)
+                                ->orderBy('updated_at', 'desc')
+                                ->get();
+                            // ->paginate($pageSize, ['*'], 'page', $page);
+                            //拼接上拼音
+                            foreach ($articals as $k => $v) {
+                                $articals[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                            }
+                            $value['componentData']['data'] = $articals;
+                        }
+                        var_dump(isset($value['componentData']['level']), $key, '---------------------------------------');
+                        if (isset($value['componentData']['level'])) {
+                            //取出imgSize和textSize,获取相应的文章,
+                            $imgSize = $componentData['imgnum'] ?? 0;
+                            $textSize = $componentData['textnum'] ?? 0;
+                            $listType = $componentData['listType'] ?? [];
+                            // 定义要移除的元素数组
+                            $valuesToRemove = ['category_name', 'pinyin'];
+                            // 循环移除每个元素
+                            foreach ($valuesToRemove as $value) {
+                                while (($key = array_search($value, $listType)) !== false) {
+                                    // 移除该元素
+                                    unset($listType[$key]);
+                                }
+                            }
+                            //查询imgurl不为空的数据
+                            $imgArticles = Db::table('article')
+                                ->where('catid', $category_id)
+                                ->whereNotNull('imgurl')
+                                ->limit($imgSize)
+                                ->orderBy('updated_at', 'desc')
+                                ->get()
+                                ->toArray();
+                            //拼接上拼音
+                            foreach ($imgArticles as $k => $v) {
+                                $imgArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                            }
+                            //查询imgurl为空的数据
+                            $textArticles = Db::table('article')
+                                ->where('catid', $category_id)
+                                ->whereNull('imgurl')
+                                ->limit($textSize)
+                                ->orderBy('updated_at', 'desc')
+                                ->get()
+                                ->toArray();
+                            //拼接上拼音
+                            foreach ($textArticles as $k => $v) {
+                                $textArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                            }
+                            //将查询到的数据放到componentData里
+                            $componetList[$key]['componentData']['data']['alias'] = $websiteInfoIndexed[$category_id]->alias ?? 'aliasnull' . $category_id;
+                            $componetList[$key]['componentData']['data']['pinyin'] = $websiteInfoIndexed[$category_id]->pinyin ?? 'aliasnull' . $category_id;
+                            $componetList[$key]['componentData']['data']['category_id'] = $category_id;
+                            $componetList[$key]['componentData']['data']['textnum'] = $textArticles;
+                            $componetList[$key]['componentData']['data']['imgnum'] = $imgArticles;
+                            //将修改后的数据放到template里
+                            // $data['template']['list']['data'][0]['componentList'] = $componetList;
+                        }
+                    }
+                }
+
+                break;
+            case 'article':
+                $article_id = 51434; //假设这是文章ID
+                $componetListdata = &$data['template']['article']['data'];
+                var_dump($categoryIds, '----------------');
+                // $category_id = $data['template']['article']['category_id'] ?? 0;
+                foreach ($componetListdata as $k => $v) {
+                    foreach ($v['componentList'] as $key => $value) {
+                        $componentData = $value['componentData'];
+                        if (isset($value['componentData']['article_id'])) {
+                            $value['componentData']['article_id'] = $article_id;
+                            // $page = $componentData['papageTypege']['page'] ?? 1;
+                            // $pageSize = $componentData['papageTypege']['pageSize'] ?? 10;
+                            $listType = $componentData['listType'];
+                            //查询数据
+                            $articals = Db::table('article')
+                                ->where('id', $article_id)
+                                ->where('status', 1)
+                                ->leftJoin('article_data', 'article.id', '=', 'article_data.article_id')
+                                ->select('article.*', 'article_data.content')
+                                ->orderBy('updated_at', 'desc')
+                                ->get();
+                            //拼接上拼音
+                            $value['componentData']['data'] = $articals;
+                        }
+                        if (isset($value['componentData']['level'])) {
+
+                            //:1:头条 2:轮播图 3:推荐图 4:最新新闻;5:推荐新闻;6:热点资讯   7:自动关联
+                            //4 update   5 30天之内    6  库中
+                            $level = $componentData['level'] ?? 0;
+                            $imgSize = $componentData['imgnum'] ?? 0;
+                            $textSize = $componentData['textnum'] ?? 0;
+                            if (in_array($level, [1, 2, 3, 6])) {
+                                //查询imgurl不为空的数据
+                                $imgArticles = Db::table('article')->whereIn('catid', $categoryIds)->whereNotNull('imgurl')
+                                    ->where('status', 1)
+                                    ->whereRaw('MATCH(level_text) AGAINST(? IN NATURAL LANGUAGE MODE)', [$level])
+                                    ->limit($imgSize)->orderBy('updated_at', 'desc')->get()->toArray();
+                                //拼接上拼音
+                                foreach ($imgArticles as $k => $v) {
+                                    $imgArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                                }
+                                //查询imgurl为空的数据
+                                $textArticles = Db::table('article')->where('catid', $categoryIds)->whereNull('imgurl')
+                                    ->where('status', 1)
+                                    ->whereRaw('MATCH(level_text) AGAINST(? IN NATURAL LANGUAGE MODE)', [$level])
+                                    ->limit($textSize)->orderBy('updated_at', 'desc')->get()->toArray();
+                                //拼接上拼音
+                                foreach ($textArticles as $k => $v) {
+                                    $textArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                                }
+                            } else if ($level == 4) {
+
+                                //查询imgurl不为空的数据
+                                $imgArticles = Db::table('article')->whereIn('catid', $categoryIds)->whereNotNull('imgurl')
+                                    ->where('status', 1)
+                                    ->limit($imgSize)->orderBy('updated_at', 'desc')->get()->toArray();
+
+
+                                //拼接上拼音
+                                if (!empty($imgArticles)) {
+                                    foreach ($imgArticles as $k => $v) {
+                                        $imgArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                                    }
+                                }
+
+                                //查询imgurl为空的数据
+                                $textArticles = Db::table('article')->whereIn('catid', $categoryIds)->whereNull('imgurl')
+                                    ->where('status', 1)
+                                    ->limit($textSize)->orderBy('updated_at', 'desc')->get()->toArray();
+                                //拼接上拼音
+                                var_dump('---4------');
+                                if (!empty($textArticles)) {
+                                    foreach ($textArticles as $k => $v) {
+                                        $textArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                                    }
+                                }
+                            } else if ($level == 5) {
+
+                                var_dump($value['componentData']['level'], 'level');
+                                //查询imgurl不为空的数据
+                                $imgArticles = Db::table('article')->whereIn('catid', $categoryIds)->whereNotNull('imgurl')
+                                    ->where('status', 1)
+                                    //最近三十天
+                                    ->where('updated_at', '>=', date('Y-m-d H:i:s', strtotime('-30 days')))
+                                    ->limit($imgSize)->orderBy('updated_at', 'desc')->get()->toArray();
+                                //拼接上拼音
+                                if (!empty($imgArticles)) {
+                                    foreach ($imgArticles as $k => $v) {
+                                        $imgArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                                    }
+                                }
+
+                                //查询imgurl为空的数据
+                                $textArticles = Db::table('article')->whereIn('catid', $categoryIds)->whereNull('imgurl')
+                                    ->where('status', 1)
+                                    ->where('updated_at', '>=', date('Y-m-d H:i:s', strtotime('-30 days')))
+                                    ->limit($textSize)->orderBy('updated_at', 'desc')->get()->toArray();
+                                //拼接上拼音
+                                var_dump('---5------');
+                                if (!empty($textArticles)) {
+                                    foreach ($textArticles as $k => $v) {
+                                        $textArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                                    }
+                                }
+                            } else if ($level == 7) {
+                                //获取artical的keyword
+                                $keword = DB::table('artical')->where('id', $article_id)->select('keyword')->get();
+                                $kewordl = $keword[0]->keyword;
+                                $kewordl = explode(',', $kewordl);
+                                //筛选出符合条件的article来
+                                $imgArticles = Db::table('article')->whereIn('catid', $categoryIds)->whereNotNull('imgurl')
+                                    ->where('status', 1)
+                                    // ->whereJsonContains('keyword', $kewordl)
+                                    ->whereRaw('MATCH(keyword) AGAINST(? IN NATURAL LANGUAGE MODE)', [$kewordl])
+                                    ->limit($imgSize)->orderBy('updated_at', 'desc')->get()->toArray();
+                                //拼接上拼音
+                                foreach ($imgArticles as $k => $v) {
+                                    $imgArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                                }
+
+                                $textArticles = Db::table('article')->whereIn('catid', $categoryIds)->whereNull('imgurl')
+                                    ->where('status', 1)
+                                    // ->whereJsonContains('keyword', $kewordl)
+                                    ->whereRaw('MATCH(keyword) AGAINST(? IN NATURAL LANGUAGE MODE)', [$kewordl])
+                                    ->limit($textSize)->orderBy('updated_at', 'desc')->get()->toArray();
+
+                                //拼接上拼音
+                                foreach ($textArticles as $k => $v) {
+                                    $textArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
+                                }
+                            }
+                        }
+                        $value['componentData']['data']['imgnum'] = $imgArticles ?? [];
+                        $value['componentData']['data']['textnum'] = $textArticles ?? [];
+                    }
+                }
+                break;
+            case 'search':
+                break;
+            case 'aboutList':
+                $fact_id = 7;
+                $componetList = &$data['template']['aboutList']['componentData'];
+                $componetList['fact_id'] = $fact_id;
+                $content =  Db::table('footer_content')
+                    ->where('fcat_id', $fact_id)
+                    ->orderBy('updated_at', 'desc')
+                    ->get()
+                    ->toArray();
+                $componetList['data'] = $content;
+                break;
+            case 'aboutArticle':
+                $fact_id = 7;
+                $componetList = &$data['template']['aboutList']['componentData'];
+                $componetList['fact_id'] = $fact_id;
+                $content =  Db::table('footer_content')
+                    ->where('id', $fact_id)
+                    ->orderBy('updated_at', 'desc')
+                    ->get()
+                    ->toArray();
+                $componetList['data'] = $content;
+                break;
+            default:
+                $componetList = [];
+                break;
+        }
+        return $data;
+    }
+
+
+    public function indexData1(array $data): array
+    {
+        $time1 = microtime(true);
+        // 解析模板数据
+        $templateData = json_decode($data['template'], true);
+        $website_id = $templateData['base']['website_id'] ?? 2;
+        $componentList = $templateData['template']['index'][0]['componentList'];
+
+        // 1️⃣ 获取网站分类信息
+        $websiteInfo = Db::table('website_category')
+            ->where('website_id', $website_id)
+            ->get()
+            ->toArray();
+
+        // 构建索引和拼音映射
+        $websiteInfoIndexed = array_column($websiteInfo, null, 'category_id');
+        $categoryIds = array_column($websiteInfo, 'category_id');
+        $aliasPinyins = array_column($websiteInfo, 'aLIas_pinyin');
+        $cat_arr = array_combine($categoryIds, $aliasPinyins);
+
+        // 构建 catiall 和 cat_1st_arr
+        $catiall = [];
+        $cat_1st_arr = [];
+
+        foreach ($websiteInfo as $item) {
+            $arrId = json_decode($item->category_arr_id);
+            $pinyin_str = implode('/', array_map(fn($id) => $cat_arr[$id], $arrId));
+            $pinyin_str = rtrim($pinyin_str, '/');
+
+            $catiall[$item->category_id][] = $pinyin_str;
+            $websiteInfoIndexed[$item->category_id]->pinyin = $pinyin_str;
+
+            if ($item->pid == 0) {
+                $cat_1st_arr[$item->category_id] = [];
+            } else {
+                $cat_1st_arr[$item->pid][] = $item->category_id;
+            }
+        }
+
+        // 2️⃣ 提前聚合所有需要查询的 category_id 和限制参数
+        $allCatIds = [];
+        $imgLimits = [];
+        $txtLimits = [];
+        $childImgLimits = [];
+        $childTxtLimits = [];
+
+        foreach ($componentList as $item) {
+            $componentData = $item['componentData'];
+            $category_id = $componentData['category_id'] ?? 0;
+
+            if ($category_id > 0) {
+                $allCatIds[] = $category_id;
+                $imgLimits[$category_id] = $componentData['imgSize'] ?? 0;
+                $txtLimits[$category_id] = $componentData['textSize'] ?? 0;
+
+                if (!empty($cat_1st_arr[$category_id])) {
+                    $allCatIds = array_merge($allCatIds, $cat_1st_arr[$category_id]);
+                }
+            }
+
+            // 子级
+            $child = $componentData['child'] ?? null;
+            if ($child && isset($child['id']) && $child['id'] > 0) {
+                $child_id = $child['id'];
+                $childImgLimits[$child_id] = $child['imgSize'] ?? 0;
+                $childTxtLimits[$child_id] = $child['textSize'] ?? 0;
+            }
+        }
+
+        $allCatIds = array_unique(array_filter($allCatIds));
+
+        // 3️⃣ 一次性查询所有 article 数据
+        $allArticles = Db::table('article')
+            ->whereIn('catid', $allCatIds)
+            ->where('status', 1)
+            ->get()
+            ->toArray();
+
+        // 构建按 imgurl 分类的文章集合
+        $articlesByCat = ['img' => [], 'txt' => []];
+        foreach ($allArticles as $article) {
+            if (!empty($article->imgurl)) {
+                $articlesByCat['img'][$article->catid][] = $article;
+            } else {
+                $articlesByCat['txt'][$article->catid][] = $article;
+            }
+        }
+
+        // 4️⃣ 使用协程并发处理每个组件
+        $results = [];
+
+        foreach ($componentList as $key => $value) {
+            $componentKey = $key;
+            $componentData = $value['componentData'];
+
+            Coroutine::create(function () use (&$results, $componentKey, $componentData, $websiteInfoIndexed, $cat_1st_arr, $catiall, $articlesByCat, $imgLimits, $txtLimits, $childImgLimits, $childTxtLimits) {
+                $result = [];
+
+                $category_id = $componentData['category_id'] ?? 0;
+                $imgLimit = $imgLimits[$category_id] ?? 0;
+                $txtLimit = $txtLimits[$category_id] ?? 0;
+
+                if ($category_id > 0) {
+                    // 图文数据
+                    $imgArticles = array_slice($articlesByCat['img'][$category_id] ?? [], 0, $imgLimit);
+                    foreach ($imgArticles as &$v) {
+                        $v->pinyin = $catiall[$v->catid][0] ?? '';
+                    }
+
+                    // 纯文字数据
+                    $textArticles = array_slice($articlesByCat['txt'][$category_id] ?? [], 0, $txtLimit);
+                    foreach ($textArticles as &$v) {
+                        $v->pinyin = $catiall[$v->catid][0] ?? '';
+                    }
+
+                    $result['imgnum'] = $imgArticles;
+                    $result['textnum'] = $textArticles;
+                    $result['alias'] = $websiteInfoIndexed[$category_id]['alias'] ?? '';
+                    $result['pinyin'] = $websiteInfoIndexed[$category_id]['pinyin'] ?? '';
+                    $result['category_id'] = $category_id;
+                }
+
+                // 子级处理
+                $child = $componentData['child'] ?? null;
+                if ($child && isset($child['id']) && $child['id'] > 0) {
+                    $child_id = $child['id'];
+                    $c_imgLimit = $childImgLimits[$child_id] ?? 0;
+                    $c_txtLimit = $childTxtLimits[$child_id] ?? 0;
+
+                    $childImg = array_slice($articlesByCat['img'][$child_id] ?? [], 0, $c_imgLimit);
+                    foreach ($childImg as &$v) {
+                        $v->pinyin = $catiall[$v->catid][0] ?? '';
+                    }
+
+                    $childText = array_slice($articlesByCat['txt'][$child_id] ?? [], 0, $c_txtLimit);
+                    foreach ($childText as &$v) {
+                        $v->pinyin = $catiall[$v->catid][0] ?? '';
+                    }
+
+                    $result['child'] = [
+                        'alias' => $websiteInfoIndexed[$child_id]['alias'] ?? '',
+                        'pinyin' => $websiteInfoIndexed[$child_id]['pinyin'] ?? '',
+                        'category_id' => $child_id,
+                        'textnum' => $childText,
+                        'imgnum' => $childImg,
+                        'all_childcat' => array_map(fn($v) => $websiteInfoIndexed[$v], $cat_1st_arr[$category_id] ?? []),
+                    ];
+                }
+
+                $results[$componentKey] = $result;
+            });
+        }
+
+        // 等待所有协程完成(生产环境应使用 WaitGroup)
+        usleep(200000); // 示例中简单等待
+
+        // 5️⃣ 回填结果到 componentList
+        foreach ($componentList as $key => &$component) {
+            $componentData = $component['componentData'];
+            $category_id = $componentData['category_id'] ?? 0;
+
+            if (isset($results[$key])) {
+                $component['componentData']['data'] = $results[$key];
+            }
+        }
+
+        // 6️⃣ 返回最终数据
+        $templateData['template']['index'][0]['componentList'] = $componentList;
+        return $templateData;
+    }
 }

+ 1 - 4
app/JsonRpc/ClientServiceInterface.php

@@ -4,9 +4,6 @@ namespace App\JsonRpc;
 
 interface ClientServiceInterface
 {
-    /**
-     * @param array $params
-     * @return array
-     */
     public function test(array $params): array;
+    public function indexData(array $params);
 }

+ 13 - 8
app/Listener/DbQueryExecutedListener.php

@@ -9,20 +9,18 @@ declare(strict_types=1);
  * @contact  group@hyperf.io
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
+
 namespace App\Listener;
 
+use Hyperf\Collection\Arr;
 use Hyperf\Database\Events\QueryExecuted;
 use Hyperf\Event\Annotation\Listener;
 use Hyperf\Event\Contract\ListenerInterface;
 use Hyperf\Logger\LoggerFactory;
-use Hyperf\Utils\Arr;
-use Hyperf\Utils\Str;
 use Psr\Container\ContainerInterface;
 use Psr\Log\LoggerInterface;
 
-/**
- * @Listener
- */
+#[Listener]
 class DbQueryExecutedListener implements ListenerInterface
 {
     /**
@@ -45,13 +43,20 @@ class DbQueryExecutedListener implements ListenerInterface
     /**
      * @param QueryExecuted $event
      */
-    public function process(object $event)
+    public function process(object $event): void
     {
         if ($event instanceof QueryExecuted) {
             $sql = $event->sql;
             if (! Arr::isAssoc($event->bindings)) {
-                foreach ($event->bindings as $key => $value) {
-                    $sql = Str::replaceFirst('?', "'{$value}'", $sql);
+                $position = 0;
+                foreach ($event->bindings as $value) {
+                    $position = strpos($sql, '?', $position);
+                    if ($position === false) {
+                        break;
+                    }
+                    $value = "'{$value}'";
+                    $sql = substr_replace($sql, $value, $position, 1);
+                    $position += strlen($value);
                 }
             }
 

+ 35 - 0
app/Listener/ResumeExitCoordinatorListener.php

@@ -0,0 +1,35 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * This file is part of Hyperf.
+ *
+ * @link     https://www.hyperf.io
+ * @document https://hyperf.wiki
+ * @contact  group@hyperf.io
+ * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
+ */
+
+namespace App\Listener;
+
+use Hyperf\Command\Event\AfterExecute;
+use Hyperf\Coordinator\Constants;
+use Hyperf\Coordinator\CoordinatorManager;
+use Hyperf\Event\Annotation\Listener;
+use Hyperf\Event\Contract\ListenerInterface;
+
+#[Listener]
+class ResumeExitCoordinatorListener implements ListenerInterface
+{
+    public function listen(): array
+    {
+        return [
+            AfterExecute::class,
+        ];
+    }
+
+    public function process(object $event): void
+    {
+        CoordinatorManager::until(Constants::WORKER_EXIT)->resume();
+    }
+}

+ 27 - 0
app/Model/Article.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Article extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'article';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/ArticleData.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class ArticleData extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'article_data';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/ArticleSurvey.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class ArticleSurvey extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'article_survey';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/Book.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Book extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'book';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $guarded = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/Category.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Category extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'category';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/ChatGroups.php

@@ -0,0 +1,27 @@
+<?php
+
+declare (strict_types = 1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class ChatGroups extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'chat_groups';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/ChatGroupsMember.php

@@ -0,0 +1,27 @@
+<?php
+
+declare (strict_types = 1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class ChatGroupsMember extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'chat_groups_members';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/ChatRecords.php

@@ -0,0 +1,27 @@
+<?php
+
+declare (strict_types = 1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class ChatRecords extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'chat_records';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 31 - 0
app/Model/Complaint.php

@@ -0,0 +1,31 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Complaint extends Model
+{
+
+
+
+
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table =   'complaint';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $guarded = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/District.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class District extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'district';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 29 - 0
app/Model/Good.php

@@ -0,0 +1,29 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Good extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'good';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    // protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+
+    protected array $guarded = [];
+}

+ 27 - 0
app/Model/JobApply.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobApply extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_apply';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/JobCompany.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobCompany extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_company';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/JobEnum.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobEnum extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_enum';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/JobHunting.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobHunting extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_hunting';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $guarded = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/JobIndustry.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobIndustry extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_industry';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/JobNature.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobNature extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_nature';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/JobPosition.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobPosition extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_position';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/JobRecruiting.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobRecruiting extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_recruiting';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 28 - 0
app/Model/JobRemuse.php

@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobRemuse extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_resume';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/Link.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Link extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'link';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 1 - 0
app/Model/Model.php → app/Model/Model copy.php

@@ -9,6 +9,7 @@ declare(strict_types=1);
  * @contact  group@hyperf.io
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
+
 namespace App\Model;
 
 use Hyperf\DbConnection\Model\Model as BaseModel;

+ 27 - 0
app/Model/Notice.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Notice extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'notice';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $guarded = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 29 - 0
app/Model/User.php

@@ -0,0 +1,29 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class User extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'user';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    // protected array $fillable = ["user_name","avatar","status","email","rong_token"];
+    // protected array $hidden = [];
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/UserInfo.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class UserInfo extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'user_info';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/Web.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Web extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'web';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/Website.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class Website extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'website';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 32 - 0
app/Model/WebsiteCategory.php

@@ -0,0 +1,32 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class WebsiteCategory extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'website_category';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+    public function children()
+    {
+        return $this->hasMany(WebsiteCategory::class, 'pid', 'category_id');
+    }
+
+}

+ 27 - 0
app/Model/WebsiteColumn.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class WebsiteColumn extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'website_column';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/WebsiteGroup.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class WebsiteGroup extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'website_group';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/WebsiteRole.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class WebsiteRole extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'website_role';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/WebsiteRoleUser.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class WebsiteRoleUser extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'website_role_user';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 27 - 0
app/Model/jobResume.php

@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Model;
+
+use Hyperf\DbConnection\Model\Model;
+
+/**
+ */
+class JobResume extends Model
+{
+    /**
+     * The table associated with the model.
+     */
+    protected ?string $table = 'job_resume';
+
+    /**
+     * The attributes that are mass assignable.
+     */
+    protected array $fillable = [];
+
+    /**
+     * The attributes that should be cast to native types.
+     */
+    protected array $casts = [];
+}

+ 2 - 1
bin/hyperf.php

@@ -9,10 +9,11 @@ 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);
 
 require BASE_PATH . '/vendor/autoload.php';
 
+! defined('SWOOLE_HOOK_FLAGS') && define('SWOOLE_HOOK_FLAGS', Hyperf\Engine\DefaultOption::hookFlags());
+
 // Self-called anonymous function that creates its own scope and keep the global namespace clean.
 (function () {
     Hyperf\Di\ClassLoader::init();

+ 29 - 28
composer.json

@@ -12,36 +12,37 @@
     "description": "A coroutine framework that focuses on hyperspeed and flexible, specifically use for build microservices and middlewares.",
     "license": "Apache-2.0",
     "require": {
-        "php": ">=7.3",
-        "hyperf/cache": "~2.2.0",
-        "hyperf/command": "~2.2.0",
-        "hyperf/config": "~2.2.0",
-        "hyperf/constants": "~2.2.0",
-        "hyperf/database": "~2.2.0",
-        "hyperf/db-connection": "~2.2.0",
-        "hyperf/framework": "~2.2.0",
-        "hyperf/guzzle": "~2.2.0",
-        "hyperf/http-server": "~2.2.0",
-        "hyperf/json-rpc": "~2.2.0",
-        "hyperf/logger": "~2.2.0",
-        "hyperf/memory": "~2.2.0",
-        "hyperf/paginator": "^2.2",
-        "hyperf/process": "~2.2.0",
-        "hyperf/rpc": "~2.2.0",
-        "hyperf/rpc-client": "~2.2.0",
-        "hyperf/rpc-server": "~2.2.0",
-        "hyperf/service-governance": "~2.2.0",
-        "hyperf/tracer": "~2.2.0"
+        "php": ">=8.1",
+        "hyperf/cache": "~3.1.0",
+        "hyperf/command": "~3.1.0",
+        "hyperf/config": "~3.1.0",
+        "hyperf/constants": "~3.1.0",
+        "hyperf/database": "~3.1.0",
+        "hyperf/db-connection": "~3.1.0",
+        "hyperf/engine": "^2.10",
+        "hyperf/framework": "~3.1.0",
+        "hyperf/guzzle": "~3.1.0",
+        "hyperf/http-server": "~3.1.0",
+        "hyperf/json-rpc": "~3.1.0",
+        "hyperf/logger": "~3.1.0",
+        "hyperf/memory": "~3.1.0",
+        "hyperf/model-cache": "~3.1.0",
+        "hyperf/process": "~3.1.0",
+        "hyperf/redis": "~3.1.0",
+        "hyperf/rpc": "~3.1.0",
+        "hyperf/rpc-client": "~3.1.0",
+        "hyperf/rpc-server": "~3.1.0",
+        "hyperf/service-governance": "~3.1.0",
+        "hyperf/tracer": "^3.1"
     },
     "require-dev": {
         "friendsofphp/php-cs-fixer": "^3.0",
-        "hyperf/devtool": "~2.2.0",
-        "hyperf/ide-helper": "~2.2.0",
-        "hyperf/testing": "~2.2.0",
-        "hyperf/watcher": "^2.2",
+        "hyperf/devtool": "~3.1.0",
+        "hyperf/testing": "~3.1.0",
+        "hyperf/watcher": "^3.1",
         "mockery/mockery": "^1.0",
-        "phpstan/phpstan": "^0.12",
-        "swoole/ide-helper": "^4.5"
+        "phpstan/phpstan": "^1.0",
+        "swoole/ide-helper": "^5.0"
     },
     "suggest": {
         "ext-openssl": "Required to use HTTPS.",
@@ -75,9 +76,9 @@
         "post-autoload-dump": [
             "rm -rf runtime/container"
         ],
-        "test": "co-phpunit --prepend test/bootstrap.php -c phpunit.xml --colors=always",
+        "test": "co-phpunit --prepend test/bootstrap.php --colors=always",
         "cs-fix": "php-cs-fixer fix $1",
-        "analyse": "phpstan analyse --memory-limit 300M -l 0 -c phpstan.neon ./app ./config",
+        "analyse": "phpstan analyse --memory-limit 300M",
         "start": [
             "Composer\\Config::disableProcessTimeout",
             "php ./bin/hyperf.php start"

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 274 - 394
composer.lock


+ 2 - 1
config/autoload/cache.php

@@ -12,7 +12,8 @@ declare(strict_types=1);
 return [
     'default' => [
         'driver' => Hyperf\Cache\Driver\RedisDriver::class,
-        'packer' => Hyperf\Utils\Packer\PhpSerializerPacker::class,
+        'packer' => Hyperf\Codec\Packer\PhpSerializerPacker::class,
         'prefix' => 'c:',
+        'skip_cache_results' => [],
     ],
 ];

+ 15 - 3
config/autoload/databases.php

@@ -9,16 +9,18 @@ declare(strict_types=1);
  * @contact  group@hyperf.io
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
+use function Hyperf\Support\env;
+
 return [
     'default' => [
         'driver' => env('DB_DRIVER', 'mysql'),
         'host' => env('DB_HOST', 'localhost'),
-        'database' => env('DB_DATABASE', 'hyperf'),
         'port' => env('DB_PORT', 3306),
+        'database' => env('DB_DATABASE', 'hyperf'),
         'username' => env('DB_USERNAME', 'root'),
         'password' => env('DB_PASSWORD', ''),
-        'charset' => env('DB_CHARSET', 'utf8'),
-        'collation' => env('DB_COLLATION', 'utf8_unicode_ci'),
+        'charset' => env('DB_CHARSET', 'utf8mb4'),
+        'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
         'prefix' => env('DB_PREFIX', ''),
         'pool' => [
             'min_connections' => 1,
@@ -28,11 +30,21 @@ return [
             'heartbeat' => -1,
             'max_idle_time' => (float) env('DB_MAX_IDLE_TIME', 60),
         ],
+        'cache' => [
+            'handler' => Hyperf\ModelCache\Handler\RedisHandler::class,
+            'cache_key' => '{mc:%s:m:%s}:%s:%s',
+            'prefix' => 'default',
+            'ttl' => 3600 * 24,
+            'empty_model_ttl' => 600,
+            'load_script' => true,
+        ],
         'commands' => [
             'gen:model' => [
                 'path' => 'app/Model',
                 'force_casts' => true,
                 'inheritance' => 'Model',
+                'uses' => '',
+                'table_mapping' => [],
             ],
         ],
     ],

+ 0 - 1
config/autoload/dependencies.php

@@ -10,5 +10,4 @@ declare(strict_types=1);
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
 return [
-    // App\JsonRpc\ClientServiceInterface::class => App\JsonRpc\ClientService::class,
 ];

+ 2 - 0
config/autoload/listeners.php

@@ -10,4 +10,6 @@ declare(strict_types=1);
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
 return [
+    Hyperf\ExceptionHandler\Listener\ErrorExceptionHandler::class,
+    Hyperf\Command\Listener\FailToHandleListener::class,
 ];

+ 0 - 16
config/autoload/logger.php

@@ -27,20 +27,4 @@ return [
             ],
         ],
     ],
-    'rpc' => [
-        'handler' => [
-            'class' => Monolog\Handler\StreamHandler::class,
-            'constructor' => [
-                'stream' => BASE_PATH . '/runtime/logs/rpc.log',
-                'level' => Monolog\Logger::INFO,
-            ],
-        ],
-        'formatter' => [
-            'class' => Monolog\Formatter\JsonFormatter::class,
-            'constructor' => [
-                'format' => "%message% %context% %extra%\n",
-                'dateFormat' => 'Y-m-d H:i:s',
-            ],
-        ],
-    ],
 ];

+ 1 - 1
config/autoload/middlewares.php

@@ -10,7 +10,7 @@ declare(strict_types=1);
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
 return [
-    'jsonrpc-http' => [
+    'http' => [
         \App\Middleware\RpcLoggerMiddleware::class,
     ],
 ];

+ 7 - 4
config/autoload/opentracing.php

@@ -9,15 +9,18 @@ declare(strict_types=1);
  * @contact  group@hyperf.io
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
+
 use Zipkin\Samplers\BinarySampler;
 
+use function Hyperf\Support\env;
+
 return [
     'default' => env('TRACER_DRIVER', 'zipkin'),
     'enable' => [
-        'guzzle' => env('TRACER_ENABLE_GUZZLE', false),
-        'redis' => env('TRACER_ENABLE_REDIS', false),
-        'db' => env('TRACER_ENABLE_DB', false),
-        'method' => env('TRACER_ENABLE_METHOD', false),
+        'guzzle' => env('TRACER_ENABLE_GUZZLE', true),
+        'redis' => env('TRACER_ENABLE_REDIS', true),
+        'db' => env('TRACER_ENABLE_DB', true),
+        'method' => env('TRACER_ENABLE_METHOD', true),
     ],
     'tracer' => [
         'zipkin' => [

+ 29 - 0
config/autoload/redis.php

@@ -0,0 +1,29 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * This file is part of Hyperf.
+ *
+ * @link     https://www.hyperf.io
+ * @document https://hyperf.wiki
+ * @contact  group@hyperf.io
+ * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
+ */
+use function Hyperf\Support\env;
+
+return [
+    'default' => [
+        'host' => env('REDIS_HOST', 'localhost'),
+        'auth' => env('REDIS_AUTH', null),
+        'port' => (int) env('REDIS_PORT', 6379),
+        'db' => (int) env('REDIS_DB', 0),
+        'pool' => [
+            'min_connections' => 1,
+            'max_connections' => 10,
+            'connect_timeout' => 10.0,
+            'wait_timeout' => 3.0,
+            'heartbeat' => -1,
+            'max_idle_time' => (float) env('REDIS_MAX_IDLE_TIME', 60),
+        ],
+    ],
+];

+ 4 - 4
config/autoload/server.php

@@ -24,15 +24,15 @@ return [
             'port' => 9510,
             'sock_type' => SWOOLE_SOCK_TCP,
             'callbacks' => [
-                // Event::ON_REQUEST => [Hyperf\HttpServer\Server::class, 'onRequest'],
                 Event::ON_REQUEST => [Hyperf\JsonRpc\HttpServer::class, 'onRequest'],
             ],
-
-
+            'options' => [
+                // Whether to enable request lifecycle event
+                'enable_request_lifecycle' => false,
+            ],
         ],
     ],
     'settings' => [
-        'timezone' => 'Asia/Shanghai',
         Constant::OPTION_ENABLE_COROUTINE => true,
         Constant::OPTION_WORKER_NUM => swoole_cpu_num(),
         Constant::OPTION_PID_FILE => BASE_PATH . '/runtime/hyperf.pid',

+ 4 - 1
config/config.php

@@ -9,11 +9,14 @@ declare(strict_types=1);
  * @contact  group@hyperf.io
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
+
 use Hyperf\Contract\StdoutLoggerInterface;
 use Psr\Log\LogLevel;
 
+use function Hyperf\Support\env;
+
 return [
-    'app_name' => env('APP_NAME', 'skeleton'),
+    'app_name' => env('APP_NAME', 'client_producer'),
     'app_env' => env('APP_ENV', 'dev'),
     'scan_cacheable' => env('SCAN_CACHEABLE', false),
     StdoutLoggerInterface::class => [

+ 2 - 5
config/container.php

@@ -12,13 +12,10 @@ 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\DefinitionSourceFactory;
-use Hyperf\Utils\ApplicationContext;
 
-$container = new Container((new DefinitionSourceFactory(true))());
+$container = new Container((new DefinitionSourceFactory())());
 
-if (! $container instanceof \Psr\Container\ContainerInterface) {
-    throw new RuntimeException('The dependency injection container is invalid.');
-}
 return ApplicationContext::setContainer($container);

+ 2 - 2
deploy.test.yml

@@ -4,9 +4,9 @@ services:
     image: $REGISTRY_URL/$PROJECT_NAME:test
     environment:
       - "APP_PROJECT=hyperf"
-      - "APP_ENV=test"
+      - "APP_ENV=testing"
     ports:
-      - 9501:9501
+      - "9501:9501"
     deploy:
       replicas: 1
       restart_policy:

+ 18 - 0
docker-compose.yml

@@ -0,0 +1,18 @@
+version: '3'
+services:
+  hyperf-skeleton:
+    container_name: hyperf-skeleton
+    image: hyperf-skeleton
+    build:
+      context: .
+    volumes:
+      - ./:/opt/www
+    ports:
+      - 9501:9501
+    environment:
+      - APP_ENV=dev
+      - SCAN_CACHEABLE=false
+
+networks:
+  default:
+    name: hyperf-skeleton

+ 14 - 0
phpstan.neon.dist

@@ -0,0 +1,14 @@
+# Magic behaviour with __get, __set, __call and __callStatic is not exactly static analyser-friendly :)
+# Fortunately, You can ignore it by the following config.
+#
+# vendor/bin/phpstan analyse app --memory-limit 200M -l 0
+#
+parameters:
+  level: 0
+  paths:
+    - ./app
+    - ./config
+  reportUnmatchedIgnoredErrors: false
+  ignoreErrors:
+    - '#Static call to instance method Hyperf\\HttpServer\\Router\\Router::[a-zA-Z0-9\\_]+\(\)#'
+    - '#Static call to instance method Hyperf\\DbConnection\\Db::[a-zA-Z0-9\\_]+\(\)#'

+ 16 - 0
phpunit.xml.dist

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="./test/bootstrap.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
+  <testsuites>
+    <testsuite name="Tests">
+      <directory suffix="Test.php">./test</directory>
+    </testsuite>
+  </testsuites>
+  <php>
+    <env name="APP_ENV" value="testing" force="true"/>
+  </php>
+  <source>
+    <include>
+      <directory suffix=".php">./app</directory>
+    </include>
+  </source>
+</phpunit>

+ 4 - 4
test/Cases/ExampleTest.php

@@ -9,19 +9,19 @@ declare(strict_types=1);
  * @contact  group@hyperf.io
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
+
 namespace HyperfTest\Cases;
 
-use HyperfTest\HttpTestCase;
+use Hyperf\Testing\TestCase;
 
 /**
  * @internal
  * @coversNothing
  */
-class ExampleTest extends HttpTestCase
+class ExampleTest extends TestCase
 {
     public function testExample()
     {
-        $this->assertTrue(true);
-        $this->assertTrue(is_array($this->get('/')));
+        $this->get('/')->assertOk()->assertSee('Hyperf');
     }
 }

+ 3 - 0
test/HttpTestCase.php

@@ -9,11 +9,14 @@ declare(strict_types=1);
  * @contact  group@hyperf.io
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
+
 namespace HyperfTest;
 
 use Hyperf\Testing\Client;
 use PHPUnit\Framework\TestCase;
 
+use function Hyperf\Support\make;
+
 /**
  * Class HttpTestCase.
  * @method get($uri, $data = [], $headers = [])

+ 4 - 3
test/bootstrap.php

@@ -15,13 +15,14 @@ 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);
 
+! defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));
+
 require BASE_PATH . '/vendor/autoload.php';
 
+! defined('SWOOLE_HOOK_FLAGS') && define('SWOOLE_HOOK_FLAGS', Hyperf\Engine\DefaultOption::hookFlags());
+
 Hyperf\Di\ClassLoader::init();
 
 $container = require BASE_PATH . '/config/container.php';

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.