Quellcode durchsuchen

Merge branch 'feature-wechat' into liuzj-1001016-dev

liuzejian vor 1 Jahr
Ursprung
Commit
3bf1085c61

+ 19 - 1
modules/Channel/Http/Controllers/WechatOpenPlatformController.php

@@ -123,11 +123,29 @@ class WechatOpenPlatformController extends CatchController
     }
     }
 
 
     public function infoCommand(Request $request, $authorizer_appid, $component_appid) {
     public function infoCommand(Request $request, $authorizer_appid, $component_appid) {
+
         $componentInfo = WechatOpenPlatformService::getComponentInfoByAppid($component_appid);
         $componentInfo = WechatOpenPlatformService::getComponentInfoByAppid($component_appid);
         $app = WechatOpenPlatformService::buildApplication($componentInfo);
         $app = WechatOpenPlatformService::buildApplication($componentInfo);
-
+        myLog("wx-xiaoxi")->info('-------开始处理---'.get_date());
         $server = $app->getServer();
         $server = $app->getServer();
+        $message = $server->getDecryptedMessage();
+        myLog("wx-xiaoxi")->info([
+            'authorizer_appid' => $authorizer_appid,
+            'component_appid' => $component_appid,
+            'param' => $request->all(),
+            'msg' => $message,
+        ]);
+        $refreshToken = WechatOpenPlatformService::getRefreshToken($authorizer_appid,$component_appid);
+        $server = $app->getOfficialAccountWithRefreshToken($authorizer_appid, $refreshToken)->getServer();
+        $server->addMessageListener('text', function($message) {
+            myLog("wx-xiaoxi")->info('----文本消息---');
+            if ($message->Content == "pk"){
+                return  $message->FromUserName;
+            }
+        });
 
 
+        $server->addEventListener('subscribe', function() {  });
+        myLog("wx-xiaoxi")->info('-------结束处理---'.get_date());
         return $server->serve();
         return $server->serve();
     }
     }
 }
 }

+ 17 - 0
modules/Channel/Services/WechatOpenPlatform/WechatOpenPlatformService.php

@@ -73,4 +73,21 @@ class WechatOpenPlatformService
                 'authorizer_appid' => $authorizer_appid,
                 'authorizer_appid' => $authorizer_appid,
             ])->delete();
             ])->delete();
     }
     }
+
+    /**
+     *  获取公众号的refreshToken
+     * name: getRefreshToken
+     * @param $authorizer_appid
+     * @param $component_appid
+     * date 2023/07/07 10:16
+     */
+    public static function getRefreshToken($authorizer_appid, $component_appid)
+    {
+        return  DB::table('wechat_authorization_infos')
+        ->where([
+            'component_appid' => $component_appid,
+            'authorizer_appid' => $authorizer_appid,
+            'is_enabled'  =>  1,
+        ])->value('authorizer_refresh_token');
+    }
 }
 }

+ 21 - 0
modules/WechatPlatform/Http/Controllers/CommonController.php

@@ -0,0 +1,21 @@
+<?php
+/**
+ *
+ * @file:CommonController.php
+ * @Date: 2023/7/6
+ * @Time: 18:05
+ */
+
+
+namespace Modules\WechatPlatform\Http\Controllers;
+
+use Catch\Base\CatchController;
+
+class CommonController extends CatchController
+{
+
+    public function getPageUrl()
+    {
+
+    }
+}

+ 3 - 1
modules/WechatPlatform/Http/Controllers/SettingController.php

@@ -9,7 +9,9 @@
 
 
 namespace Modules\WechatPlatform\Http\Controllers;
 namespace Modules\WechatPlatform\Http\Controllers;
 
 
-class SettingController
+use Catch\Base\CatchController;
+
+class SettingController extends CatchController
 {
 {
 
 
 }
 }

+ 77 - 0
modules/WechatPlatform/Http/Controllers/WechatAuthorizationInfoController.php

@@ -0,0 +1,77 @@
+<?php
+
+namespace Modules\WechatPlatform\Http\Controllers;
+
+use Catch\Base\CatchController;
+use Exception;
+use Illuminate\Http\Request;
+use Modules\Channel\Services\WechatOpenPlatform\WechatOpenPlatformService;
+use Modules\User\Http\Controllers\UserTrait;
+use Modules\WechatPlatform\Models\WechatAuthorizationInfo;
+
+class WechatAuthorizationInfoController extends CatchController
+{
+
+    public function __construct(protected readonly WechatAuthorizationInfo $wechatAuthorizationInfo)
+    {
+        
+    }
+
+    use UserTrait;
+
+    public function index(Request $request)
+    {
+        
+        $page_size = $request->get('limit', 20);
+
+        if($this->isOptimizer()){
+            $where = [
+                ['wechat_authorization_infos.user_id','=',$this->getLoginUserId()],
+                ['wechat_authorization_infos.is_enabled','=',1]
+            ];
+        }elseif($this->isCompanyManager()){
+            $where = [
+                ['wechat_authorization_infos.puser_id','=',$this->getLoginUserId()],
+                ['wechat_authorization_infos.is_enabled','=',1]
+            ];
+        }else{
+            return [];
+        }
+        
+        $nick_name = $request->get('nick_name');
+        if($nick_name){
+            $where[] = ['wechat_authorization_infos.nick_name','like',"%".$nick_name."%"];
+        }
+
+        $result = $this->wechatAuthorizationInfo->where($where)
+        ->join('wechat_open_platform_infos','wechat_open_platform_infos.app_id','=','wechat_authorization_infos.component_appid')
+        ->join('miniprogram','wechat_open_platform_infos.xcx_appid','=','miniprogram.appid')
+        ->select('wechat_authorization_infos.nick_name','wechat_authorization_infos.authorizer_appid','miniprogram.name as xcx_name','wechat_authorization_infos.authorizer_refresh_token'
+        ,'wechat_open_platform_infos.app_id','wechat_open_platform_infos.secret','wechat_open_platform_infos.token','wechat_open_platform_infos.aes_key')
+        ->paginate($page_size);
+
+
+        foreach($result as $item){
+            //todo 获取粉丝数
+            $item->fans_count = 0;
+            $application = WechatOpenPlatformService::buildApplication($item);
+            try{
+                $officialAccount = $application->getOfficialAccountWithRefreshToken($item->authorizer_appid, $item->authorizer_refresh_token);
+                $api = $officialAccount->getClient();
+                $response = $api->get('/cgi-bin/user/list', []);
+                if($response->isSuccessful()){
+                    $item->fans_count = $response['total'];
+                }
+            }catch(Exception $e){
+                myLog('WechatAuthorizationInfo')->error($e);
+            }
+            unset($item->authorizer_refresh_token);
+            unset($item->secret);
+            unset($item->token);
+            unset($item->aes_key);
+            unset($item->app_id);
+        }
+
+        return $result;
+    }
+}

+ 56 - 6
modules/WechatPlatform/Http/Controllers/WechatKeywordsController.php

@@ -29,7 +29,11 @@ class WechatKeywordsController extends CatchController
      */
      */
     public function List(Request $request)
     public function List(Request $request)
     {
     {
-
+        $param  = $request->all();
+        $userContext = $this->getUserContext(null);
+        $param['user_id'] = $userContext['loginUser']->id;
+        $param['puser_id'] = $userContext['loginUser']->pid;
+        return WechatKeywordsService::getKeywordsList($param);
     }
     }
 
 
     /**
     /**
@@ -41,14 +45,15 @@ class WechatKeywordsController extends CatchController
     public function add(WechatKeywordsRequest $request)
     public function add(WechatKeywordsRequest $request)
     {
     {
         $param = $request->validated();
         $param = $request->validated();
-        $param = $this->WechatKeywordsParam($param);
+        $param = $this->wechatKeywordsParam($param);
         $userContext = $this->getUserContext(null);
         $userContext = $this->getUserContext(null);
         $param['user_id'] = $userContext['loginUser']->id;
         $param['user_id'] = $userContext['loginUser']->id;
         $param['puser_id'] = $userContext['loginUser']->pid;
         $param['puser_id'] = $userContext['loginUser']->pid;
+        $param['wechat_accounts'] = [];
         return WechatKeywordsService::addKeyword($param);
         return WechatKeywordsService::addKeyword($param);
     }
     }
 
 
-    private function WechatKeywordsParam(mixed $param)
+    private function wechatKeywordsParam(mixed $param)
     {
     {
         if (getProp($param,'type') != 'miniprogram'){
         if (getProp($param,'type') != 'miniprogram'){
             return $param;
             return $param;
@@ -68,6 +73,21 @@ class WechatKeywordsController extends CatchController
         if(empty($info)){
         if(empty($info)){
             throw  new  FailedException("没有此小程序的使用权限");
             throw  new  FailedException("没有此小程序的使用权限");
         }
         }
+        $param['send_content'] = "";
+        foreach ($param['content'] as & $val){
+            if (!is_array($val)){
+                throw  new  FailedException("回复内容格式不正确");
+            }
+            if (getProp($val,'url')){
+                // 跳转小程序
+                $val['content'] = "<a href=\"\" data-miniprogram-appid=\"{$param['miniprogram_appid']}\" data-miniprogram-path=\"{$val['url']}\">{$val['title']}</a>";
+            }else{
+                $val['content'] = $val['title'];
+                $val['url'] = "";
+            }
+            $param['send_content'] .= $val['content']."\n";
+        }
+        rtrim($param['send_content'],"\n");
         return  $param;
         return  $param;
     }
     }
     /**
     /**
@@ -79,7 +99,9 @@ class WechatKeywordsController extends CatchController
      */
      */
     public function edit($id, WechatKeywordsRequest $request)
     public function edit($id, WechatKeywordsRequest $request)
     {
     {
-
+        $param = $request->validated();
+        $param = $this->wechatKeywordsParam($param);
+       return WechatKeywordsService::updateKeyWords($id,$param);
     }
     }
 
 
     /**
     /**
@@ -90,7 +112,7 @@ class WechatKeywordsController extends CatchController
      */
      */
     public function detail($id)
     public function detail($id)
     {
     {
-
+        return WechatKeywordsService::detail($id);
     }
     }
 
 
     /**
     /**
@@ -102,7 +124,16 @@ class WechatKeywordsController extends CatchController
      */
      */
     public function allocation($id,Request $request)
     public function allocation($id,Request $request)
     {
     {
+        if (!$request->has('wx_auth_ids')){
+            throw  new  FailedException("参数错误");
+        }
+        if (!empty($request->input('wx_auth_ids'))) {
+            $wxAuthIds = explode(',', $request->input('wx_auth_ids'));
+        }else{
+            $wxAuthIds = [];
+        }
 
 
+       return WechatKeywordsService::allocation($id,$wxAuthIds);
     }
     }
 
 
     /**
     /**
@@ -111,10 +142,29 @@ class WechatKeywordsController extends CatchController
      * @param $id
      * @param $id
      * date 2023/07/05 15:47
      * date 2023/07/05 15:47
      */
      */
-    public function del($id)
+    public function del(Request $request)
     {
     {
+        $ids = $request->input('ids');
+        if (empty($ids)){
+            throw  new  FailedException('要删除的数据参数错误');
+        }
+
+        $ids = explode(',',$ids);
+
+        return WechatKeywordsService::delKeywords($ids);
 
 
     }
     }
 
 
+    /**
+     *  公众号授权列表
+     * name: authList
+     * @param $id
+     * date 2023/07/06 15:17
+     */
+    public function authList($id)
+    {
+        $userId  = $this->getLoginUserId();
+        return WechatKeywordsService::WechaAccountAuthListInfo($id,$userId);
+    }
 
 
 }
 }

+ 18 - 0
modules/WechatPlatform/Http/Requests/PlayPageUrlRequest.php

@@ -0,0 +1,18 @@
+<?php
+/**
+ *
+ * @file:PlayPageUrlRequest.php
+ * @Date: 2023/7/6
+ * @Time: 18:18
+ */
+
+
+namespace Modules\WechatPlatform\Http\Requests;
+
+use Illuminate\Foundation\Http\FormRequest;
+
+class PlayPageUrlRequest extends FormRequest
+{
+    
+
+}

+ 2 - 2
modules/WechatPlatform/Http/Requests/WechatKeywordsRequest.php

@@ -38,7 +38,7 @@ class WechatKeywordsRequest extends FormRequest
                 }
                 }
             ],
             ],
             'miniprogram_id' => [
             'miniprogram_id' => [
-                'required_if:type,miniprogram',
+                'required',
                 'Integer',
                 'Integer',
                 "gt:0",
                 "gt:0",
             ],
             ],
@@ -57,7 +57,7 @@ class WechatKeywordsRequest extends FormRequest
         return [
         return [
             'type.required' => '关键词类型必须填写',
             'type.required' => '关键词类型必须填写',
             'keyword.required' => '关键词必须填写',
             'keyword.required' => '关键词必须填写',
-            "miniprogram_id.required_if" => "小程序必须填写",
+            "miniprogram_id.required" => "小程序必须填写",
             "content.required" => "内容必须填写",
             "content.required" => "内容必须填写",
             "content.array" => "内容格式不正确",
             "content.array" => "内容格式不正确",
         ];
         ];

+ 1 - 1
modules/WechatPlatform/Models/WechatAccountKeywordLog.php

@@ -10,7 +10,7 @@ class WechatAccountKeywordLog extends BaseModel
     protected $table = 'wechat_account_keyword_log';
     protected $table = 'wechat_account_keyword_log';
 
 
     protected $fillable = [
     protected $fillable = [
-        'id', 'weacht_keyworld_id', 'appid', 'nick_name', 'sned_total', 'updated_at', 'created_at',
+        'id', 'weacht_keyworld_id', 'appid',"wechat_authorization_info_id", 'nick_name', 'keyword', 'content', 'status', 'send_total', 'updated_at', 'created_at',
     ];
     ];
 
 
 }
 }

+ 16 - 0
modules/WechatPlatform/Models/WechatAuthorizationInfo.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace Modules\WechatPlatform\Models;
+
+use Modules\Common\Models\BaseModel;
+
+
+class WechatAuthorizationInfo extends BaseModel
+{
+    protected $table = 'wechat_authorization_infos';
+
+    protected $fillable = [
+        'id', 'authorizer_appid', 'component_appid', 'user_id', 'puser_id', 'authorizer_refresh_token', 'created_at', 'updated_at', 'nick_name', 'is_enabled', 
+    ];
+
+}

+ 2 - 3
modules/WechatPlatform/Models/WechatKeywords.php

@@ -10,8 +10,7 @@ class WechatKeywords extends BaseModel
     protected $table = 'wechat_keywords';
     protected $table = 'wechat_keywords';
 
 
     protected $fillable = [
     protected $fillable = [
-        'id', 'keyword', 'user_id',"send_times", 'puser_id',"miniprogram_appid", 'miniprogram_id', 'type', 'content', 'is_del', 'del_at', 'updated_at', 'created_at',
+        'id', 'keyword','send_content', 'user_id',"send_total",'wechat_accounts', 'puser_id',"miniprogram_appid", 'miniprogram_id', 'type', 'content', 'is_del', 'del_at', 'updated_at', 'created_at',
     ];
     ];
-    protected $casts = ['content' => 'array'];
-
+    protected $casts = ['content' => 'array','wechat_accounts' => 'array'];
 }
 }

+ 212 - 2
modules/WechatPlatform/Services/WechatKeywordsService.php

@@ -9,12 +9,16 @@
 
 
 namespace Modules\WechatPlatform\Services;
 namespace Modules\WechatPlatform\Services;
 
 
+use Illuminate\Support\Facades\DB;
 use Modules\Common\Services\BaseService;
 use Modules\Common\Services\BaseService;
+use Modules\WechatPlatform\Models\WechatAccountKeywordLog;
 use Modules\WechatPlatform\Models\WechatKeywords;
 use Modules\WechatPlatform\Models\WechatKeywords;
 
 
 class WechatKeywordsService extends BaseService
 class WechatKeywordsService extends BaseService
 {
 {
 
 
+    protected static array $hideField = ['updated_at', 'is_del', 'del_at', 'user_id', 'puser_id', 'send_content']; // 公用的影藏字段
+
     /**
     /**
      *  添加关键字
      *  添加关键字
      * name: addKeyword
      * name: addKeyword
@@ -23,10 +27,216 @@ class WechatKeywordsService extends BaseService
      */
      */
     public static function addKeyword(mixed $param)
     public static function addKeyword(mixed $param)
     {
     {
-        $res =   WechatKeywords::create($param);
-        if ($res){
+        $res = WechatKeywords::create($param);
+        if ($res) {
             return "操作成功";
             return "操作成功";
         }
         }
         return "操作失败";
         return "操作失败";
     }
     }
+
+    /**
+     *  关键词列表
+     * name: getKeywordsList
+     * @param array $param
+     * date 2023/07/06 13:53
+     */
+    public static function getKeywordsList(array $param)
+    {
+        $sql = self::getQuery($param)->orderBy('id','desc');
+        $isAll = getProp($param,'is_all',false);
+        if($isAll){
+            $list = $sql->get();
+        }else{
+            $list = $sql->paginate(getProp($param,'limit',10));
+        }
+        $list->makeHidden(array_merge(self::$hideField,['content']));
+        return $list;
+    }
+
+    private static function getQuery(array $param)
+    {
+        $sql = WechatKeywords::query()->where('is_del',0);
+        if (getProp($param, 'puser_id')) {
+            $sql->where('puser_id', $param['puser_id']);
+        }
+        if (getProp($param, 'user_id')) {
+            $sql->where('user_id', $param['user_id']);
+        }
+        if (getProp($param, 'keyword')) {
+            $sql->where('keyword', "like", "%" . $param['keyword'] . "%");
+        }
+        if(getProp($param,'wechat_authorization_info_id')){
+            $sql->whereJsonContains('wechat_accounts->id',$param['wechat_authorization_info_id']);
+        }
+        return $sql;
+    }
+
+    /**
+     *  详情
+     * name: detail
+     * @param $id
+     * date 2023/07/06 13:55
+     */
+    public static function detail($id)
+    {
+        return WechatKeywords::where('id', $id)->where('is_del', 0)->first()->makeHidden(array_merge(self::$hideField,['wechat_accounts']));
+    }
+
+    /**
+     *  保存关键字
+     * name: updateKeyWords
+     * @param $id
+     * @param mixed $param
+     * @return string
+     * date 2023/07/06 14:51
+     */
+    public static function updateKeyWords($id, mixed $param)
+    {
+        $info = WechatKeywords::where('id', $id)->where('is_del', 0)->first();
+        if (is_empty($info)) {
+            self::throwErrMsg('关键词不存在或已删除');
+        }
+        if ($param['keyword'] != $info->keyword) {
+            // 修改关键词,需要查询词关键词是否已配置
+            if ($info->wechat_accounts) {
+                $appIds = WechatAccountKeywordLog::where('weacht_keyworld_id', $info->id)->where('status', 1)->pluck('appid')->get();
+                if ($appIds) {
+                    $hasUsed = WechatAccountKeywordLog::where('keyword', $param['keyword'])->whereIn('appid', $appIds)->where('status', 1)->pluck('nick_name')->get();
+                    if ($hasUsed) {
+                        self::throwErrMsg("关键字{$param['keyword']}已配置了以下公众号" . implode(',', $hasUsed) . "请先解绑后再编辑");
+                    }
+                }
+            }
+        }
+        DB::beginTransaction();
+        try {
+            $info->save($param);
+            $data = [
+                'content' => $param['send_content'],
+                'keyword' => $param['keyword'],
+            ];
+            WechatAccountKeywordLog::where('weacht_keyworld_id', $info->id)->update($data);
+            DB::commit();
+        } catch (\Exception $exception) {
+            DB::rollBack();
+            self::throwErrMsg('编辑失败');
+        }
+        return "操作成功";
+    }
+
+    /**
+     *  配置公众号列表
+     * name: WechaAccountAuthListInfo
+     * @param $id
+     * @param mixed $userId
+     * date 2023/07/06 15:31
+     */
+    public static function WechaAccountAuthListInfo($id, mixed $userId)
+    {
+        $list = DB::table('wechat_authorization_infos')
+            ->where('user_id', $userId)
+            ->select('id', 'nick_name', 'is_enabled')->get();
+        $authList = WechatAccountKeywordLog::where('weacht_keyworld_id', $id)->get();
+        if (!$list->isEmpty()) {
+            foreach ($list as $val) {
+                $val->is_auth = 0;
+                $info = $authList->where('wechat_authorization_info_id', $val->id)->first();
+                if (getProp($info, 'status') == 1) {
+                    $val->is_auth = 1;
+                }
+                if ($val->is_enabled != 1) {
+                    $val->nick_name .= "(取消授权)";
+                }
+                unset($val->is_enabled);
+            }
+        }
+        return $list;
+    }
+
+    /**
+     *   删除关键词
+     * name: delKeywords
+     * @param array $ids
+     * date 2023/07/06 15:54
+     */
+    public static function delKeywords(array $ids)
+    {
+        if (empty($ids)) {
+            self::throwErrMsg('要删除的数据不能为空');
+        }
+        DB::beginTransaction();
+        try {
+            WechatKeywords::query()->whereIn('id', $ids)->update(['is_del' => 1, 'del_at' => get_date()]);
+            WechatAccountKeywordLog::query()->whereIn('weacht_keyworld_id', $ids)->update(['status' => 0]);
+            DB::commit();
+        } catch (\Exception $exception) {
+            DB::rollBack();
+            self::throwErrMsg('删除失败');
+        }
+        return "操作成功";
+    }
+
+    public static function allocation($id, $wxAuthIds)
+    {
+        $info = WechatKeywords::where('id', $id)->where('is_del', 0)->first();
+        if (is_empty($info)) {
+            self::throwErrMsg('关键词不存在或已删除');
+        }
+        $data = [];
+        $list = [];
+        if (empty($wxAuthIds)){
+            $data['wechat_accounts'] = [];
+        }else{
+            $wechatAccountInfos = DB::table('wechat_authorization_infos')
+                ->whereIn('id',$wxAuthIds)
+                ->where('is_enabled',1)
+                ->where('user_id',$info->user_id)
+                ->get();
+            if($wechatAccountInfos->isEmpty()){
+                self::throwErrMsg("优化师对提交的公众号没有使用权限");
+            }
+
+            $canNotUsed = $wechatAccountInfos->pluck('id')->toArray();
+            $canNotUsed = array_diff($wxAuthIds,$canNotUsed);
+            if (count($canNotUsed) > 0){
+                self::throwErrMsg("优化师对id:为:".implode(',',$canNotUsed)."的公众号没有使用权限");
+            }
+
+            foreach ($wechatAccountInfos as  $val){
+                $data['wechat_accounts'][] = [
+                    'id' =>  $val->id,
+                    'appid' =>$val->authorizer_appid,
+                    'nick_name' => $val->nick_name,
+                    'component_appid' => $val->component_appid
+                ];
+                $list[] = [
+                    'weacht_keyworld_id' => $info->id,
+                    'appid' => $val->authorizer_appid,
+                    'wechat_authorization_info_id'=> $val->id,
+                    'nick_name' => $val->nick_name,'keyword' => $info->keyword,
+                    'content' => $info->send_content,
+                    'status' => 1,
+                ];
+            }
+        }
+
+        DB::beginTransaction();
+        try {
+            if (!empty($list)){
+                foreach ($list as $val){
+                    WechatAccountKeywordLog::updateOrCreate(['weacht_keyworld_id' => $val['weacht_keyworld_id'],'wechat_authorization_info_id' => $val['wechat_authorization_info_id']],$val);
+                }
+            }else{
+                WechatAccountKeywordLog::where('weacht_keyworld_id',$id)->update(['status' => 0]);
+            }
+            WechatKeywords::where('id',$id)->update($data);
+            DB::commit();
+        }catch (\Exception $exception){
+            DB::rollBack();
+            self::throwErrMsg('操作失败');
+        }
+        return "操作成功";
+    }
+
+
 }
 }

+ 23 - 2
modules/WechatPlatform/routes/route.php

@@ -1,7 +1,10 @@
 <?php
 <?php
 
 
 use Illuminate\Support\Facades\Route;
 use Illuminate\Support\Facades\Route;
+
 use Modules\WechatPlatform\Http\Controllers\KFMessageController;
 use Modules\WechatPlatform\Http\Controllers\KFMessageController;
+use Modules\WechatPlatform\Http\Controllers\WechatAuthorizationInfoController;
+use Modules\WechatPlatform\Http\Controllers\CommonController;
 use Modules\WechatPlatform\Http\Controllers\WechatKeywordsController;
 use Modules\WechatPlatform\Http\Controllers\WechatKeywordsController;
 
 
 Route::prefix('wechatPlatform')->group(function(){
 Route::prefix('wechatPlatform')->group(function(){
@@ -14,8 +17,12 @@ Route::prefix('wechatPlatform')->group(function(){
         Route::post('updateGZH', [KFMessageController::class, 'updateGZH']);
         Route::post('updateGZH', [KFMessageController::class, 'updateGZH']);
     });
     });
 
 
+
     // 微信公众号设置
     // 微信公众号设置
     Route::prefix('officialAccount')->group(function () {
     Route::prefix('officialAccount')->group(function () {
+        //公众号列表
+        Route::get("list",[WechatAuthorizationInfoController::class,'index']);
+
         // 关键字列表
         // 关键字列表
         Route::prefix('keyword')->group(function () {
         Route::prefix('keyword')->group(function () {
             // 列表
             // 列表
@@ -27,9 +34,23 @@ Route::prefix('wechatPlatform')->group(function(){
             // 详情
             // 详情
             Route::any('detail/{id}',[WechatKeywordsController::class,'detail']);
             Route::any('detail/{id}',[WechatKeywordsController::class,'detail']);
             // 删除
             // 删除
-            Route::any('del/{id}',[WechatKeywordsController::class,'del']);
+            Route::any('del',[WechatKeywordsController::class,'del']);
             // 配置公众号
             // 配置公众号
-            Route::post('allocation/id',[WechatKeywordsController::class,'allocation']);
+            Route::post('allocation/{id}',[WechatKeywordsController::class,'allocation']);
+
+            // 关键字公账号配置选择项
+            Route::any("auth_list/{id}",[WechatKeywordsController::class,'authList']);
         });
         });
+    });    
+    // 公共部分
+    Route::prefix('common')->group(function (){
+        // 获取小程序页面链接
+        Route::post('get_page',[CommonController::class,'getPageUrl'])->withoutMiddleware(config('catch.route.middlewares'));
     });
     });
+
+    // 设置
+    Route::prefix('setting')->group(function (){
+
+    });
+
 });
 });

+ 2 - 1
tests/Feature/VideoStatTest.php

@@ -13,7 +13,8 @@ class VideoStatTest extends TestCase
      */
      */
     public function test_example(): void
     public function test_example(): void
     {
     {
-        $response = $this->get('/api/statistic/video/stats');
+        //$response = $this->get('/api/statistic/video/stats');
+        $response = $this->get('/api/wechatPlatform/officialAccount/list');
         echo $response->getContent();
         echo $response->getContent();
         $response->assertStatus(200);
         $response->assertStatus(200);
     }
     }