Browse Source

添加热更新,修改jwt解析出user_id

rkljw 10 months ago
parent
commit
07dc715293

+ 23 - 0
.watcher.php

@@ -0,0 +1,23 @@
+<?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 Hyperf\Watcher\Driver\ScanFileDriver;
+
+return [
+    'driver' => ScanFileDriver::class,
+    'bin' => PHP_BINARY,
+    'watch' => [
+        'dir' => ['app', 'config'],
+        'file' => ['.env'],
+        'scan_interval' => 2000,
+    ],
+    'ext' => ['.php', '.env'],
+];

+ 12 - 1
app/Controller/AbstractController.php

@@ -15,9 +15,11 @@ namespace App\Controller;
 use Hyperf\Di\Annotation\Inject;
 use Hyperf\HttpServer\Contract\RequestInterface;
 use Hyperf\HttpServer\Contract\ResponseInterface;
+use Phper666\JWTAuth\JWT;
 use Psr\Container\ContainerInterface;
 use Hyperf\Logger\LoggerFactory;
 use Psr\Log\LoggerInterface;
+use http\Client\Request;
 
 abstract class AbstractController
 {
@@ -30,6 +32,8 @@ abstract class AbstractController
     #[Inject]
     protected ResponseInterface $response;
 
+    #[Inject]
+    protected JWT $jwt;
     protected LoggerInterface $logger;
 
     protected $UserId;
@@ -38,6 +42,13 @@ abstract class AbstractController
     {
         // 第一个参数对应日志的 name, 第二个参数对应 config/autoload/logger.php 内的 key
         $this->logger = $loggerFactory->get('admin_consumer:', 'default');
-        $this->UserId = "111";
+
+        $a= 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJwaHBlcjY2Ni9qd3QiLCJ1aWQiOjEsInVzZXJuYW1lIjoieHgiLCJqd3Rfc2NlbmUiOiJkZWZhdWx0IiwianRpIjoiZGVmYXVsdF82NjYyYTg5NTQ5MTk2MS40NTgzOTUyNCIsImlhdCI6MTcxNzc0MTcxNywibmJmIjoxNzE3NzQxNzE3LCJleHAiOjE3MTc3NDg5MTd9.cTqoaSn5P3mW8__O2O2rv2dxiGtfSZk-E8fisjHFwCg';
+        $headers = $this->request->getHeaders();
+        if($headers && $headers['token'][0]){
+            $userInfo = $this->jwt->getClaimsByToken($headers['token'][0]);
+            $this->UserId = $userInfo['uid'];
+        }
+
     }
 }

+ 3 - 4
app/Controller/LoginController.php

@@ -2,11 +2,8 @@
 declare(strict_types=1);
 namespace App\Controller;
 use \Phper666\JWTAuth\JWT;
-use Hyperf\HttpServer\Contract\RequestInterface as request;
 use Hyperf\Di\Annotation\Inject;
 use Hyperf\HttpServer\Annotation\AutoController;
-use Hyperf\HttpServer\Contract\RequestInterface;
-use Hyperf\HttpServer\Contract\ResponseInterface;
 use Hyperf\Validation\Contract\ValidatorFactoryInterface;
 use App\Tools\Result;
 use App\JsonRpc\UserServiceInterface;
@@ -27,6 +24,7 @@ class LoginController extends AbstractController
     private $userServiceClient;
     public function login(Jwt $jwt)
     {
+        $this->logger->info("验证之前");
         $reqData =  $this->request->all();
         $validator = $this->validationFactory->make(
             $reqData,
@@ -52,8 +50,9 @@ class LoginController extends AbstractController
                 'user_name'=>$reqData['username'],
             ];
         }
+        $this->logger->info("验证之前");
         $userInfos = $this->userServiceClient->verifyUserInfo($where);
-
+        $this->logger->info("验证用户返回值:", $userInfos);
         if(md5(md5($reqData['password']).$userInfos['data']['salt']) != $userInfos['data']['password']){
             return Result::error("用户名或密码错误");
         }

+ 908 - 0
app/Controller/UserController.php

@@ -82,6 +82,7 @@ class UserController extends AbstractController
      */
     public function getUserInfo()
     {
+        var_dump($this->UserId,"GGGGGGGGG");
         $requireData = $this->request->all();
         $validator = $this->validationFactory->make(
             $requireData,
@@ -103,6 +104,913 @@ class UserController extends AbstractController
         return Result::success($result['data']);
     }
 
+    public function getMenuList()
+    {
+        $data =
+            [
+                [
+                    "label"=> "工作台",
+                    "url"=> "/#/left/home",
+                    "action"=> "home",
+                    "children"=> [
+                        [
+                            "id"=> 773,
+                            "label"=> "商品列表-JAVA",
+                            "mark"=> "",
+                            "url"=> "/#/left/newGoodsList",
+                            "parent_id"=> 1,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 3
+                        ],
+                        [
+                            "id"=> 773,
+                            "label"=> "商品列表-JAVA",
+                            "mark"=> "",
+                            "url"=> "/#/left/newGoodsList",
+                            "parent_id"=> 1,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 3
+                        ],
+                        ]
+                ],
+                [
+                    "id"=> 1,
+                    "label"=> "商品",
+                    "mark"=> "",
+                    "url"=> "/#/left/newGoodsList",
+                    "parent_id"=> 0,
+                    "is_curr"=> false,
+                    "can_do"=> false,
+                    "sort"=> 1,
+                    "children"=> [
+                        [
+                            "id"=> 773,
+                            "label"=> "商品列表-JAVA",
+                            "mark"=> "",
+                            "url"=> "/#/left/newGoodsList",
+                            "parent_id"=> 1,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 3
+                        ],
+                        [
+                            "id"=> 402,
+                            "label"=> "点评列表",
+                            "mark"=> "",
+                            "url"=> "/#/left/goodsCommentList",
+                            "parent_id"=> 1,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 5
+                        ],
+                        [
+                            "id"=> 407,
+                            "label"=> "品牌列表",
+                            "mark"=> "",
+                            "url"=> "/#/left/brandList",
+                            "parent_id"=> 1,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 6
+                        ],
+                        [
+                            "id"=> 604,
+                            "label"=> "标准商品库",
+                            "mark"=> "0",
+                            "url"=> "/#/left/standardGoods/goodList",
+                            "parent_id"=> 1,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 7
+                        ],
+                        [
+                            "id"=> 821,
+                            "label"=> "商品通知图管理-Java",
+                            "mark"=> "",
+                            "url"=> "/#/left/goodsNoticeImg",
+                            "parent_id"=> 1,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 22
+                        ]
+                    ]
+                ],
+                [
+                    "id"=> 17,
+                    "label"=> "促销",
+                    "mark"=> "",
+                    "url"=> "/#/left/platformMarketingActivities",
+                    "parent_id"=> 0,
+                    "is_curr"=> false,
+                    "can_do"=> false,
+                    "sort"=> 2,
+                    "children"=> [
+                        [
+                            "id"=> 622,
+                            "label"=> "平台营销活动",
+                            "mark"=> "",
+                            "url"=> "/#/left/platformMarketingActivities",
+                            "parent_id"=> 17,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 16
+                        ],
+                        [
+                            "id"=> 28,
+                            "label"=> "优惠券",
+                            "mark"=> "",
+                            "url"=> "/#/coupons",
+                            "parent_id"=> 17,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 17
+                        ],
+                        [
+                            "id"=> 392,
+                            "label"=> "订单优惠",
+                            "mark"=> "",
+                            "url"=> "/seller/fullDiscount?act=list",
+                            "parent_id"=> 17,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 18
+                        ],
+                        [
+                            "id"=> 31,
+                            "label"=> "搭售活动",
+                            "mark"=> "",
+                            "url"=> "/#/left/tyingActivitiesList",
+                            "parent_id"=> 17,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 20
+                        ],
+                        [
+                            "id"=> 404,
+                            "label"=> "抽奖",
+                            "mark"=> "",
+                            "url"=> "/#/left/luckDraw",
+                            "parent_id"=> 17,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 21
+                        ],
+                        [
+                            "id"=> 401,
+                            "label"=> "限时秒杀",
+                            "mark"=> "",
+                            "url"=> "/#/left/secondKillActivity",
+                            "parent_id"=> 17,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 21
+                        ]
+                    ]
+                ],
+                [
+                    "id"=> 35,
+                    "label"=> "订单",
+                    "mark"=> "",
+                    "url"=> "/#/left/goodsOrderList",
+                    "parent_id"=> 0,
+                    "is_curr"=> false,
+                    "can_do"=> false,
+                    "sort"=> 3,
+                    "children"=> [
+                        [
+                            "id"=> 377,
+                            "label"=> "销售订单",
+                            "mark"=> "",
+                            "url"=> "",
+                            "parent_id"=> 35,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 4,
+                            "children"=> [
+                                [
+                                    "id"=> 384,
+                                    "label"=> "商品订单列表",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/goodsOrderList",
+                                    "parent_id"=> 377,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 20
+                                ],
+                                [
+                                    "id"=> 776,
+                                    "label"=> "付款订单列表",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/billOrder",
+                                    "parent_id"=> 377,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 30
+                                ],
+                                [
+                                    "id"=> 658,
+                                    "label"=> "服务订单列表",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/serviceOrderList",
+                                    "parent_id"=> 377,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 40
+                                ],
+                                [
+                                    "id"=> 827,
+                                    "label"=> "发货单列表",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/invoiceorder",
+                                    "parent_id"=> 377,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 70
+                                ],
+                                [
+                                    "id"=> 527,
+                                    "label"=> "退货售后列表",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/afterSalesOrder?pageType=sale",
+                                    "parent_id"=> 377,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 80
+                                ],
+                                [
+                                    "id"=> 828,
+                                    "label"=> "自提核销",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/selfDrawVerify",
+                                    "parent_id"=> 377,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 100
+                                ],
+                                [
+                                    "id"=> 768,
+                                    "label"=> "销售统计",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/saleReport",
+                                    "parent_id"=> 377,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 110
+                                ],
+                                [
+                                    "id"=> 718,
+                                    "label"=> "门店订单看板",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/shopOrderBoard",
+                                    "parent_id"=> 377,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 120
+                                ],
+                                [
+                                    "id"=> 717,
+                                    "label"=> "门店订单列表",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/shopOrderList",
+                                    "parent_id"=> 377,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 130
+                                ],
+                                [
+                                    "id"=> 668,
+                                    "label"=> "O2O订单管理",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/o2oOrderList",
+                                    "parent_id"=> 377,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 140
+                                ]
+                            ]
+                        ],
+                        [
+                            "id"=> 378,
+                            "label"=> "采购订单",
+                            "mark"=> "",
+                            "url"=> "",
+                            "parent_id"=> 35,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 5,
+                            "children"=> [
+                                [
+                                    "id"=> 571,
+                                    "label"=> "信用额度查询",
+                                    "mark"=> "服务商-采购管理",
+                                    "url"=> "/#/left/creditLimitZSW",
+                                    "parent_id"=> 378,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 10
+                                ],
+                                [
+                                    "id"=> 49,
+                                    "label"=> "采购订单列表",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/orderList",
+                                    "parent_id"=> 378,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 20
+                                ],
+                                [
+                                    "id"=> 890,
+                                    "label"=> "退货售后列表",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/afterSalesOrder?pageType=purchase",
+                                    "parent_id"=> 378,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 30
+                                ],
+                                [
+                                    "id"=> 894,
+                                    "label"=> "待开票列表",
+                                    "mark"=> "订单合并-智商务-待开票列表",
+                                    "url"=> "/#/left/toMakeInvoiceListNew",
+                                    "parent_id"=> 378,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 40
+                                ],
+                                [
+                                    "id"=> 899,
+                                    "label"=> "开票申请列表",
+                                    "mark"=> "订单合并-智商务-采购管理",
+                                    "url"=> "/#/left/applyMakeInvoiceListZSWNew",
+                                    "parent_id"=> 378,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 50
+                                ],
+                                [
+                                    "id"=> 886,
+                                    "label"=> "备件捆绑主机",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/newBindPcMechine",
+                                    "parent_id"=> 378,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 60
+                                ]
+                            ]
+                        ]
+                    ]
+                ],
+                [
+                    "id"=> 114,
+                    "label"=> "商家",
+                    "mark"=> "",
+                    "url"=> "/#/left/merchantsAccount",
+                    "parent_id"=> 0,
+                    "is_curr"=> false,
+                    "can_do"=> false,
+                    "sort"=> 4,
+                    "children"=> [
+                        [
+                            "id"=> 394,
+                            "label"=> "店铺账户",
+                            "mark"=> "",
+                            "url"=> "/#/left/merchantsAccount",
+                            "parent_id"=> 114,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 12
+                        ],
+                        [
+                            "id"=> 864,
+                            "label"=> "在线客服设置(新)",
+                            "mark"=> "",
+                            "url"=> "/#/left/customerService",
+                            "parent_id"=> 114,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 20
+                        ],
+                        [
+                            "id"=> 766,
+                            "label"=> "服务站信息管理(新)",
+                            "mark"=> "",
+                            "url"=> "/#/left/serviceStationInfoManage",
+                            "parent_id"=> 114,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 24
+                        ],
+                        [
+                            "id"=> 755,
+                            "label"=> "服务网点列表(新)",
+                            "mark"=> "",
+                            "url"=> "/#/left/serviceNetworkManage",
+                            "parent_id"=> 114,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 24
+                        ],
+                        [
+                            "id"=> 856,
+                            "label"=> "工程师管理(新)",
+                            "mark"=> "",
+                            "url"=> "/#/left/engineerManage",
+                            "parent_id"=> 114,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 25
+                        ],
+                        [
+                            "id"=> 722,
+                            "label"=> "带货人管理",
+                            "mark"=> "",
+                            "url"=> "/seller/service_manage.php?act=carrier_list",
+                            "parent_id"=> 114,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 26
+                        ],
+                        [
+                            "id"=> 745,
+                            "label"=> "任务单列表",
+                            "mark"=> "",
+                            "url"=> "/#/left/missionOrderList",
+                            "parent_id"=> 114,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 30
+                        ]
+                    ]
+                ],
+                [
+                    "id"=> 82,
+                    "label"=> "设置",
+                    "mark"=> "",
+                    "url"=> "/#/left/setFreight",
+                    "parent_id"=> 0,
+                    "is_curr"=> false,
+                    "can_do"=> false,
+                    "sort"=> 6,
+                    "children"=> [
+                        [
+                            "id"=> 872,
+                            "label"=> "运费设置(新)",
+                            "mark"=> "",
+                            "url"=> "/#/left/setFreight",
+                            "parent_id"=> 82,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 13
+                        ],
+                        [
+                            "id"=> 403,
+                            "label"=> "短信设置",
+                            "mark"=> "",
+                            "url"=> "/#/left/setSms",
+                            "parent_id"=> 82,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 14
+                        ],
+                        [
+                            "id"=> 526,
+                            "label"=> "退货设置",
+                            "mark"=> "",
+                            "url"=> "/#/left/returnSetting",
+                            "parent_id"=> 82,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 15
+                        ],
+                        [
+                            "id"=> 633,
+                            "label"=> "物流方式",
+                            "mark"=> "",
+                            "url"=> "/#/left/express",
+                            "parent_id"=> 82,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 20
+                        ],
+                        [
+                            "id"=> 642,
+                            "label"=> "库房位置",
+                            "mark"=> "",
+                            "url"=> "/#/left/setStorehouse",
+                            "parent_id"=> 82,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 25
+                        ]
+                    ]
+                ],
+                [
+                    "id"=> 71,
+                    "label"=> "权限",
+                    "mark"=> "",
+                    "url"=> "/#/left/roleManagement",
+                    "parent_id"=> 0,
+                    "is_curr"=> false,
+                    "can_do"=> false,
+                    "sort"=> 7,
+                    "children"=> [
+                        [
+                            "id"=> 742,
+                            "label"=> "新角色管理",
+                            "mark"=> "",
+                            "url"=> "/#/left/roleManagement",
+                            "parent_id"=> 71,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 10
+                        ],
+                        [
+                            "id"=> 743,
+                            "label"=> "新员工管理",
+                            "mark"=> "",
+                            "url"=> "/#/left/staffManagement",
+                            "parent_id"=> 71,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 11
+                        ]
+                    ]
+                ],
+                [
+                    "id"=> 125,
+                    "label"=> "店铺",
+                    "mark"=> "",
+                    "url"=> "/#/left/microstation",
+                    "parent_id"=> 0,
+                    "is_curr"=> false,
+                    "can_do"=> false,
+                    "sort"=> 8,
+                    "children"=> [
+                        [
+                            "id"=> 154,
+                            "label"=> "微站",
+                            "mark"=> "",
+                            "url"=> "",
+                            "parent_id"=> 125,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 5,
+                            "children"=> [
+                                [
+                                    "id"=> 869,
+                                    "label"=> "微站(新)",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/microstation",
+                                    "parent_id"=> 154,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 1
+                                ],
+                                [
+                                    "id"=> 870,
+                                    "label"=> "Logo管理(新)",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/logoManage",
+                                    "parent_id"=> 154,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 2
+                                ],
+                                [
+                                    "id"=> 871,
+                                    "label"=> "店铺名称管理(新)",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/shopNameManage",
+                                    "parent_id"=> 154,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 12
+                                ]
+                            ]
+                        ],
+                        [
+                            "id"=> 132,
+                            "label"=> "店铺装修",
+                            "mark"=> "",
+                            "url"=> "",
+                            "parent_id"=> 125,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 80,
+                            "children"=> [
+                                [
+                                    "id"=> 395,
+                                    "label"=> "前台分类设置",
+                                    "mark"=> "",
+                                    "url"=> "/seller/business_category.php?act=data_list",
+                                    "parent_id"=> 132,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 801
+                                ],
+                                [
+                                    "id"=> 396,
+                                    "label"=> "热门搜索设置",
+                                    "mark"=> "",
+                                    "url"=> "/seller/business_category.php?act=hot_keyword",
+                                    "parent_id"=> 132,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 802
+                                ]
+                            ]
+                        ]
+                    ]
+                ],
+                [
+                    "id"=> 171,
+                    "label"=> "财务",
+                    "mark"=> "",
+                    "url"=> "/#/left/balance",
+                    "parent_id"=> 0,
+                    "is_curr"=> false,
+                    "can_do"=> false,
+                    "sort"=> 9,
+                    "children"=> [
+                        [
+                            "id"=> 612,
+                            "label"=> "账户余额明细",
+                            "mark"=> "",
+                            "url"=> "/#/left/balance",
+                            "parent_id"=> 171,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 41
+                        ],
+                        [
+                            "id"=> 672,
+                            "label"=> "外部订单结费统计",
+                            "mark"=> "",
+                            "url"=> "/#/left/allPlatformMarketing",
+                            "parent_id"=> 171,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 42
+                        ],
+                        [
+                            "id"=> 582,
+                            "label"=> "订单对账管理",
+                            "mark"=> "0",
+                            "url"=> "/#/left/finance",
+                            "parent_id"=> 171,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 12622
+                        ],
+                        [
+                            "id"=> 609,
+                            "label"=> "申请开票管理",
+                            "mark"=> "0",
+                            "url"=> "/#/left/applyInvoice",
+                            "parent_id"=> 171,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 12624
+                        ],
+                        [
+                            "id"=> 610,
+                            "label"=> "开票申请列表",
+                            "mark"=> "0",
+                            "url"=> "/#/left/applyFeeList",
+                            "parent_id"=> 171,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 12625
+                        ]
+                    ]
+                ],
+                [
+                    "id"=> 405,
+                    "label"=> "数据",
+                    "mark"=> "",
+                    "url"=> "/#/left/dataBoard",
+                    "parent_id"=> 0,
+                    "is_curr"=> false,
+                    "can_do"=> false,
+                    "sort"=> 12,
+                    "children"=> [
+                        [
+                            "id"=> 406,
+                            "label"=> "数据看板",
+                            "mark"=> "",
+                            "url"=> "/#/left/dataBoard",
+                            "parent_id"=> 405,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 1
+                        ],
+                        [
+                            "id"=> 544,
+                            "label"=> "员工销售数据",
+                            "mark"=> "",
+                            "url"=> "/#/left/staffSales",
+                            "parent_id"=> 405,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 2
+                        ],
+                        [
+                            "id"=> 583,
+                            "label"=> "加装改配查询",
+                            "mark"=> "0",
+                            "url"=> "/#/left/computerInfoSearch",
+                            "parent_id"=> 405,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 4
+                        ]
+                    ]
+                ],
+                [
+                    "id"=> 564,
+                    "label"=> "进销存",
+                    "mark"=> "0",
+                    "url"=> "/#/left/POOrderListZSW",
+                    "parent_id"=> 0,
+                    "is_curr"=> false,
+                    "can_do"=> false,
+                    "sort"=> 13,
+                    "children"=> [
+                        [
+                            "id"=> 674,
+                            "label"=> "采购管理",
+                            "mark"=> "采购管理",
+                            "url"=> "",
+                            "parent_id"=> 564,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 2,
+                            "children"=> [
+                                [
+                                    "id"=> 572,
+                                    "label"=> "PO采购列表",
+                                    "mark"=> "服务商-采购管理",
+                                    "url"=> "/#/left/POOrderListZSW",
+                                    "parent_id"=> 674,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 8
+                                ],
+                                [
+                                    "id"=> 723,
+                                    "label"=> "退货单列表",
+                                    "mark"=> "服务商-采购管理",
+                                    "url"=> "/#/left/zswRefundList",
+                                    "parent_id"=> 674,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 9
+                                ],
+                                [
+                                    "id"=> 573,
+                                    "label"=> "SO订单列表",
+                                    "mark"=> "服务商-采购管理",
+                                    "url"=> "/#/left/SOOrderListZSW",
+                                    "parent_id"=> 674,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 9
+                                ],
+                                [
+                                    "id"=> 570,
+                                    "label"=> "单品库存管理",
+                                    "mark"=> "服务商-采购管理",
+                                    "url"=> "/#/left/singleProductZSW",
+                                    "parent_id"=> 674,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 10
+                                ],
+                                [
+                                    "id"=> 574,
+                                    "label"=> "付款订单列表",
+                                    "mark"=> "服务商-采购管理",
+                                    "url"=> "/#/left/payListZSW",
+                                    "parent_id"=> 674,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 11
+                                ],
+                                [
+                                    "id"=> 588,
+                                    "label"=> "待开票列表",
+                                    "mark"=> "服务商-采购管理",
+                                    "url"=> "/#/left/toMakeInvoiceList",
+                                    "parent_id"=> 674,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 12
+                                ],
+                                [
+                                    "id"=> 589,
+                                    "label"=> "开票申请列表",
+                                    "mark"=> "服务商-采购管理",
+                                    "url"=> "/#/left/applyMakeInvoiceListZSW",
+                                    "parent_id"=> 674,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 13
+                                ]
+                            ]
+                        ],
+                        [
+                            "id"=> 708,
+                            "label"=> "库存管理",
+                            "mark"=> "",
+                            "url"=> "",
+                            "parent_id"=> 564,
+                            "is_curr"=> false,
+                            "can_do"=> false,
+                            "sort"=> 25,
+                            "children"=> [
+                                [
+                                    "id"=> 709,
+                                    "label"=> "物料入库通知",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/warehousingNotice",
+                                    "parent_id"=> 708,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 25
+                                ],
+                                [
+                                    "id"=> 710,
+                                    "label"=> "物料出库通知",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/deliveryNotice",
+                                    "parent_id"=> 708,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 26
+                                ],
+                                [
+                                    "id"=> 711,
+                                    "label"=> "物料调拨通知",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/allocatingNotice",
+                                    "parent_id"=> 708,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 27
+                                ],
+                                [
+                                    "id"=> 712,
+                                    "label"=> "物料入库单查询",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/warehousingQuery",
+                                    "parent_id"=> 708,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 28
+                                ],
+                                [
+                                    "id"=> 713,
+                                    "label"=> "物料出库单查询",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/outboundQuery",
+                                    "parent_id"=> 708,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 29
+                                ],
+                                [
+                                    "id"=> 714,
+                                    "label"=> "物料库存",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/inventory",
+                                    "parent_id"=> 708,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 30
+                                ],
+                                [
+                                    "id"=> 716,
+                                    "label"=> "自营物料档案",
+                                    "mark"=> "",
+                                    "url"=> "/#/left/materialFile",
+                                    "parent_id"=> 708,
+                                    "is_curr"=> false,
+                                    "can_do"=> false,
+                                    "sort"=> 31
+                                ]
+                            ]
+                        ]
+                    ]
+                ]
+            ];
+        return Result::success($data);
+    }
+
 
 
 }

+ 30 - 0
app/Middleware/CorsMiddleware.php

@@ -0,0 +1,30 @@
+<?php
+
+declare(strict_types=1);
+
+namespace App\Middleware;
+
+use Hyperf\Context\Context;
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use Psr\Http\Server\MiddlewareInterface;
+use Psr\Http\Server\RequestHandlerInterface;
+
+class CorsMiddleware implements MiddlewareInterface
+{
+    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
+    {
+        $response = Context::get(ResponseInterface::class);
+        $response = $response->withHeader('Access-Control-Allow-Origin', '*')
+            ->withHeader('Access-Control-Allow-Credentials', 'true')
+            // Headers 可以根据实际情况进行改写。
+            ->withHeader('Access-Control-Allow-Headers', '*');
+
+        Context::set(ResponseInterface::class, $response);
+        if ($request->getMethod() == 'OPTIONS') {
+            return $response;
+        }
+
+        return $handler->handle($request);
+    }
+}

+ 3 - 0
app/Tools/Result.php

@@ -3,6 +3,7 @@ namespace App\Tools;
 use App\Constants\ErrorCode;
 class Result
 {
+    protected Request $request;
     public static function success($data = [])
     {
         return static::result(ErrorCode::SUCCESS, ErrorCode::getMessage(ErrorCode::SUCCESS), $data);
@@ -23,4 +24,6 @@ class Result
             'data' => $data,
         ];
     }
+
+
 }

+ 1 - 1
config/autoload/logger.php

@@ -15,7 +15,7 @@ return [
             'class' => Monolog\Handler\StreamHandler::class,
             'constructor' => [
                 'stream' => BASE_PATH . '/runtime/logs/hyperf.log',
-                'level' => Monolog\Logger::WARNING,
+                'level' => Monolog\Logger::DEBUG,
             ],
         ],
         'formatter' => [

+ 1 - 0
config/autoload/middlewares.php

@@ -1,6 +1,7 @@
 <?php
 return [
     'http' => [
+        \App\Middleware\CorsMiddleware::class,
         \Hyperf\Validation\Middleware\ValidationMiddleware::class,
     ],
 ];

+ 4 - 6
config/routes.php

@@ -10,14 +10,12 @@ declare(strict_types=1);
  * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
  */
 use Hyperf\HttpServer\Router\Router;
-
 Router::addRoute(['GET', 'POST', 'HEAD'], '/', 'App\Controller\IndexController@index');
 //Router::addRoute(['POST'], '/website/createWebsite', 'App\Controller\WebsiteController@createWebsite');
-Router::post('/login', 'App\Controller\LoginController@login');
-
-Router::addGroup('/v1', function () {
-    Router::get('/data', 'App\Controller\LoginController@getData');
-}, ['middleware' => [\App\Middleware\Auth\FooMiddleware::class]]);
+Router::post('/api/login', 'App\Controller\LoginController@login');
+//Router::addGroup('/user', function () {
+//    Router::get('/getMenuList', 'App\Controller\UserController@getMenuList');
+//}, ['middleware' => [\App\Middleware\Auth\FooMiddleware::class]]);
 
 
 

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


+ 10 - 1
runtime/container/proxy/App_Controller_AbstractController.proxy.php

@@ -14,9 +14,11 @@ namespace App\Controller;
 use Hyperf\Di\Annotation\Inject;
 use Hyperf\HttpServer\Contract\RequestInterface;
 use Hyperf\HttpServer\Contract\ResponseInterface;
+use Phper666\JWTAuth\JWT;
 use Psr\Container\ContainerInterface;
 use Hyperf\Logger\LoggerFactory;
 use Psr\Log\LoggerInterface;
+use http\Client\Request;
 abstract class AbstractController
 {
     use \Hyperf\Di\Aop\ProxyTrait;
@@ -27,6 +29,8 @@ abstract class AbstractController
     protected RequestInterface $request;
     #[Inject]
     protected ResponseInterface $response;
+    #[Inject]
+    protected JWT $jwt;
     protected LoggerInterface $logger;
     protected $UserId;
     public function __construct(LoggerFactory $loggerFactory)
@@ -34,6 +38,11 @@ abstract class AbstractController
         $this->__handlePropertyHandler(__CLASS__);
         // 第一个参数对应日志的 name, 第二个参数对应 config/autoload/logger.php 内的 key
         $this->logger = $loggerFactory->get('admin_consumer:', 'default');
-        $this->UserId = "111";
+        $a = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJwaHBlcjY2Ni9qd3QiLCJ1aWQiOjEsInVzZXJuYW1lIjoieHgiLCJqd3Rfc2NlbmUiOiJkZWZhdWx0IiwianRpIjoiZGVmYXVsdF82NjYyYTg5NTQ5MTk2MS40NTgzOTUyNCIsImlhdCI6MTcxNzc0MTcxNywibmJmIjoxNzE3NzQxNzE3LCJleHAiOjE3MTc3NDg5MTd9.cTqoaSn5P3mW8__O2O2rv2dxiGtfSZk-E8fisjHFwCg';
+        $headers = $this->request->getHeaders();
+        if ($headers && $headers['token'][0]) {
+            $userInfo = $this->jwt->getClaimsByToken($headers['token'][0]);
+            $this->UserId = $userInfo['uid'];
+        }
     }
 }

+ 3 - 3
runtime/container/proxy/App_Controller_AdController.proxy.php

@@ -4,11 +4,8 @@ declare (strict_types=1);
 namespace App\Controller;
 
 use Phper666\JWTAuth\JWT;
-use Hyperf\HttpServer\Contract\RequestInterface as request;
 use Hyperf\Di\Annotation\Inject;
 use Hyperf\HttpServer\Annotation\AutoController;
-use Hyperf\HttpServer\Contract\RequestInterface;
-use Hyperf\HttpServer\Contract\ResponseInterface;
 use Hyperf\Validation\Contract\ValidatorFactoryInterface;
 use App\Tools\Result;
 use App\JsonRpc\UserServiceInterface;
@@ -35,6 +32,7 @@ class LoginController extends AbstractController
     private $userServiceClient;
     public function login(Jwt $jwt)
     {
+        $this->logger->info("验证之前");
         $reqData = $this->request->all();
         $validator = $this->validationFactory->make($reqData, ['username' => 'required', 'password' => 'required', 'type' => 'required'], ['username.required' => '用户名不能为空', 'password.required' => '密码不能为空', 'type.required' => '登录方式必填']);
         if ($validator->fails()) {
@@ -46,7 +44,9 @@ class LoginController extends AbstractController
             //密码登录
             $where = ['user_name' => $reqData['username']];
         }
+        $this->logger->info("验证之前");
         $userInfos = $this->userServiceClient->verifyUserInfo($where);
+        $this->logger->info("验证用户返回值:", $userInfos);
         if (md5(md5($reqData['password']) . $userInfos['data']['salt']) != $userInfos['data']['password']) {
             return Result::error("用户名或密码错误");
         }

File diff suppressed because it is too large
+ 3 - 0
runtime/container/proxy/App_Controller_UserController.proxy.php


File diff suppressed because it is too large
+ 0 - 0
runtime/container/proxy/App_Controller_WebsiteController.proxy.php


+ 1 - 1
runtime/hyperf.pid

@@ -1 +1 @@
-566
+4273

+ 14 - 0
runtime/logs/hyperf.log

@@ -7,3 +7,17 @@
 [2024-06-06 18:14:50] admin_consumer:.INFO: hello world {"1":"ceshi"} []
 [2024-06-06 18:39:09] admin_consumer:.INFO: 创建用户已 {"code":200,"message":"success","data":[]} []
 [2024-06-06 18:43:15] admin_consumer:.INFO: 创建用户已 {"code":200,"message":"success","data":{"id":23}} []
+[2024-06-13 19:15:32] admin_consumer:.INFO: ccccccccccccccccccccccccc [] []
+[2024-06-13 19:18:21] admin_consumer:.DEBUG: ccccccccccccccccccccccccc [] []
+
+
+
+[2024-06-13 19:19:11] admin_consumer:.DEBUG: 1111 [] []
+[2024-06-13 19:50:26] admin_consumer:.DEBUG: 1111 [] []
+[2024-06-13 19:52:07] admin_consumer:.DEBUG: 1111 [] []
+[2024-06-13 19:57:10] admin_consumer:.DEBUG: 1111 [] []
+[2024-06-13 19:59:14] admin_consumer:.DEBUG: 1111 [] []
+[2024-06-13 19:59:52] admin_consumer:.DEBUG: 1111 [] []
+[2024-06-13 20:00:15] admin_consumer:.DEBUG: 1111 [] []
+[2024-06-13 20:01:27] admin_consumer:.DEBUG: 1111 [] []
+[2024-06-13 20:01:46] admin_consumer:.DEBUG: 1111 [] []

+ 2 - 0
runtime/logs/hyperf1.log

@@ -0,0 +1,2 @@
+[2024-06-13 19:16:35] admin_consumer:.INFO: ccccccccccccccccccccccccc [] []
+[2024-06-13 19:17:19] admin_consumer:.DEBUG: ccccccccccccccccccccccccc [] []

+ 1 - 1
vendor/composer/autoload_classmap.php

@@ -24,9 +24,9 @@ return array(
     'App\\Listener\\DbQueryExecutedListener' => $baseDir . '/app/Listener/DbQueryExecutedListener.php',
     'App\\Listener\\ResumeExitCoordinatorListener' => $baseDir . '/app/Listener/ResumeExitCoordinatorListener.php',
     'App\\Middleware\\Auth\\FooMiddleware' => $baseDir . '/app/Middleware/Auth/FooMiddleware.php',
+    'App\\Middleware\\CorsMiddleware' => $baseDir . '/app/Middleware/CorsMiddleware.php',
     'App\\Model\\Model' => $baseDir . '/app/Model/Model.php',
     'App\\Tools\\Result' => $baseDir . '/app/Tools/Result.php',
-    'App\\Validate\\Demo' => $baseDir . '/app/Validate/Demo.php',
     'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
     'CURLStringFile' => $vendorDir . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php',
     'Carbon\\AbstractTranslator' => $vendorDir . '/nesbot/carbon/src/Carbon/AbstractTranslator.php',

+ 1 - 1
vendor/composer/autoload_static.php

@@ -772,9 +772,9 @@ class ComposerStaticInited6e1e4568df3e81747ba57e8b3d7786
         'App\\Listener\\DbQueryExecutedListener' => __DIR__ . '/../..' . '/app/Listener/DbQueryExecutedListener.php',
         'App\\Listener\\ResumeExitCoordinatorListener' => __DIR__ . '/../..' . '/app/Listener/ResumeExitCoordinatorListener.php',
         'App\\Middleware\\Auth\\FooMiddleware' => __DIR__ . '/../..' . '/app/Middleware/Auth/FooMiddleware.php',
+        'App\\Middleware\\CorsMiddleware' => __DIR__ . '/../..' . '/app/Middleware/CorsMiddleware.php',
         'App\\Model\\Model' => __DIR__ . '/../..' . '/app/Model/Model.php',
         'App\\Tools\\Result' => __DIR__ . '/../..' . '/app/Tools/Result.php',
-        'App\\Validate\\Demo' => __DIR__ . '/../..' . '/app/Validate/Demo.php',
         'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
         'CURLStringFile' => __DIR__ . '/..' . '/symfony/polyfill-php81/Resources/stubs/CURLStringFile.php',
         'Carbon\\AbstractTranslator' => __DIR__ . '/..' . '/nesbot/carbon/src/Carbon/AbstractTranslator.php',

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