rkljw 8 mesi fa
parent
commit
3f05495fa7
38 ha cambiato i file con 757 aggiunte e 917 eliminazioni
  1. 2 2
      .env
  2. 0 41
      .gitignore
  3. 0 19
      app/JsonRpc/DistrictServiceInterface.php
  4. 222 0
      app/JsonRpc/NewsService.php
  5. 65 0
      app/JsonRpc/NewsServiceInterface.php
  6. 0 99
      app/JsonRpc/PublicRpcService.php
  7. 0 30
      app/JsonRpc/PublicRpcServiceInterface.php
  8. 0 408
      app/JsonRpc/WebsiteService.php
  9. 0 119
      app/JsonRpc/WebsiteServiceInterface.php
  10. 2 2
      app/Model/Article.php
  11. 2 2
      app/Model/ArticleData.php
  12. 2 2
      app/Model/Category.php
  13. 0 27
      app/Model/Website.php
  14. 0 27
      app/Model/WebsiteColumn.php
  15. 0 27
      app/Model/WebsiteRole.php
  16. 0 27
      app/Model/WebsiteRoleUser.php
  17. 7 7
      composer.lock
  18. 1 1
      config/autoload/server.php
  19. 0 0
      runtime/container/classes.cache
  20. 0 0
      runtime/container/scan.cache
  21. 1 1
      runtime/hyperf.pid
  22. 330 0
      runtime/logs/hyperf.log
  23. 5 13
      vendor/composer/autoload_classmap.php
  24. 5 13
      vendor/composer/autoload_static.php
  25. 8 8
      vendor/composer/installed.json
  26. 3 3
      vendor/composer/installed.php
  27. 7 7
      vendor/hyperf/di/composer.json
  28. 5 0
      vendor/hyperf/di/src/Annotation/AbstractAnnotation.php
  29. 7 0
      vendor/hyperf/di/src/Annotation/AbstractMultipleAnnotation.php
  30. 23 0
      vendor/hyperf/di/src/Annotation/AnnotationCollector.php
  31. 5 0
      vendor/hyperf/di/src/Annotation/AnnotationInterface.php
  32. 8 1
      vendor/hyperf/di/src/Annotation/AnnotationReader.php
  33. 5 0
      vendor/hyperf/di/src/Annotation/MultipleAnnotation.php
  34. 21 24
      vendor/hyperf/di/src/Annotation/Scanner.php
  35. 2 4
      vendor/hyperf/di/src/Aop/Ast.php
  36. 17 1
      vendor/hyperf/di/src/Aop/ProxyCallVisitor.php
  37. 1 1
      vendor/hyperf/di/src/ClassLoader.php
  38. 1 1
      vendor/hyperf/di/src/LazyLoader/AbstractLazyProxyBuilder.php

+ 2 - 2
.env

@@ -1,8 +1,8 @@
-APP_NAME=user_producer
+APP_NAME=news_producer
 APP_ENV=dev
 
 DB_DRIVER=mysql
-DB_HOST=192.168.31.193
+DB_HOST=192.168.1.193
 DB_PORT=2333
 DB_DATABASE=hyperf
 DB_USERNAME=root

+ 0 - 41
.gitignore

@@ -1,41 +0,0 @@
-<?php
-namespace App\JsonRpc;
-use App\Model\District;
-use Hyperf\RpcServer\Annotation\RpcService;
-use App\Tools\Result;
-#[RpcService(name: "DistrictService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
-class DistrictService implements DistrictServiceInterface
-{
-
-    /**
-     * @param int $id
-     * @return array
-     */
-    public function getDistrictInfo(int $id): array
-    {
-        $adInfo = District::query()->find($id);
-        if (empty($adInfo)) {
-            return Result::error("没有数据",0);
-        }
-        return Result::success($adInfo->toArray());
-    }
-
-    /**
-     * @param string $keyword
-     * @param int $page
-     * @param int $pageSize
-     * @return array
-     */
-    public function getDistrictList(string $keyword, int $pid=0): array
-    {
-        $where  = [
-            ['name','like','%'.$keyword.'%'],
-            ['pid','=',$pid],
-        ];
-        $districtList =  District::where($where)->get();
-        if (empty($districtList)) {
-            return Result::error("没有数据",0);
-        }
-        return Result::success($districtList->toArray());
-    }
-}

+ 0 - 19
app/JsonRpc/DistrictServiceInterface.php

@@ -1,19 +0,0 @@
-<?php
-
-namespace App\JsonRpc;
-interface DistrictServiceInterface
-{
-
-
-    /**
-     * @param int $id
-     * @return array
-     */
-    public function getDistrictInfo(int $id): array;
-
-    /**
-     * @param string $keyword
-     * @param int $pid
-     */
-    public function getDistrictList(string $keyword,int $pid):array;
-}

+ 222 - 0
app/JsonRpc/NewsService.php

@@ -0,0 +1,222 @@
+<?php
+namespace App\JsonRpc;
+
+use App\Model\Article;
+use App\Model\ArticleData;
+use App\Model\Category;
+use Hyperf\DbConnection\Db;
+use Hyperf\RpcServer\Annotation\RpcService;
+use App\Tools\Result;
+
+#[RpcService(name: "NewsService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
+class NewsService implements NewsServiceInterface
+{
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getCategoryList(array $data): array
+    {
+        $where = [
+            ['name','like','%'.$data['keyWord'].'%'],
+            ['website_id','=',$data['website_id']],
+            ['pid','=',$data['pid']??0]
+        ];
+        $rep = Category::where($where)->limit($data['pageSize'])->orderBy("sort","asc")->offset(($data['page']-1)*$data['pageSize'])->get();
+        $count =  Category::where($where)->count();
+        $data = [
+            'rows'=>$rep->toArray(),
+            'count'=>$count
+        ];
+        if(empty($rep->toArray())){
+            return Result::error("没有栏目数据");
+        }
+        return Result::success($data);
+    }
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function categoryList(array $data): array
+    {
+       $result =  Category::where($data)->get();
+        if(empty($result)){
+            return Result::error("没有栏目数据");
+        }
+        return Result::success($result);
+    }
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function addCategory(array $data): array
+    {
+        $id = Category::insertGetId($data);
+        if(empty($id)){
+            return Result::error("添加失败");
+        }
+        return Result::success(['id'=>$id]);
+    }
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function delCategory(array $data): array
+    {
+        $categoryList = Category::where(['pid'=>$data['id']])->get();
+        var_dump("分类列表:",$data,$categoryList);
+        if($categoryList->toArray()){
+            return Result::error("分类下面有子分类不能删除");
+        }
+        $articleList = Article::where(['catid'=>$data['id']])->get();
+        var_dump("文章列表:",$articleList);
+        if($articleList->toArray()){
+            return Result::error("分类下面有资讯不能删除");
+        }
+        $result = Category::where($data)->delete();
+        if(!$result){
+            return Result::error("删除失败");
+        }
+        return Result::success($result);
+    }
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function updateCategory(array $data): array
+    {
+        $where = [
+            'id'=>$data['id']
+        ];
+        $result = Category::where($where)->update($data);
+        if($result){
+            return Result::success($result);
+        }else{
+            return Result::error("更新失败");
+        }
+    }
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getArticleList(array $data): array
+    {
+        var_dump("资讯:",$data);
+        $where= [];
+        if(isset($data['keyWord'])){
+            $where[] =   ['article.title','like','%'.$data['keyWord'].'%'];
+            $where[] =   ['article.status','!=','5'];
+        }
+        $rep = Article::where($where)
+            ->leftJoin('category','article.catid','category.id')
+            ->leftJoin("article_data","article.id","article_data.article_id")
+            ->select("article.*","category.name","article_data.content")
+            ->orderBy("article.id","desc")
+            ->limit($data['pageSize'])
+            ->offset(($data['page']-1)*$data['pageSize'])->get();
+        $count =  Article::where($where)->count();
+        $data = [
+            'rows'=>$rep->toArray(),
+            'count'=>$count
+        ];
+        if(empty($rep)){
+            return Result::error("没有信息数据");
+        }
+        return Result::success($data);
+    }
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function addArticle(array $data): array
+    {
+        Db::beginTransaction();
+        try{
+
+        $data['cat_arr_id'] = isset($data['cat_arr_id'])?json_encode($data['cat_arr_id']):'';
+        $data['tag'] = isset($data['tag'])?json_encode($data['tag']):'';
+            $articleData = $data;
+            unset($articleData['content']);
+            $id = Article::insertGetId($articleData);
+            $articleDataContent = [
+                'article_id'=>$id,
+                'content'=>$data['content']
+            ];
+            ArticleData::insertGetId($articleDataContent);
+            Db::commit();
+        } catch(\Throwable $ex){
+            Db::rollBack();
+            var_dump($ex->getMessage());
+            return Result::error("创建失败",0);
+        }
+
+        return Result::success(['id'=>$id]);
+    }
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function delArticle(array $data): array
+    {
+        $result = Article::where($data)->update(['status'=>5]);
+        if(!$result){
+            return Result::error("删除失败");
+        }
+        return Result::success($result);
+    }
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function updateArticle(array $data): array
+    {
+        Db::beginTransaction();
+        try{
+            $data['cat_arr_id'] = isset($data['cat_arr_id'])?json_encode($data['cat_arr_id']):'';
+            $data['tag'] = isset($data['tag'])?json_encode($data['tag']):'';
+            $articleData = $data;
+            unset($articleData['content']);
+            unset($articleData['status_name']);
+            unset($articleData['name']);
+            unset($articleData['content']);
+            unset($articleData['pid_arr']);
+            unset($articleData['pid']);
+            $id = Article::where(['id'=>$data['id']])->update($articleData);
+            $articleDataContent = [
+                'content'=>$data['content']
+            ];
+            ArticleData::where(['article_id'=>$data['id']])->update($articleDataContent);
+        } catch(\Throwable $ex){
+            Db::rollBack();
+            var_dump($ex->getMessage());
+            return Result::error("更新失败",0);
+        }
+        return Result::success([]);
+
+    }
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getArticleInfo(array $data): array
+    {
+        $where = [
+            'article.id'=>$data['id']
+        ];
+        $result = Article::where($where)->leftJoin("article_data","article.id","article_data.article_id")->first();
+        if($result){
+            return Result::success($result->toArray());
+        }else{
+            return Result::error("查询失败",0);
+        }
+    }
+}

+ 65 - 0
app/JsonRpc/NewsServiceInterface.php

@@ -0,0 +1,65 @@
+<?php
+namespace App\JsonRpc;
+interface NewsServiceInterface
+{
+    /**
+     * @param array $data
+     *  @return array
+    */
+    public function getCategoryList(array $data):array;
+    /**
+     * @param array $data
+     *  @return array
+     */
+    public function categoryList(array $data):array;
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function addCategory(array $data):array;
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function delCategory(array $data):array;
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function updateCategory(array $data):array;
+
+    /**
+     * @param string $keyword
+     * @param int $page
+     * @param int $pageSize
+     */
+    public function getArticleList(array $data):array;
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function addArticle(array $data):array;
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function delArticle(array $data):array;
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function updateArticle(array $data):array;
+
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getArticleInfo(array $data):array;
+
+}

+ 0 - 99
app/JsonRpc/PublicRpcService.php

@@ -1,99 +0,0 @@
-<?php
-namespace App\JsonRpc;
-use App\Model\District;
-use App\Model\LevelUser;
-use Hyperf\RpcServer\Annotation\RpcService;
-use App\Tools\Result;
-#[RpcService(name: "PublicRpcService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
-class PublicRpcService implements PublicRpcServiceInterface
-{
-
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function getDistrictList(array $data): array
-    {
-        $where = [
-            ['name','like','%'.$data['keyWord'].'%']
-        ];
-        $result  = [];
-        if(isset($data['pageSize'])){
-            $rep = District::where($where)->limit($data['pageSize'])->offset(($data['page']-1)*$data['pageSize'])->orderBy("code","asc")->get();
-            $count = District::where($where)->count();
-            $result = [
-                'rows'=>$rep,
-                'count'=>$count
-            ];
-        }else{
-            $result = District::where($data)->orderBy("code","asc")->get();
-        }
-
-        return $result?Result::success($result):Result::error("没有查到数据");
-    }
-
-
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function getUserLevelList(array $data): array
-    {
-        var_dump("关键词:",$data['keyWord']);
-        $where = [
-            ['name','like','%'.$data['keyWord'].'%']
-        ];
-        $result = [];
-        if(isset($data['pageSize'])){
-            $rep = LevelUser::where($where)->limit($data['pageSize'])->offset(($data['page']-1)*$data['pageSize'])->orderBy("id","asc")->get();
-            $count = LevelUser::where($where)->count();
-            $result = [
-                'rows'=>$rep,
-                'count'=>$count
-            ];
-        }else{
-            $result = LevelUser::orderBy("id","asc")->get();
-        }
-        return $result?Result::success($result):Result::error("没有查到数据");
-    }
-
-    /**
-     * 添加用户等级
-     * @param array $data
-     * @return array
-     */
-    public function addUserLevel(array $data) :array
-    {
-        LevelUser::insertGetId($data);
-        return Result::success([]);
-    }
-    /**
-     * 更新等级
-     * @param array $data
-     * @return array
-     */
-    public function updateUserLevel(array $data) :array
-    {
-
-        $result = LevelUser::where(['id'=>$data['id']])->update($data);
-        if ($result) {
-            return Result::success($result);
-        }
-        return  Result::error("更新失败");
-    }
-
-    /**
-     * 删除等级
-     * @param array $data
-     * @return array
-     */
-    public function delUserLevel(array $data) :array
-    {
-
-        $result = LevelUser::where(['id'=>$data['id']])->delete();
-        if ($result) {
-            return Result::success($result);
-        }
-        return  Result::error("删除失败");
-    }
-}

+ 0 - 30
app/JsonRpc/PublicRpcServiceInterface.php

@@ -1,30 +0,0 @@
-<?php
-namespace App\JsonRpc;
-interface PublicRpcServiceInterface
-{
-    /**
-     * @param array $data
-     */
-    public function getDistrictList(array $data): array;
-    /**
-     * @param array $data
-     */
-    public function getUserLevelList(array $data): array;
-
-    /**
-     * @param array $data
-     */
-    public function addUserLevel(array $data) :array;
-
-    /**
-     * @param array $data
-     */
-    public function delUserLevel(array $data) :array;
-
-    /**
-     * @param array $data
-     */
-    public function updateUserLevel(array $data) :array;
-
-
-}

+ 0 - 408
app/JsonRpc/WebsiteService.php

@@ -1,408 +0,0 @@
-<?php
-namespace App\JsonRpc;
-use App\Model\WebsiteRole;
-use App\Model\WebsiteRoleUser;
-use App\Model\Website;
-use App\Model\WebsiteColumn;
-use Hyperf\RpcServer\Annotation\RpcService;
-use App\Tools\Result;
-use function PHPUnit\Framework\isNull;
-
-#[RpcService(name: "WebsiteService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
-class WebsiteService implements WebsiteServiceInterface
-{
-    /**
-     * @param string $keyword
-     * @param int $page
-     * @param int $pageSize
-     * @return array
-     */
-    public function getWebsitetList(string $keyword,int $page,int $pageSize):array
-    {
-        $where = [
-            ['website.website_name','like','%'.$keyword.'%']
-        ];
-        $result = Website::where($where)
-            ->leftJoin("website_column","website.website_column_id","website_column.id")
-            ->leftJoin("district","district.id","website.city_id")
-            ->select("website.*","website_column.column_name","district.name")
-            ->limit($pageSize)->offset(($page-1)*$pageSize)->get();
-        $count = Website::where($where)->count();
-        if (empty($result)) {
-            return Result::error("没有数据",0);
-        }
-        $data = [
-            'rows'=>$result->toArray(),
-            'count'=>$count
-        ];
-        return Result::success($data);
-    }
-
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function createWebsite(array $data): array
-    {
-        $insertData = [
-            'website_name'=>$data['website_name'],
-            'logo'=>$data['logo']??'',
-            'website_url'=>$data['website_url']??'',
-            'city_id'=>$data['city_id']??0,
-            'website_column_id'=>$data['website_column_id'],
-            'title'=>$data['title']??'',
-            'keywords'=>$data['keywords']??'',
-            'description'=>$data['description']??'',
-            'status'=>$data['status']??0,
-            'website_column_arr_id'=>$data['website_column_arr_id'],
-            'city_arr_id'=>$data['city_arr_id']??[0],
-        ];
-        $result = Website::insertGetId($insertData);
-        if(empty($result)){
-            return Result::error("创建失败",0);
-        }else{
-            return Result::success(["id"=>$result]);
-        }
-    }
-
-    /**
-     * @param int $id
-     * @param array $data
-     * @return array
-     */
-    public function updateWebsite(int $id,array $data): array
-    {
-        $insertData = [
-            'website_name'=>$data['website_name'],
-            'logo'=>$data['logo']??'',
-            'website_url'=>$data['website_url']??'',
-            'city_id'=>$data['city_id']??0,
-            'website_column_id'=>$data['website_column_id'],
-            'title'=>$data['title']??'',
-            'keywords'=>$data['keywords']??'',
-            'description'=>$data['description']??'',
-            'status'=>$data['status']??0,
-            'website_column_arr_id'=>$data['website_column_arr_id'],
-            'city_arr_id'=>$data['city_arr_id']??[0],
-        ];
-        $result = Website::where('id',$id)->update($insertData);
-        var_dump("更新站点",$result);
-        if(empty($result)){
-            return Result::error("更新失败",0);
-        }else{
-            return Result::success();
-        }
-    }
-
-    /**
-     * @param int $id
-     * @return array
-     */
-    public function delWebsite(int $id): array
-    {
-        $result = Website::where('id',$id )->delete();
-        var_dump("删除站点",$result);
-        if(empty($result)){
-            return Result::error("删除失败",0);
-        }else{
-            return Result::success();
-        }
-    }
-
-    /**
-     * @param int $id
-     * @return array
-     */
-    public function getWebsiteInfo(int $id): array
-    {
-        $result = Website::where('id',$id )->first();
-        if(empty($result)){
-            return Result::error("数据不存在",0);
-        }else{
-            return Result::success($result->toArray());
-        }
-
-    }
-
-    /**
-     * 查询所有的站点栏目
-     * @return array
-     */
-    public function getWebsiteColumn(array $data): array
-    {
-        $result = WebsiteColumn::where($data)->get();
-        if(empty($result)){
-            return Result::error("数据不存在",0);
-        }else{
-            return Result::success($result->toArray());
-        }
-
-    }
-
-
-    /**
-     * @param string $keyword
-     * @param int $page
-     * @param int $pageSize
-     * @return array
-     */
-    public function getWebsiteColumnList(string $keyword,int $page,int $pageSize):array
-    {
-        $where = [
-            ['website_column.column_name','like','%'.$keyword.'%']
-        ];
-        $result = WebsiteColumn::where($where)
-            ->leftJoin("website_column as wc","website_column.pid","wc.id")
-            ->select("website_column.*","wc.column_name as parent_column_name")
-            ->limit($pageSize)->offset(($page-1)*$pageSize)->get();
-        $count = WebsiteColumn::where($where)->count();
-        if (empty($result)) {
-            return Result::error("没有数据",0);
-        }
-        $data = [
-            'rows'=>$result->toArray(),
-            'count'=>$count
-        ];
-        return Result::success($data);
-    }
-
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function createWebsiteColumn(array $data): array
-    {
-        $insertData = [
-            'column_name'=>$data['column_name'],
-            'pid'=>$data['pid']??'',
-            'column_arr_id'=>$data['column_arr_id']??[0],
-            'sort'=>$data['sort']??0,
-            'remark'=>$data['remark']??'',
-        ];
-        $result = WebsiteColumn::insertGetId($insertData);
-        if(empty($result)){
-            return Result::error("创建失败",0);
-        }else{
-            return Result::success(["id"=>$result]);
-        }
-    }
-
-    /**
-     * @param int $id
-     * @param array $data
-     * @return array
-     */
-    public function updateWebsiteColumn(int $id,array $data): array
-    {
-        $insertData = [
-            'column_name'=>$data['column_name'],
-            'pid'=>$data['pid']??'',
-            'column_arr_id'=>$data['column_arr_id']??[0],
-            'sort'=>$data['sort']??0,
-            'remark'=>$data['remark']??'',
-        ];
-        $result = WebsiteColumn::where('id',$id)->update($insertData);
-        if(empty($result)){
-            return Result::error("更新失败",0);
-        }else{
-            return Result::success();
-        }
-    }
-
-    /**
-     * @param int $id
-     * @return array
-     */
-    public function delWebsiteColumn(int $id): array
-    {
-        $result = WebsiteColumn::where('id',$id )->delete();
-        if(empty($result)){
-            return Result::error("删除失败",0);
-        }else{
-            return Result::success();
-        }
-    }
-
-    /**
-     * @param string $keyword
-     * @param int $page
-     * @param int $pageSize
-     * @return array
-     */
-    public function getWebsiteRoleList(string $keyword,int $page,int $pageSize,int $websiteId):array
-    {
-        $where = [
-            ['role.role_name','like','%'.$keyword.'%'],
-            ['website_role.website_id','=',$websiteId],
-        ];
-        $result = WebsiteRole::where($where)
-            ->leftJoin("role","role.id","website_role.role_id")
-            ->select("role.*","website_role.type","website_role.role_id","website_role.id as website_role_id","website_role.website_id")
-            ->limit($pageSize)->offset(($page-1)*$pageSize)->get();
-        $count = WebsiteRole::where($where) ->leftJoin("role","role.id","website_role.role_id")->count();
-        if (empty($result)) {
-            return Result::error("没有数据",0);
-        }
-        $data = [
-            'rows'=>$result->toArray(),
-            'count'=>$count
-        ];
-        return Result::success($data);
-    }
-
-
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function createWebsiteRole(array $data): array
-    {
-
-        $insertData = [
-            'website_id'=>$data['website_id'],
-            'role_id'=>$data['role_id']??''
-        ];
-        $info = WebsiteRole::where($insertData)->first();
-        if($info){
-            return Result::error("不能重复添加角色",0);
-        }
-        $insertData['admin_user_id'] = $data['admin_user_id']??'';
-        $insertData['type'] = $data['type']??'';
-        $result = WebsiteRole::insertGetId($insertData);
-        if(empty($result)){
-            return Result::error("创建失败",0);
-        }else{
-            return Result::success(["id"=>$result]);
-        }
-    }
-
-    /**
-     * 暂时用不上
-     * @param int $id
-     * @param array $data
-     * @return array
-     */
-    public function updateWebsiteRole(int $id,array $data): array
-    {
-        $insertData = [
-            'website_id'=>$data['website_id'],
-            'type'=>$data['type']??'',
-        ];
-        $result = WebsiteRole::where('id',$id)->update($insertData);
-        if(empty($result)){
-            return Result::error("更新失败",0);
-        }else{
-            return Result::success();
-        }
-    }
-
-    /**
-     * @param int $id
-     * @return array
-     */
-    public function delWebsiteRole(int $id): array
-    {
-        $result = WebsiteRole::where('id',$id )->delete();
-        if(empty($result)){
-            return Result::error("删除失败",0);
-        }else{
-            return Result::success();
-        }
-    }
-
-
-    /**
-     * @param string $keyword
-     * @param int $page
-     * @param int $pageSize
-     * @return array
-     */
-    public function getWebsiteRoleUserList(string $keyword,int $page,int $pageSize,int $websiteId,int $roleId):array
-    {
-        $where = [
-            ['website_role_user.website_id','=',$websiteId],
-            ['website_role_user.role_id','=',$roleId],
-        ];
-        $count = WebsiteRoleUser::where($where)->count();
-       $where[] =   ['u.user_name','like','%'.$keyword.'%'];
-        $result = WebsiteRoleUser::where($where)
-            ->leftJoin("user as u","website_role_user.user_id","u.id")
-            ->leftJoin("website as w","website_role_user.website_id","u.id")
-            ->leftJoin("role as r","website_role_user.role_id","r.id")
-            ->select("u.*","u.user_name",'w.website_name','r.role_name','website_role_user.id as website_role_user_id','website_role_user.updated_at as user_update_at')
-            ->limit($pageSize)->offset(($page-1)*$pageSize)->get();
-
-        if (empty($result)) {
-            return Result::error("没有数据",0);
-        }
-        $data = [
-            'rows'=>$result->toArray(),
-            'count'=>$count
-        ];
-        return Result::success($data);
-    }
-
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function createWebsiteRoleUser(array $data): array
-    {
-        var_dump($data);
-        $insertData = [
-            'website_id'=>$data['website_id'],
-            'user_id'=>$data['user_id']??'',
-            'role_id'=>$data['role_id']??'',
-            'admin_user_id'=>$data['admin_user_id']??'',
-        ];
-        $info = WebsiteRoleUser::where($insertData)->first();
-        if($info){
-            return Result::error("不能重复添加角色用户",0);
-        }
-        $insertData['type'] = $data['type']??'';
-        $result = WebsiteRoleUser::insertGetId($insertData);
-        if(empty($result)){
-            return Result::error("创建失败",0);
-        }else{
-            return Result::success(["id"=>$result]);
-        }
-    }
-
-    /**
-     * @param int $id
-     * @param array $data
-     * @return array
-     */
-    public function updateWebsiteRoleUser(int $id,array $data): array
-    {
-        $insertData = [
-            'website_id'=>$data['website_id'],
-            'type'=>$data['type']??'',
-            'type_id'=>$data['type_id']??'',
-            'role_id'=>$data['role_id']??'',
-        ];
-        $result = WebsiteRoleUser::where('id',$id)->update($insertData);
-        if(empty($result)){
-            return Result::error("更新失败",0);
-        }else{
-            return Result::success();
-        }
-    }
-
-    /**
-     * @param int $id
-     * @return array
-     */
-    public function delWebsiteRoleUser(int $id): array
-    {
-        $result = WebsiteRoleUser::where('id',$id )->delete();
-        if(empty($result)){
-            return Result::error("删除失败",0);
-        }else{
-            return Result::success();
-        }
-    }
-
-
-
-}

+ 0 - 119
app/JsonRpc/WebsiteServiceInterface.php

@@ -1,119 +0,0 @@
-<?php
-namespace App\JsonRpc;
-interface WebsiteServiceInterface
-{
-    /**
-     * @param string $keyword
-     * @param int $page
-     * @param int $pageSize
-     */
-    public function getWebsitetList(string $keyword,int $page,int $pageSize):array;
-
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function createWebsite(array $data):array;
-
-    /**
-     * @param int $id
-     * @param array $data
-     * @return array
-     */
-    public function updateWebsite(int $id,array $data):array;
-
-    /**
-     * @param int $id
-     * @return array
-     */
-    public function delWebsite(int $id):array;
-
-    /**
-     * 查询网站信息
-     * @param int $id
-     * @return array
-     */
-    public function getWebsiteInfo(int $id):array;
-
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function getWebsiteColumn(array $data):array;
-
-    /**
-     * @param string $keyword
-     * @param int $page
-     * @param int $pageSize
-     */
-    public function getWebsiteColumnList(string $keyword,int $page,int $pageSize):array;
-
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function createWebsiteColumn(array $data):array;
-
-    /**
-     * @param int $id
-     * @param array $data
-     * @return array
-     */
-    public function updateWebsiteColumn(int $id,array $data):array;
-
-    /**
-     * @param int $id
-     * @return array
-     */
-    public function delWebsiteColumn(int $id):array;
-    /**
-     * @param string $keyword
-     * @param int $page
-     * @param int $pageSize
-     */
-    public function getWebsiteRoleList(string $keyword,int $page,int $pageSize,int $websiteId):array;
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function createWebsiteRole(array $data):array;
-
-    /**
-     * @param int $id
-     * @param array $data
-     * @return array
-     */
-    public function updateWebsiteRole(int $id,array $data):array;
-
-    /**
-     * @param int $id
-     * @return array
-     */
-    public function delWebsiteRole(int $id):array;
-    /**
-     * @param string $keyword
-     * @param int $page
-     * @param int $pageSize
-     */
-    public function getWebsiteRoleUserList(string $keyword,int $page,int $pageSize,int $websiteId,int $roleId):array;
-
-    /**
-     * @param array $data
-     * @return array
-     */
-    public function createWebsiteRoleUser(array $data):array;
-
-    /**
-     * @param int $id
-     * @param array $data
-     * @return array
-     */
-    public function updateWebsiteRoleUser(int $id,array $data):array;
-
-    /**
-     * @param int $id
-     * @return array
-     */
-    public function delWebsiteRoleUser(int $id):array;
-
-}

+ 2 - 2
app/Model/Menu.php → app/Model/Article.php

@@ -8,12 +8,12 @@ use Hyperf\DbConnection\Model\Model;
 
 /**
  */
-class Menu extends Model
+class Article extends Model
 {
     /**
      * The table associated with the model.
      */
-    protected ?string $table = 'menu';
+    protected ?string $table = 'article';
 
     /**
      * The attributes that are mass assignable.

+ 2 - 2
app/Model/LevelUser.php → app/Model/ArticleData.php

@@ -8,12 +8,12 @@ use Hyperf\DbConnection\Model\Model;
 
 /**
  */
-class LevelUser extends Model
+class ArticleData extends Model
 {
     /**
      * The table associated with the model.
      */
-    protected ?string $table = 'user_level';
+    protected ?string $table = 'article_data';
 
     /**
      * The attributes that are mass assignable.

+ 2 - 2
app/Model/District.php → app/Model/Category.php

@@ -8,12 +8,12 @@ use Hyperf\DbConnection\Model\Model;
 
 /**
  */
-class District extends Model
+class Category extends Model
 {
     /**
      * The table associated with the model.
      */
-    protected ?string $table = 'district';
+    protected ?string $table = 'category';
 
     /**
      * The attributes that are mass assignable.

+ 0 - 27
app/Model/Website.php

@@ -1,27 +0,0 @@
-<?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 = [];
-}

+ 0 - 27
app/Model/WebsiteColumn.php

@@ -1,27 +0,0 @@
-<?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 = ["column_name"];
-
-    /**
-     * The attributes that should be cast to native types.
-     */
-    protected array $casts = [];
-}

+ 0 - 27
app/Model/WebsiteRole.php

@@ -1,27 +0,0 @@
-<?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 = [];
-}

+ 0 - 27
app/Model/WebsiteRoleUser.php

@@ -1,27 +0,0 @@
-<?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 = [];
-}

+ 7 - 7
composer.lock

@@ -1963,16 +1963,16 @@
         },
         {
             "name": "hyperf/di",
-            "version": "v3.1.15",
+            "version": "v3.1.28",
             "source": {
                 "type": "git",
                 "url": "https://github.com/hyperf/di.git",
-                "reference": "681120f158739bde07dc5c761e11be56e8d07109"
+                "reference": "6ffef4c7ff0d59380fa1d894ec278054b87c17cb"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/hyperf/di/zipball/681120f158739bde07dc5c761e11be56e8d07109",
-                "reference": "681120f158739bde07dc5c761e11be56e8d07109",
+                "url": "https://api.github.com/repos/hyperf/di/zipball/6ffef4c7ff0d59380fa1d894ec278054b87c17cb",
+                "reference": "6ffef4c7ff0d59380fa1d894ec278054b87c17cb",
                 "shasum": ""
             },
             "require": {
@@ -1984,8 +1984,8 @@
                 "nikic/php-parser": "^4.1",
                 "php": ">=8.1",
                 "php-di/phpdoc-reader": "^2.2",
-                "psr/container": "^1.0|^2.0",
-                "symfony/finder": "^5.0|^6.0|^7.0",
+                "psr/container": "^1.0 || ^2.0",
+                "symfony/finder": "^5.0 || ^6.0 || ^7.0",
                 "vlucas/phpdotenv": "^5.0"
             },
             "suggest": {
@@ -2035,7 +2035,7 @@
                     "type": "open_collective"
                 }
             ],
-            "time": "2024-03-23T11:28:51+00:00"
+            "time": "2024-06-26T03:31:21+00:00"
         },
         {
             "name": "hyperf/dispatcher",

+ 1 - 1
config/autoload/server.php

@@ -20,7 +20,7 @@ return [
             'name' => 'jsonrpc-http',
             'type' => Server::SERVER_HTTP,
             'host' => '0.0.0.0',
-            'port' => 9502,
+            'port' => 9505,
             'sock_type' => SWOOLE_SOCK_TCP,
             'callbacks' => [
                 Event::ON_REQUEST => [Hyperf\JsonRpc\HttpServer::class, 'onRequest'],

File diff suppressed because it is too large
+ 0 - 0
runtime/container/classes.cache


File diff suppressed because it is too large
+ 0 - 0
runtime/container/scan.cache


+ 1 - 1
runtime/hyperf.pid

@@ -1 +1 @@
-1648
+141

File diff suppressed because it is too large
+ 330 - 0
runtime/logs/hyperf.log


+ 5 - 13
vendor/composer/autoload_classmap.php

@@ -11,22 +11,14 @@ return array(
     'App\\Controller\\IndexController' => $baseDir . '/app/Controller/IndexController.php',
     'App\\Exception\\Handler\\AppExceptionHandler' => $baseDir . '/app/Exception/Handler/AppExceptionHandler.php',
     'App\\Exception\\Handler\\JsonRpcExceptionHandler' => $baseDir . '/app/Exception/Handler/JsonRpcExceptionHandler.php',
-    'App\\JsonRpc\\DistrictService' => $baseDir . '/app/JsonRpc/DistrictService.php',
-    'App\\JsonRpc\\DistrictServiceInterface' => $baseDir . '/app/JsonRpc/DistrictServiceInterface.php',
-    'App\\JsonRpc\\PublicRpcService' => $baseDir . '/app/JsonRpc/PublicRpcService.php',
-    'App\\JsonRpc\\PublicRpcServiceInterface' => $baseDir . '/app/JsonRpc/PublicRpcServiceInterface.php',
-    'App\\JsonRpc\\WebsiteService' => $baseDir . '/app/JsonRpc/WebsiteService.php',
-    'App\\JsonRpc\\WebsiteServiceInterface' => $baseDir . '/app/JsonRpc/WebsiteServiceInterface.php',
+    'App\\JsonRpc\\NewsService' => $baseDir . '/app/JsonRpc/NewsService.php',
+    'App\\JsonRpc\\NewsServiceInterface' => $baseDir . '/app/JsonRpc/NewsServiceInterface.php',
     'App\\Listener\\DbQueryExecutedListener' => $baseDir . '/app/Listener/DbQueryExecutedListener.php',
     'App\\Listener\\ResumeExitCoordinatorListener' => $baseDir . '/app/Listener/ResumeExitCoordinatorListener.php',
-    'App\\Model\\District' => $baseDir . '/app/Model/District.php',
-    'App\\Model\\LevelUser' => $baseDir . '/app/Model/LevelUser.php',
-    'App\\Model\\Menu' => $baseDir . '/app/Model/Menu.php',
+    'App\\Model\\Article' => $baseDir . '/app/Model/Article.php',
+    'App\\Model\\ArticleData' => $baseDir . '/app/Model/ArticleData.php',
+    'App\\Model\\Category' => $baseDir . '/app/Model/Category.php',
     'App\\Model\\Model' => $baseDir . '/app/Model/Model.php',
-    'App\\Model\\Website' => $baseDir . '/app/Model/Website.php',
-    'App\\Model\\WebsiteColumn' => $baseDir . '/app/Model/WebsiteColumn.php',
-    'App\\Model\\WebsiteRole' => $baseDir . '/app/Model/WebsiteRole.php',
-    'App\\Model\\WebsiteRoleUser' => $baseDir . '/app/Model/WebsiteRoleUser.php',
     'App\\Tools\\Result' => $baseDir . '/app/Tools/Result.php',
     'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
     'CURLStringFile' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php',

+ 5 - 13
vendor/composer/autoload_static.php

@@ -695,22 +695,14 @@ class ComposerStaticInit88f2a4d4a4e81dc7d415bcdf39930654
         'App\\Controller\\IndexController' => __DIR__ . '/../..' . '/app/Controller/IndexController.php',
         'App\\Exception\\Handler\\AppExceptionHandler' => __DIR__ . '/../..' . '/app/Exception/Handler/AppExceptionHandler.php',
         'App\\Exception\\Handler\\JsonRpcExceptionHandler' => __DIR__ . '/../..' . '/app/Exception/Handler/JsonRpcExceptionHandler.php',
-        'App\\JsonRpc\\DistrictService' => __DIR__ . '/../..' . '/app/JsonRpc/DistrictService.php',
-        'App\\JsonRpc\\DistrictServiceInterface' => __DIR__ . '/../..' . '/app/JsonRpc/DistrictServiceInterface.php',
-        'App\\JsonRpc\\PublicRpcService' => __DIR__ . '/../..' . '/app/JsonRpc/PublicRpcService.php',
-        'App\\JsonRpc\\PublicRpcServiceInterface' => __DIR__ . '/../..' . '/app/JsonRpc/PublicRpcServiceInterface.php',
-        'App\\JsonRpc\\WebsiteService' => __DIR__ . '/../..' . '/app/JsonRpc/WebsiteService.php',
-        'App\\JsonRpc\\WebsiteServiceInterface' => __DIR__ . '/../..' . '/app/JsonRpc/WebsiteServiceInterface.php',
+        'App\\JsonRpc\\NewsService' => __DIR__ . '/../..' . '/app/JsonRpc/NewsService.php',
+        'App\\JsonRpc\\NewsServiceInterface' => __DIR__ . '/../..' . '/app/JsonRpc/NewsServiceInterface.php',
         'App\\Listener\\DbQueryExecutedListener' => __DIR__ . '/../..' . '/app/Listener/DbQueryExecutedListener.php',
         'App\\Listener\\ResumeExitCoordinatorListener' => __DIR__ . '/../..' . '/app/Listener/ResumeExitCoordinatorListener.php',
-        'App\\Model\\District' => __DIR__ . '/../..' . '/app/Model/District.php',
-        'App\\Model\\LevelUser' => __DIR__ . '/../..' . '/app/Model/LevelUser.php',
-        'App\\Model\\Menu' => __DIR__ . '/../..' . '/app/Model/Menu.php',
+        'App\\Model\\Article' => __DIR__ . '/../..' . '/app/Model/Article.php',
+        'App\\Model\\ArticleData' => __DIR__ . '/../..' . '/app/Model/ArticleData.php',
+        'App\\Model\\Category' => __DIR__ . '/../..' . '/app/Model/Category.php',
         'App\\Model\\Model' => __DIR__ . '/../..' . '/app/Model/Model.php',
-        'App\\Model\\Website' => __DIR__ . '/../..' . '/app/Model/Website.php',
-        'App\\Model\\WebsiteColumn' => __DIR__ . '/../..' . '/app/Model/WebsiteColumn.php',
-        'App\\Model\\WebsiteRole' => __DIR__ . '/../..' . '/app/Model/WebsiteRole.php',
-        'App\\Model\\WebsiteRoleUser' => __DIR__ . '/../..' . '/app/Model/WebsiteRoleUser.php',
         'App\\Tools\\Result' => __DIR__ . '/../..' . '/app/Tools/Result.php',
         'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
         'CURLStringFile' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php',

+ 8 - 8
vendor/composer/installed.json

@@ -2674,17 +2674,17 @@
         },
         {
             "name": "hyperf/di",
-            "version": "v3.1.15",
-            "version_normalized": "3.1.15.0",
+            "version": "v3.1.28",
+            "version_normalized": "3.1.28.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/hyperf/di.git",
-                "reference": "681120f158739bde07dc5c761e11be56e8d07109"
+                "reference": "6ffef4c7ff0d59380fa1d894ec278054b87c17cb"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/hyperf/di/zipball/681120f158739bde07dc5c761e11be56e8d07109",
-                "reference": "681120f158739bde07dc5c761e11be56e8d07109",
+                "url": "https://api.github.com/repos/hyperf/di/zipball/6ffef4c7ff0d59380fa1d894ec278054b87c17cb",
+                "reference": "6ffef4c7ff0d59380fa1d894ec278054b87c17cb",
                 "shasum": ""
             },
             "require": {
@@ -2696,15 +2696,15 @@
                 "nikic/php-parser": "^4.1",
                 "php": ">=8.1",
                 "php-di/phpdoc-reader": "^2.2",
-                "psr/container": "^1.0|^2.0",
-                "symfony/finder": "^5.0|^6.0|^7.0",
+                "psr/container": "^1.0 || ^2.0",
+                "symfony/finder": "^5.0 || ^6.0 || ^7.0",
                 "vlucas/phpdotenv": "^5.0"
             },
             "suggest": {
                 "ext-pcntl": "Required to scan annotations.",
                 "hyperf/config": "Require this component for annotation scan progress to retrieve the scan path."
             },
-            "time": "2024-03-23T11:28:51+00:00",
+            "time": "2024-06-26T03:31:21+00:00",
             "type": "library",
             "extra": {
                 "branch-alias": {

+ 3 - 3
vendor/composer/installed.php

@@ -347,9 +347,9 @@
             'dev_requirement' => true,
         ),
         'hyperf/di' => array(
-            'pretty_version' => 'v3.1.15',
-            'version' => '3.1.15.0',
-            'reference' => '681120f158739bde07dc5c761e11be56e8d07109',
+            'pretty_version' => 'v3.1.28',
+            'version' => '3.1.28.0',
+            'reference' => '6ffef4c7ff0d59380fa1d894ec278054b87c17cb',
             'type' => 'library',
             'install_path' => __DIR__ . '/../hyperf/di',
             'aliases' => array(),

+ 7 - 7
vendor/hyperf/di/composer.json

@@ -11,10 +11,10 @@
     ],
     "homepage": "https://hyperf.io",
     "support": {
-        "docs": "https://hyperf.wiki",
         "issues": "https://github.com/hyperf/hyperf/issues",
-        "pull-request": "https://github.com/hyperf/hyperf/pulls",
-        "source": "https://github.com/hyperf/hyperf"
+        "source": "https://github.com/hyperf/hyperf",
+        "docs": "https://hyperf.wiki",
+        "pull-request": "https://github.com/hyperf/hyperf/pulls"
     },
     "require": {
         "php": ">=8.1",
@@ -25,13 +25,13 @@
         "hyperf/support": "~3.1.0",
         "nikic/php-parser": "^4.1",
         "php-di/phpdoc-reader": "^2.2",
-        "psr/container": "^1.0|^2.0",
-        "symfony/finder": "^5.0|^6.0|^7.0",
+        "psr/container": "^1.0 || ^2.0",
+        "symfony/finder": "^5.0 || ^6.0 || ^7.0",
         "vlucas/phpdotenv": "^5.0"
     },
     "suggest": {
-        "hyperf/config": "Require this component for annotation scan progress to retrieve the scan path.",
-        "ext-pcntl": "Required to scan annotations."
+        "ext-pcntl": "Required to scan annotations.",
+        "hyperf/config": "Require this component for annotation scan progress to retrieve the scan path."
     },
     "autoload": {
         "psr-4": {

+ 5 - 0
vendor/hyperf/di/src/Annotation/AbstractAnnotation.php

@@ -33,6 +33,11 @@ abstract class AbstractAnnotation implements AnnotationInterface, Arrayable
         AnnotationCollector::collectClass($className, static::class, $this);
     }
 
+    public function collectClassConstant(string $className, ?string $target): void
+    {
+        AnnotationCollector::collectClassConstant($className, $target, static::class, $this);
+    }
+
     public function collectMethod(string $className, ?string $target): void
     {
         AnnotationCollector::collectMethod($className, $target, static::class, $this);

+ 7 - 0
vendor/hyperf/di/src/Annotation/AbstractMultipleAnnotation.php

@@ -21,6 +21,13 @@ abstract class AbstractMultipleAnnotation extends AbstractAnnotation
         AnnotationCollector::collectClass($className, static::class, $this->formatAnnotation($annotation));
     }
 
+    public function collectClassConstant(string $className, ?string $target): void
+    {
+        $annotation = AnnotationCollector::getClassConstantAnnotation($className, $target)[static::class] ?? null;
+
+        AnnotationCollector::collectClassConstant($className, $target, static::class, $this->formatAnnotation($annotation));
+    }
+
     public function collectMethod(string $className, ?string $target): void
     {
         $annotation = AnnotationCollector::getClassMethodAnnotation($className, $target)[static::class] ?? null;

+ 23 - 0
vendor/hyperf/di/src/Annotation/AnnotationCollector.php

@@ -23,6 +23,11 @@ class AnnotationCollector extends MetadataCollector
         static::$container[$class]['_c'][$annotation] = $value;
     }
 
+    public static function collectClassConstant(string $class, string $constant, string $annotation, $value): void
+    {
+        static::$container[$class]['_cc'][$constant][$annotation] = $value;
+    }
+
     public static function collectProperty(string $class, string $property, string $annotation, $value): void
     {
         static::$container[$class]['_p'][$property][$annotation] = $value;
@@ -42,6 +47,19 @@ class AnnotationCollector extends MetadataCollector
         }
     }
 
+    public static function getClassConstantsByAnnotation(string $annotation): array
+    {
+        $result = [];
+        foreach (static::$container as $class => $metadata) {
+            foreach ($metadata['_cc'] ?? [] as $constant => $_metadata) {
+                if ($value = $_metadata[$annotation] ?? null) {
+                    $result[] = ['class' => $class, 'constant' => $constant, 'annotation' => $value];
+                }
+            }
+        }
+        return $result;
+    }
+
     public static function getClassesByAnnotation(string $annotation): array
     {
         $result = [];
@@ -90,6 +108,11 @@ class AnnotationCollector extends MetadataCollector
         return static::get($class . '._c');
     }
 
+    public static function getClassConstantAnnotation(string $class, string $constant)
+    {
+        return static::get($class . '._cc.' . $constant);
+    }
+
     public static function getClassMethodAnnotation(string $class, string $method)
     {
         return static::get($class . '._m.' . $method);

+ 5 - 0
vendor/hyperf/di/src/Annotation/AnnotationInterface.php

@@ -19,6 +19,11 @@ interface AnnotationInterface
      */
     public function collectClass(string $className): void;
 
+    /**
+     * Collect the annotation metadata to a container that you want.
+     */
+    public function collectClassConstant(string $className, ?string $target): void;
+
     /**
      * Collect the annotation metadata to a container that you want.
      */

+ 8 - 1
vendor/hyperf/di/src/Annotation/AnnotationReader.php

@@ -14,6 +14,7 @@ namespace Hyperf\Di\Annotation;
 
 use Hyperf\Di\Exception\NotFoundException;
 use ReflectionClass;
+use ReflectionClassConstant;
 use ReflectionMethod;
 use ReflectionProperty;
 use Reflector;
@@ -93,7 +94,7 @@ class AnnotationReader
                 continue;
             }
             if (! class_exists($attribute->getName())) {
-                $className = $methodName = $propertyName = '';
+                $className = $methodName = $propertyName = $classConstantName = '';
                 if ($reflection instanceof ReflectionClass) {
                     $className = $reflection->getName();
                 } elseif ($reflection instanceof ReflectionMethod) {
@@ -102,6 +103,9 @@ class AnnotationReader
                 } elseif ($reflection instanceof ReflectionProperty) {
                     $className = $reflection->getDeclaringClass()->getName();
                     $propertyName = $reflection->getName();
+                } elseif ($reflection instanceof ReflectionClassConstant) {
+                    $className = $reflection->getDeclaringClass()->getName();
+                    $classConstantName = $reflection->getName();
                 }
                 $message = sprintf(
                     "No attribute class found for '%s' in %s",
@@ -114,6 +118,9 @@ class AnnotationReader
                 if ($propertyName) {
                     $message .= sprintf('::$%s property', $propertyName);
                 }
+                if ($classConstantName) {
+                    $message .= sprintf('::%s class constant', $classConstantName);
+                }
                 throw new NotFoundException($message);
             }
             $result[] = $attribute->newInstance();

+ 5 - 0
vendor/hyperf/di/src/Annotation/MultipleAnnotation.php

@@ -60,6 +60,11 @@ class MultipleAnnotation implements MultipleAnnotationInterface
         throw new AnnotationException('MultipleAnnotation[' . $this->className() . '] does not support collectClass()');
     }
 
+    public function collectClassConstant(string $className, ?string $target): void
+    {
+        throw new AnnotationException('MultipleAnnotation[' . $this->className() . '] does not support collectClassConstant()');
+    }
+
     public function collectMethod(string $className, ?string $target): void
     {
         throw new AnnotationException('MultipleAnnotation[' . $this->className() . '] does not support collectMethod()');

+ 21 - 24
vendor/hyperf/di/src/Annotation/Scanner.php

@@ -33,7 +33,7 @@ class Scanner
         $this->filesystem = new Filesystem();
     }
 
-    public function collect(AnnotationReader $reader, ReflectionClass $reflection)
+    public function collect(AnnotationReader $reader, ReflectionClass $reflection): void
     {
         $className = $reflection->getName();
         if ($path = $this->scanConfig->getClassMap()[$className] ?? null) {
@@ -43,40 +43,37 @@ class Scanner
             }
         }
         // Parse class annotations
-        $classAnnotations = $reader->getClassAnnotations($reflection);
-        if (! empty($classAnnotations)) {
-            foreach ($classAnnotations as $classAnnotation) {
-                if ($classAnnotation instanceof AnnotationInterface) {
-                    $classAnnotation->collectClass($className);
-                }
+        foreach ($reader->getAttributes($reflection) as $classAnnotation) {
+            if ($classAnnotation instanceof AnnotationInterface) {
+                $classAnnotation->collectClass($className);
             }
         }
         // Parse properties annotations
-        $properties = $reflection->getProperties();
-        foreach ($properties as $property) {
-            $propertyAnnotations = $reader->getPropertyAnnotations($property);
-            if (! empty($propertyAnnotations)) {
-                foreach ($propertyAnnotations as $propertyAnnotation) {
-                    if ($propertyAnnotation instanceof AnnotationInterface) {
-                        $propertyAnnotation->collectProperty($className, $property->getName());
-                    }
+        foreach ($reflection->getProperties() as $property) {
+            foreach ($reader->getAttributes($property) as $propertyAnnotation) {
+                if ($propertyAnnotation instanceof AnnotationInterface) {
+                    $propertyAnnotation->collectProperty($className, $property->getName());
                 }
             }
         }
         // Parse methods annotations
-        $methods = $reflection->getMethods();
-        foreach ($methods as $method) {
-            $methodAnnotations = $reader->getMethodAnnotations($method);
-            if (! empty($methodAnnotations)) {
-                foreach ($methodAnnotations as $methodAnnotation) {
-                    if ($methodAnnotation instanceof AnnotationInterface) {
-                        $methodAnnotation->collectMethod($className, $method->getName());
-                    }
+        foreach ($reflection->getMethods() as $method) {
+            foreach ($reader->getAttributes($method) as $methodAnnotation) {
+                if ($methodAnnotation instanceof AnnotationInterface) {
+                    $methodAnnotation->collectMethod($className, $method->getName());
+                }
+            }
+        }
+        // Parse class constants annotations
+        foreach ($reflection->getReflectionConstants() as $classConstant) {
+            foreach ($reader->getAttributes($classConstant) as $constantAnnotation) {
+                if ($constantAnnotation instanceof AnnotationInterface) {
+                    $constantAnnotation->collectClassConstant($className, $classConstant->getName());
                 }
             }
         }
 
-        unset($reflection, $classAnnotations, $properties, $methods);
+        unset($reflection);
     }
 
     public function scan(array $classMap = [], string $proxyDir = ''): array

+ 2 - 4
vendor/hyperf/di/src/Aop/Ast.php

@@ -13,9 +13,7 @@ declare(strict_types=1);
 namespace Hyperf\Di\Aop;
 
 use Hyperf\Support\Composer;
-use PhpParser\Node\Stmt\Class_;
-use PhpParser\Node\Stmt\Enum_;
-use PhpParser\Node\Stmt\Interface_;
+use PhpParser\Node\Stmt\ClassLike;
 use PhpParser\Node\Stmt\Namespace_;
 use PhpParser\NodeTraverser;
 use PhpParser\Parser;
@@ -64,7 +62,7 @@ class Ast
             if ($stmt instanceof Namespace_ && $stmt->name) {
                 $namespace = $stmt->name->toString();
                 foreach ($stmt->stmts as $node) {
-                    if (($node instanceof Class_ || $node instanceof Interface_ || $node instanceof Enum_) && $node->name) {
+                    if (($node instanceof ClassLike) && $node->name) {
                         $className = $node->name->toString();
                         break;
                     }

+ 17 - 1
vendor/hyperf/di/src/Aop/ProxyCallVisitor.php

@@ -33,6 +33,7 @@ use PhpParser\Node\Scalar\MagicConst\Trait_ as MagicConstTrait;
 use PhpParser\Node\Scalar\String_;
 use PhpParser\Node\Stmt\Class_;
 use PhpParser\Node\Stmt\ClassMethod;
+use PhpParser\Node\Stmt\Enum_;
 use PhpParser\Node\Stmt\Expression;
 use PhpParser\Node\Stmt\Return_;
 use PhpParser\Node\Stmt\Trait_;
@@ -97,6 +98,8 @@ class ProxyCallVisitor extends NodeVisitorAbstract
                 return $this->rewriteMethod($node);
             case $node instanceof Trait_:
                 // If the node is trait and php version >= 7.3, it can `use ProxyTrait` like class.
+            case $node instanceof Enum_:
+                // If the node is enum and php version >= 8.1, it can `use ProxyTrait` like class.
             case $node instanceof Class_ && ! $node->isAnonymous():
                 // Add use proxy traits.
                 $stmts = $node->stmts;
@@ -176,7 +179,7 @@ class ProxyCallVisitor extends NodeVisitorAbstract
             new Arg($this->getArguments($node->getParams())),
             // A closure that wrapped original method code.
             new Arg(new Closure([
-                'params' => $node->getParams(),
+                'params' => $this->filterModifier($node->getParams()),
                 'uses' => [
                     new Variable('__function__'),
                     new Variable('__method__'),
@@ -194,6 +197,19 @@ class ProxyCallVisitor extends NodeVisitorAbstract
         return $node;
     }
 
+    /**
+     * @param Node\Param[] $params
+     * @return Node\Param[]
+     */
+    private function filterModifier(array $params): array
+    {
+        return array_map(function (Node\Param $param) {
+            $tempParam = clone $param;
+            $tempParam->flags &= ~Class_::VISIBILITY_MODIFIER_MASK & ~Class_::MODIFIER_READONLY;
+            return $tempParam;
+        }, $params);
+    }
+
     /**
      * @param Node\Param[] $params
      */

+ 1 - 1
vendor/hyperf/di/src/ClassLoader.php

@@ -32,7 +32,7 @@ class ClassLoader
         }
 
         if (! $configDir) {
-            // This dir is the default proxy file dir path of Hyperf
+            // This dir is the default config file dir path of Hyperf
             $configDir = BASE_PATH . '/config/';
         }
 

+ 1 - 1
vendor/hyperf/di/src/LazyLoader/AbstractLazyProxyBuilder.php

@@ -58,7 +58,7 @@ abstract class AbstractLazyProxyBuilder
         $this->originalClassName = $originalClassName;
         $this->builder = $this->factory->class(class_basename($proxyClassName))
             ->addStmt(new ClassConst([new Const_('PROXY_TARGET', new String_($originalClassName))]))
-            ->addStmt($this->factory->useTrait('\\Hyperf\\Di\\LazyLoader\\LazyProxyTrait'))
+            ->addStmt($this->factory->useTrait('\Hyperf\Di\LazyLoader\LazyProxyTrait'))
             ->setDocComment("/**
                               * Be careful: This is a lazy proxy, not the real {$originalClassName} from container.
                               *

Some files were not shown because too many files changed in this diff