Переглянути джерело

Merge branch 'dev' of http://git.range8.cn/youyou/dms-api into dev

PC-202304251453\Administrator 6 місяців тому
батько
коміт
61c2feb88a
57 змінених файлів з 3363 додано та 105 видалено
  1. 158 0
      app/v1/controller/CommonController.php
  2. 54 0
      app/v1/controller/advert/AgentListController.php
  3. 100 0
      app/v1/controller/advert/AgentSiteController.php
  4. 87 0
      app/v1/controller/advert/MediaCostController.php
  5. 47 0
      app/v1/controller/advert/MediaListController.php
  6. 0 57
      app/v1/controller/center/CommonController.php
  7. 43 22
      app/v1/controller/center/GameController.php
  8. 46 0
      app/v1/controller/center/IosPayWayController.php
  9. 45 0
      app/v1/controller/center/QxSwitchController.php
  10. 101 0
      app/v1/controller/customer/AccountController.php
  11. 64 0
      app/v1/controller/customer/RoleDataController.php
  12. 72 0
      app/v1/controller/customer/SdkOrderController.php
  13. 61 0
      app/v1/controller/gameLog/GamePackLogController.php
  14. 48 0
      app/v1/controller/gameLog/GamePackageController.php
  15. 40 0
      app/v1/logic/advert/AgentListLogic.php
  16. 295 0
      app/v1/logic/advert/AgentSiteLogic.php
  17. 51 0
      app/v1/logic/advert/MediaCostLogic.php
  18. 35 0
      app/v1/logic/advert/MediaListLogic.php
  19. 99 17
      app/v1/logic/center/GameLogic.php
  20. 27 0
      app/v1/logic/center/IosPayWayLogic.php
  21. 27 0
      app/v1/logic/center/QxSwitchLogic.php
  22. 164 0
      app/v1/logic/customer/AccountLogic.php
  23. 98 0
      app/v1/logic/customer/RoleDataLogic.php
  24. 152 0
      app/v1/logic/customer/SdkOrderLogic.php
  25. 39 0
      app/v1/logic/gameLog/GamePackLogLogic.php
  26. 47 0
      app/v1/logic/gameLog/GamePackageLogic.php
  27. 10 9
      app/v1/middleware/FilterPermission.php
  28. 42 0
      app/v1/model/advert/AgentList.php
  29. 42 0
      app/v1/model/advert/AgentSite.php
  30. 50 0
      app/v1/model/advert/MediaCost.php
  31. 50 0
      app/v1/model/advert/MediaList.php
  32. 34 0
      app/v1/model/center/IosPayWay.php
  33. 42 0
      app/v1/model/center/QxSwitch.php
  34. 50 0
      app/v1/model/customer/Account.php
  35. 61 0
      app/v1/model/customer/RoleData.php
  36. 42 0
      app/v1/model/customer/SdkOrder.php
  37. 42 0
      app/v1/model/gameLog/GamePackLog.php
  38. 34 0
      app/v1/model/gameLog/GamePackage.php
  39. 50 0
      app/v1/validate/advert/AgentListValidate.php
  40. 54 0
      app/v1/validate/advert/AgentSiteValidate.php
  41. 54 0
      app/v1/validate/advert/MediaCostValidate.php
  42. 66 0
      app/v1/validate/advert/MediaListValidate.php
  43. 62 0
      app/v1/validate/center/IosPayWayValidate.php
  44. 54 0
      app/v1/validate/center/QxSwitchValidate.php
  45. 42 0
      app/v1/validate/customer/AccountValidate.php
  46. 54 0
      app/v1/validate/customer/RoleDataValidate.php
  47. 122 0
      app/v1/validate/customer/SdkOrderValidate.php
  48. 53 0
      app/v1/validate/gameLog/GamePackLogValidate.php
  49. 58 0
      app/v1/validate/gameLog/GamePackageValidate.php
  50. 35 0
      config/think-orm.php
  51. 124 0
      plugin/saiadmin/basic/BaseLogic.php
  52. 36 0
      plugin/saiadmin/basic/BaseModel.php
  53. BIN
      plugin/saiadmin/public/export/分包标识数据20250704113640.xlsx
  54. BIN
      plugin/saiadmin/public/export/分包标识数据20250704113853.xlsx
  55. BIN
      plugin/saiadmin/public/export/广点通分包_标识数据_20250704114709.xlsx
  56. BIN
      plugin/saiadmin/public/export/广点通分包_标识数据_20250704143112.xlsx
  57. BIN
      plugin/saiadmin/public/export/快手分包_分包标识数据_20250704114152.xlsx

+ 158 - 0
app/v1/controller/CommonController.php

@@ -0,0 +1,158 @@
+<?php
+namespace app\v1\controller;
+
+use app\v1\logic\advert\AgentListLogic;
+use app\v1\logic\advert\AgentSiteLogic;
+use app\v1\logic\advert\MediaListLogic;
+use app\v1\logic\center\GameLogic;
+use plugin\saiadmin\basic\BaseController;
+use app\v1\logic\center\GameMainLogic;
+use app\v1\logic\gameLog\GamePackageLogic;
+use plugin\saiadmin\app\logic\system\SystemUserLogic;
+use support\Request;
+use support\Response;
+
+/**
+ * 公共接口管理控制器
+ */
+class CommonController extends BaseController
+{
+    protected $gameMainLogic;
+    protected $gameLogic;
+    protected $mediaListLogic;
+    protected $agentListLogic;
+    protected $systemUserLogic;
+    protected $gamePackageLogic;
+    protected $agentSiteLogic;
+
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        parent::__construct();
+        $this->gameMainLogic = new GameMainLogic();
+        $this->gameLogic = new GameLogic();
+        $this->mediaListLogic = new MediaListLogic();
+        $this->agentListLogic = new AgentListLogic();
+        $this->systemUserLogic = new SystemUserLogic();
+        $this->gamePackageLogic = new GamePackageLogic();
+        $this->agentSiteLogic = new AgentSiteLogic();
+    }
+    
+    /**
+     * 获取主游戏options列表
+     * @return Response
+     */
+    public function getMainGameOptions(Request $request): Response
+    {
+        $data = $this->gameMainLogic->getMainGameOptions();
+        return $this->success($data);
+    }
+
+    /**
+     * 获取子游戏options列表(有权限)
+     * @return Response
+     */
+    public function getGameOptions(Request $request): Response
+    {
+
+        $where = $request->get();
+        $data = $this->gameLogic->getGameOptions($where);
+        return $this->success($data);
+    }
+
+    /**
+     * 获取子游戏options列表(无权限)
+     * @return Response
+     */
+    public function getGameOptionsNoAuth(Request $request): Response
+    {
+        $where = $request->get();
+        $data = $this->gameLogic->getGameOptionsNoAuth($where);
+        return $this->success($data);
+    }
+
+    /**
+     * 获取游戏options列表(有权限)
+     * @return Response
+     */
+    public function getTreeGameOptions(Request $request): Response
+    {
+        $where = $request->get();
+        $data = $this->gameLogic->getGameListByPermission($where);
+        return $this->success($data);
+    }
+
+    /**
+     * 获取树形游戏options列表(无权限)
+     * @return Response
+     */
+    public function getGameListTreeNoAuth(Request $request): Response
+    {
+        $where = $request->get();
+        $data = $this->gameLogic->getGameListTreeNoAuth($where);
+        return $this->success($data);
+    }
+
+    /**
+     * 获取树形游戏options列表(有权限)
+     * @return Response
+     */
+    public function getGameListTree(Request $request): Response
+    {
+        $where = $request->get();
+        $data = $this->gameLogic->getGameListTree($where);
+        return $this->success($data);
+    }
+
+
+    /**
+     * 查询媒体列表Options
+     */
+    public function getMediaOptions(Request $request): Response
+    {
+        $data = $this->mediaListLogic->getMediaOptions();
+        $data = $data->toArray();
+        
+
+        return $this->success($data);
+    }
+
+    /**
+     * 查询渠道列表Options
+     */
+    public function getAgentOptions(Request $request): Response
+    {
+        $data = $this->agentListLogic->getAgentOptions();
+        return $this->success($data);
+    }
+
+    /**
+     * 后台归属人列表Options
+     */
+    public function getAuthOptions(Request $request): Response
+    {
+        $data = $this->systemUserLogic->field('id as value, username as label')->select()->toArray();
+        return $this->success($data);
+    }
+
+    /**
+     * 获取母包列表Options
+     */
+    public function getPackageOptions(Request $request): Response
+    {
+        $where = $request->get();
+        $data = $this->gamePackageLogic->getPackageOptions($where);
+        return $this->success($data);
+    }
+
+    /**
+     * 获取广告位options
+     */
+    public function getAgentSiteOptions(Request $request): Response
+    {
+        $data = $this->agentSiteLogic->getAgentSiteOptions();
+        return $this->success($data);
+    }
+}

+ 54 - 0
app/v1/controller/advert/AgentListController.php

@@ -0,0 +1,54 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\controller\advert;
+
+use plugin\saiadmin\basic\BaseController;
+use app\v1\logic\advert\AgentListLogic;
+use app\v1\validate\advert\AgentListValidate;
+use plugin\saiadmin\app\logic\system\SystemUserLogic;
+use support\Request;
+use support\Response;
+
+/**
+ * 渠道管理控制器
+ */
+class AgentListController extends BaseController
+{
+    protected $systemUserLogic;
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->logic = new AgentListLogic();
+        $this->validate = new AgentListValidate;
+        parent::__construct();
+         $this->systemUserLogic = new SystemUserLogic();
+    }
+
+    /**
+     * 数据列表
+     * @param Request $request
+     * @return Response
+     */
+    public function index(Request $request): Response
+    {
+        $where = $request->more([
+            ['auth_id', ''],
+            ['name', ''],
+            ['id', ''],
+            ['media_id', ''],
+        ]);
+        $query = $this->logic->search($where);
+        $data = $this->logic->getList($query);
+        $data=$this->logic->trandformListColumn($data['data'],['auth','media']);
+        return $this->success($data);
+    }
+
+
+
+}

+ 100 - 0
app/v1/controller/advert/AgentSiteController.php

@@ -0,0 +1,100 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\controller\advert;
+
+use app\v1\logic\advert\AgentListLogic;
+use plugin\saiadmin\basic\BaseController;
+use app\v1\logic\advert\AgentSiteLogic;
+use app\v1\logic\advert\MediaListLogic;
+use app\v1\validate\advert\AgentSiteValidate;
+use plugin\saiadmin\app\logic\system\SystemUserLogic;
+use support\Request;
+use support\Response;
+
+/**
+ * 广告位列表控制器
+ */
+class AgentSiteController extends BaseController
+{
+    protected $systemUserLogic;
+    protected $agentListLogic;
+    protected $mediaListLogic;
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->logic = new AgentSiteLogic();
+        $this->validate = new AgentSiteValidate;
+        parent::__construct();
+        $this->systemUserLogic = new SystemUserLogic();
+        $this->agentListLogic = new AgentListLogic();
+        $this->mediaListLogic = new MediaListLogic();
+    }
+
+    /**
+     * 数据列表
+     * @param Request $request
+     * @return Response
+     */
+    public function index(Request $request): Response
+    {
+        $where = $request->more([
+            ['media_id', ''],
+            ['agent_id', ''],
+            ['auth_id', ''],
+            ['name', ''],
+            ['id', ''],
+            ['agent_name', ''],
+        ]);
+
+        if(!empty($where['agent_name'])){
+            $where['agent_id'] = $this->agentListLogic->where('name', 'like', '%'.$where['agent_name'].'%')->value('id');
+            unset($where['agent_name']);
+        }
+
+        $query = $this->logic->search($where);
+        $data = $this->logic->getList($query);
+        $data['data'] = $this->logic->trandformListColumn($data['data'],['agent','media','auth']);
+        return $this->success($data);
+    }
+
+        /**
+     * 获取头条账号
+     */
+    public function getTtAccountOptions(Request $request): Response
+    {
+        $data = $this->logic->getTtAccountList();
+        return $this->success($data);
+    }
+
+        /**
+     * 导出分包标识数据
+     * @param Request $request
+     * @return Response
+     */
+    public function exportGamePackageKs(Request $request): Response
+    {
+        $data = $request->post();
+        return $this->logic->exportGamePackageKs($data);
+      
+    }
+
+    /**
+     * 头条推送新事件
+     * @param Request $request
+     * @return Response
+     */
+    public function ttPushNewEvent(Request $request): Response
+    {
+        $data = $request->post();
+        $result = $this->logic->ttPushNewEvent($data);
+        return $this->success($result);
+    }
+
+
+}

+ 87 - 0
app/v1/controller/advert/MediaCostController.php

@@ -0,0 +1,87 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\controller\advert;
+
+use app\v1\logic\advert\AgentListLogic;
+use app\v1\logic\advert\AgentSiteLogic;
+use plugin\saiadmin\basic\BaseController;
+use app\v1\logic\advert\MediaCostLogic;
+use app\v1\logic\center\GameLogic;
+use app\v1\validate\advert\MediaCostValidate;
+use plugin\saiadmin\app\logic\system\SystemUserLogic;
+use support\Request;
+use support\Response;
+
+/**
+ * 媒体消耗控制器
+ */
+class MediaCostController extends BaseController
+{
+    protected $agentSiteLogic;
+    protected $agentListLogic;
+    protected $gameLogic;
+    protected $systemUserLogic;
+
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->logic = new MediaCostLogic();
+        $this->validate = new MediaCostValidate;
+        parent::__construct();
+        $this->agentSiteLogic = new AgentSiteLogic();
+        $this->agentListLogic = new AgentListLogic();
+        $this->gameLogic = new GameLogic();
+        $this->systemUserLogic = new SystemUserLogic();
+    }
+
+    /**
+     * 数据列表
+     * @param Request $request
+     * @return Response
+     */
+    public function index(Request $request): Response
+    {
+        $where = $request->more([
+            ['tdate', ''],
+            ['game_id', ''],
+            ['media_id', ''],
+            ['agent_id', ''],
+            ['site_id', ''],
+            ['auth_id', ''],
+            ['add_type', ''],
+            ['remark', ''],
+            ['create_time', ''],
+        ]);
+        $query = $this->logic->search($where);
+        
+        
+        // 游戏权限过滤
+        if($request->get('auth_game_list')){
+            $gameIds = explode(',', $request->get('auth_game_list'));
+            $query->whereIn('game_id', $gameIds);
+        }
+
+        $data = $this->logic->getList($query)['data'];
+
+        $data = $this->logic->trandformListColumn($data, ['site', 'agent', 'game', 'auth']);
+      
+        return $this->success($data);
+    }
+
+    /**
+     * 保存媒体消耗
+     */
+    public function save(Request $request): Response
+    {
+        $data = $request->post();
+        $this->logic->save($data);
+        return $this->success();
+    }
+
+}

+ 47 - 0
app/v1/controller/advert/MediaListController.php

@@ -0,0 +1,47 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\controller\advert;
+
+use plugin\saiadmin\basic\BaseController;
+use app\v1\logic\advert\MediaListLogic;
+use app\v1\validate\advert\MediaListValidate;
+use support\Request;
+use support\Response;
+
+/**
+ * 广告媒体表控制器
+ */
+class MediaListController extends BaseController
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->logic = new MediaListLogic();
+        $this->validate = new MediaListValidate;
+        parent::__construct();
+    }
+
+    /**
+     * 数据列表
+     * @param Request $request
+     * @return Response
+     */
+    public function index(Request $request): Response
+    {
+        $where = $request->more([
+            ['id', ''],
+            ['name', ''],
+            ['channel_name', ''],
+        ]);
+        $query = $this->logic->search($where);
+        $data = $this->logic->getList($query);
+        return $this->success($data);
+    }
+
+}

+ 0 - 57
app/v1/controller/center/CommonController.php

@@ -1,57 +0,0 @@
-<?php
-namespace app\v1\controller\center;
-
-use app\v1\logic\center\GameLogic;
-use plugin\saiadmin\basic\BaseController;
-use app\v1\logic\center\GameMainLogic;
-use support\Request;
-use support\Response;
-
-/**
- * 公共接口管理控制器
- */
-class CommonController extends BaseController
-{
-    protected $gameMainLogic;
-    protected $gameLogic;
-
-    /**
-     * 构造函数
-     */
-    public function __construct()
-    {
-        parent::__construct();
-        $this->gameMainLogic = new GameMainLogic();
-        $this->gameLogic = new GameLogic();
-    }
-    
-    /**
-     * 获取主游戏options列表
-     * @return Response
-     */
-    public function getMainGameOptions(Request $request): Response
-    {
-        $data = $this->gameMainLogic->getMainGameOptions();
-        return $this->success($data);
-    }
-
-    /**
-     * 获取子游戏options列表
-     * @return Response
-     */
-    public function getGameOptions(Request $request): Response
-    {
-        $data = $this->gameLogic->getGameOptions();
-        return $this->success($data);
-    }
-
-    /**
-     * 获取树形游戏options列表
-     * @return Response
-     */
-    public function getTreeGameOptions(Request $request): Response
-    {
-        $data = $this->gameLogic->getGameListByPermission();
-        return $this->success($data);
-    }
-}

+ 43 - 22
app/v1/controller/center/GameController.php

@@ -41,7 +41,6 @@ class GameController extends BaseController
     public function index(Request $request): Response
     {
         $where = $request->more([
-            ['id', ''],
             ['main_id', ''],
             ['name', ''],
             ['os', ''],
@@ -59,15 +58,18 @@ class GameController extends BaseController
     public function addGame(Request $request): Response
     {
         $data = $request->post();
-
-        // 如果主游戏ID改变,则获取主游戏KEY
-        if($data['main_game_id']){
-            $game_info = $this->logic->read($data['main_game_id']);
-            $data['appkey'] = $game_info['appkey'];
-            $data['login_key'] = $game_info['login_key'];
-            $data['pay_key'] = $game_info['pay_key'];
+        $cp_callback_type = $data['cp_callback_type'];
+        if($cp_callback_type == 1){
+            // 读取主游戏的KEY
+            if(!$data['main_game_id']){
+                return $this->fail('请选择主游戏');
+            }
+            $main_game_info = $this->logic->read($data['main_game_id']);
+            $data['appkey'] = $main_game_info['appkey'];
+            $data['login_key'] = $main_game_info['login_key'];
+            $data['pay_key'] = $main_game_info['pay_key'];
         }else{
-            // 如果主游戏ID为空,则生成新的KEY
+            // 生成新的KEY
             $data['appkey'] = md5('appkey'.uniqid());
             $data['login_key'] = md5('login_key'.uniqid());
             $data['pay_key'] = md5('pay_key'.uniqid());
@@ -83,19 +85,37 @@ class GameController extends BaseController
     {
         $data = $request->post();
        
-        // 如果主游戏ID改变,则获取主游戏KEY
-        if($data['main_game_id']){
-            $game_info = $this->logic->read($data['main_game_id']);
-            $data['appkey'] = $game_info['appkey'];
-            $data['login_key'] = $game_info['login_key'];
-            $data['pay_key'] = $game_info['pay_key'];
-        }else{
-            // 如果主游戏ID为空,则生成新的KEY
-            $data['appkey'] = md5('appkey'.uniqid());
-            $data['login_key'] = md5('login_key'.uniqid());
-            $data['pay_key'] = md5('pay_key'.uniqid());
-        }
+        $game_info = $this->logic->read($id);
 
+        $cp_callback_type = $data['cp_callback_type'];
+        $game_info_cp_callback_type = $game_info['cp_callback_type'];
+        $main_game_id = $data['main_game_id'];
+        $game_info_main_game_id = $game_info['main_game_id'];
+
+        // 如果主游戏ID改变,并且游戏发货规则为1,则获取主游戏KEY
+        if(($main_game_id !== $game_info_main_game_id) && $cp_callback_type===1){
+             $main_game_info = $this->logic->read($main_game_id);
+             $data['appkey'] = $main_game_info['appkey'];
+             $data['login_key'] = $main_game_info['login_key'];
+             $data['pay_key'] = $main_game_info['pay_key'];
+             $this->logic->edit($id,$data);
+        }else if($cp_callback_type !== $game_info_cp_callback_type){
+            // 如果游戏发货规则改变,则根据规则生成新的KEY
+            if($cp_callback_type == 0){
+                // 如果是独立KEY, 则生成新的KEY
+                $data['appkey'] = md5('appkey'.uniqid());
+                $data['login_key'] = md5('login_key'.uniqid());
+                $data['pay_key'] = md5('pay_key'.uniqid());
+            }else{
+                // 如果是主游戏KEY, 则获取主游戏KEY
+                $appkey = $this->logic->read($main_game_id)['appkey'];
+                $login_key = $this->logic->read($main_game_id)['login_key'];
+                $pay_key = $this->logic->read($main_game_id)['pay_key'];
+                $data['appkey'] = $appkey;
+                $data['login_key'] = $login_key;
+                $data['pay_key'] = $pay_key;
+            }
+        }
         $this->logic->edit($id, $data);
         return $this->success();
     }
@@ -105,7 +125,8 @@ class GameController extends BaseController
      */
     public function getAllGameData(Request $request): Response
     {
-        $list = $this->logic->getAllGameData();
+        $where = $request->get();
+        $list = $this->logic->getAllGameData($where);
         return $this->success($list);
     }
 

+ 46 - 0
app/v1/controller/center/IosPayWayController.php

@@ -0,0 +1,46 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\controller\center;
+
+use plugin\saiadmin\basic\BaseController;
+use app\v1\logic\center\IosPayWayLogic;
+use app\v1\validate\center\IosPayWayValidate;
+use support\Request;
+use support\Response;
+
+/**
+ * ios切支付控制器
+ */
+class IosPayWayController extends BaseController
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->logic = new IosPayWayLogic();
+        $this->validate = new IosPayWayValidate;
+        parent::__construct();
+    }
+
+    /**
+     * 数据列表
+     * @param Request $request
+     * @return Response
+     */
+    public function index(Request $request): Response
+    {
+        $where = $request->more([
+            ['game_id', ''],
+        ]);
+        $query = $this->logic->search($where);
+        $data = $this->logic->getList($query);
+        $data['data'] = $this->logic->trandformListColumn($data['data'], ['game']);
+        return $this->success($data);
+    }
+
+}

+ 45 - 0
app/v1/controller/center/QxSwitchController.php

@@ -0,0 +1,45 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\controller\center;
+
+use plugin\saiadmin\basic\BaseController;
+use app\v1\logic\center\QxSwitchLogic;
+use app\v1\validate\center\QxSwitchValidate;
+use support\Request;
+use support\Response;
+
+/**
+ * 权限开关控制器
+ */
+class QxSwitchController extends BaseController
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->logic = new QxSwitchLogic();
+        $this->validate = new QxSwitchValidate;
+        parent::__construct();
+    }
+
+    /**
+     * 数据列表
+     * @param Request $request
+     * @return Response
+     */
+    public function index(Request $request): Response
+    {
+        $where = $request->more([
+            ['package_name', ''],
+        ]);
+        $query = $this->logic->search($where);
+        $data = $this->logic->getList($query);
+        return $this->success($data);
+    }
+
+}

+ 101 - 0
app/v1/controller/customer/AccountController.php

@@ -0,0 +1,101 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\controller\customer;
+
+use plugin\saiadmin\basic\BaseController;
+use app\v1\logic\customer\AccountLogic;
+use app\v1\validate\customer\AccountValidate;
+use support\Request;
+use support\Response;
+
+/**
+ * 账号信息控制器
+ */
+class AccountController extends BaseController
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->logic = new AccountLogic();
+        $this->validate = new AccountValidate;
+        parent::__construct();
+    }
+
+    /**
+     * 数据列表
+     * @param Request $request
+     * @return Response
+     */
+    public function index(Request $request): Response
+    {
+        $where = $request->more([
+            ['val', ''],
+            ['type', '']
+        ]);
+        // $query = $this->logic->search($where);
+        // $data = $this->logic->getList($query);
+        $data = $this->logic->list($where);
+        return $this->success($data);
+    }
+
+    /**
+     * 修改密码
+     */
+    public function updatePwd(Request $request): Response
+    {
+        $data = $request->post();
+       
+        $data = $this->logic->updatePwd($data);
+        return $this->success();
+    }
+
+    /**
+     * 修改手机
+     */
+    public function updateMobile(Request $request): Response
+    {
+        $data = $request->post();
+        $data = $this->logic->updateMobile($data);
+        return $this->success();
+    }
+
+    /**
+     * 修改真实名
+     */
+    public function updateReal(Request $request): Response
+    {
+        $data = $request->post();
+        $data = $this->logic->updateReal($data);
+        return $this->success();
+    }
+
+    /**
+     * 封禁列表
+     */
+    public function getBanList(Request $request){
+        $where = $request->more([
+            ['action', '']
+        ]);
+        $query = $this->logic->search($where);
+        $data = $this->logic->getBanList($query);
+        return $this->success($data);
+    }
+
+    /**
+     * 添加/解除封禁
+     */
+    public function saveBan(Request $request): Response
+    {
+        $data = $request->post();
+        $info = getCurrentInfo();
+        $data['auth_id'] = $info['id'];
+        $data = $this->logic->saveBan($data);
+        return $this->success();
+    }
+}

+ 64 - 0
app/v1/controller/customer/RoleDataController.php

@@ -0,0 +1,64 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\controller\customer;
+
+use plugin\saiadmin\basic\BaseController;
+use app\v1\logic\customer\RoleDataLogic;
+use app\v1\validate\customer\RoleDataValidate;
+use support\Request;
+use support\Response;
+
+/**
+ * 角色查询控制器
+ */
+class RoleDataController extends BaseController
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->logic = new RoleDataLogic();
+        $this->validate = new RoleDataValidate;
+        parent::__construct();
+    }
+
+    /**
+     * 数据列表
+     * @param Request $request
+     * @return Response
+     */
+    public function index(Request $request): Response
+    {
+        $where = $request->more([
+            ['game_id', ''],
+            ['user_name', ''],
+            ['uid', ''],
+            ['role_id', ''],
+            ['role_name', ''],
+        ]);
+        if (empty($where['user_name']) && empty($where['uid']) && empty($where['role_id']) && empty($where['role_name'])) {
+            return $this->fail('请填写用户信息或者角色信息');
+        }
+        $query = $this->logic->search($where);
+        // $data = $this->logic->getList($query);
+        $data = $this->logic->getRoleList($query);
+        return $this->success($data);
+    }
+
+    /**
+     * 更新
+     * @param Request $request
+     * @return Response
+     */
+    public function update(Request $request, $id): Response
+    {
+      
+        $data = $this->logic->update($id, $request->post());
+        return $this->success($data);
+    }
+}

+ 72 - 0
app/v1/controller/customer/SdkOrderController.php

@@ -0,0 +1,72 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\controller\customer;
+
+use plugin\saiadmin\basic\BaseController;
+use app\v1\logic\customer\SdkOrderLogic;
+use app\v1\validate\customer\SdkOrderValidate;
+use support\Request;
+use support\Response;
+
+/**
+ * 用户订单记录控制器
+ */
+class SdkOrderController extends BaseController
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->logic = new SdkOrderLogic();
+        $this->validate = new SdkOrderValidate;
+        parent::__construct();
+    }
+
+    /**
+     * 数据列表
+     * @param Request $request
+     * @return Response
+     */
+    public function index(Request $request): Response
+    {
+        $where = $request->more([
+            ['orderid', ''],
+            ['tradeid', ''],
+            ['game_id', ''],
+            ['user_name', ''],
+            ['role_id', ''],
+            ['pay_date', ''],
+            ['orderBy', ''],
+            ['orderType', ''],
+            ['page',''],
+            ['limit','']
+        ]);
+        // 账号名|订单号|交易订单号 不能同时为空
+        if(empty($where['user_name']) && empty($where['orderid']) && empty($where['tradeid'])){
+            return $this->fail('账号名|订单号|交易订单号 不能同时为空');
+        }
+        // $query = $this->logic->search($where);
+        // $data = $this->logic->getList($query);
+        $data = $this->logic->getOrderList($where);
+        return $this->success($data);
+    }
+
+    /**
+     * 补发
+     * @param Request $request
+     * @return Response
+     */
+
+    public function send(Request $request): Response
+    {
+        $orderid = $request->input('orderid');
+        $data = $this->logic->send($orderid);
+        return $this->success($data);
+    }
+
+}

+ 61 - 0
app/v1/controller/gameLog/GamePackLogController.php

@@ -0,0 +1,61 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\controller\gameLog;
+
+use plugin\saiadmin\basic\BaseController;
+use app\v1\logic\gameLog\GamePackLogLogic;
+use app\v1\validate\gameLog\GamePackLogValidate;
+use support\Request;
+use support\Response;
+
+/**
+ * 打包记录控制器
+ */
+class GamePackLogController extends BaseController
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->logic = new GamePackLogLogic();
+        $this->validate = new GamePackLogValidate;
+        parent::__construct();
+    }
+
+    /**
+     * 数据列表
+     * @param Request $request
+     * @return Response
+     */
+    public function index(Request $request): Response
+    {
+        $where = $request->more([
+            ['game_id', ''],
+            ['agent_id', ''],
+            ['site_id', ''],
+        ]);
+        $query = $this->logic->search($where);
+        $data = $this->logic->getList($query);
+        $data['data'] = $this->logic->trandformListColumn($data['data'],['agent','site','game']);
+        return $this->success($data);
+    }
+
+    /**
+     * 批量打包
+     * @param Request $request
+     * @return Response
+     */
+    public function batchSave(Request $request): Response
+    {
+        $data = $request->all();
+        $res = $this->logic->batchSave($data);
+        return $this->success();
+    }
+
+
+}

+ 48 - 0
app/v1/controller/gameLog/GamePackageController.php

@@ -0,0 +1,48 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\controller\gameLog;
+
+use plugin\saiadmin\basic\BaseController;
+use app\v1\logic\gameLog\GamePackageLogic;
+use app\v1\validate\gameLog\GamePackageValidate;
+use support\Request;
+use support\Response;
+
+/**
+ * 母包管理控制器
+ */
+class GamePackageController extends BaseController
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->logic = new GamePackageLogic();
+        $this->validate = new GamePackageValidate;
+        parent::__construct();
+    }
+
+    /**
+     * 数据列表
+     * @param Request $request
+     * @return Response
+     */
+    public function index(Request $request): Response
+    {
+        $where = $request->more([
+            ['media_id', ''],
+            ['game_id', ''],
+        ]);
+
+        $query = $this->logic->search($where);
+        $data = $this->logic->getList($query);
+        $data = $this->logic->trandformListColumn($data['data'], ['media', 'game']);
+        return $this->success($data);
+    }
+
+}

+ 40 - 0
app/v1/logic/advert/AgentListLogic.php

@@ -0,0 +1,40 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\logic\advert;
+
+use plugin\saiadmin\basic\BaseLogic;
+use plugin\saiadmin\exception\ApiException;
+use plugin\saiadmin\utils\Helper;
+use app\v1\model\advert\AgentList;
+use plugin\saiadmin\service\OpenSpoutWriter;
+use support\think\Db;
+
+/**
+ * 渠道管理逻辑层
+ */
+class AgentListLogic extends BaseLogic
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->model = new AgentList();
+    }
+
+    /**
+     * 查询渠道列表Options
+     */
+    public function getAgentOptions()
+    {
+        $data = $this->model->select()->toArray();
+
+        return $data;
+    }
+
+    
+}

+ 295 - 0
app/v1/logic/advert/AgentSiteLogic.php

@@ -0,0 +1,295 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\logic\advert;
+
+use app\v1\logic\gameLog\GamePackageLogic;
+use plugin\saiadmin\basic\BaseLogic;
+use plugin\saiadmin\exception\ApiException;
+use plugin\saiadmin\utils\Helper;
+use app\v1\model\advert\AgentSite;
+use GuzzleHttp\Client;
+
+use Illuminate\Support\Facades\Http;
+use plugin\saiadmin\service\OpenSpoutWriter;
+
+use support\think\Db;
+
+/**
+ * 广告位列表逻辑层
+ */
+class AgentSiteLogic extends BaseLogic
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->model = new AgentSite();
+    }
+
+    /**
+     * 获取广告位options
+     */
+    public function getAgentSiteOptions()
+    {
+        $data = $this->model->select()->toArray();
+        return $data;
+    }
+
+    /**
+     * 获取头条账号列表
+     */
+    public function getTtAccountList()
+    {
+        $data = Db::connect('db_advert')->table('ad_jrtt_account_list')->where('status', 1)->select()->toArray();
+        return $data;
+    }
+
+    /**
+     * 根据广告位IDS集合获取广告位数据  
+     */
+    public function getAgentSiteListBySiteIds($site_ids = [])
+    {
+        $data = $this->model->whereIn('id', $site_ids)->select()->toArray();
+        return $data;
+    }
+
+
+    /**
+     * 导出分包标识数据
+     */
+    public function exportGamePackageKs($data = [])
+    {
+        $file_name = $data['title'].'_标识数据_'.date('YmdHis').'.xlsx';
+        $header = $data['title']=='快手分包' ? ['渠道','备注'] : ['备注','渠道'];
+        $data = array_map(function($item){
+            return [
+                'agent_id' => explode(',', $item)[0],
+                'remark' => explode(',', $item)[1]
+            ];
+        }, $data['data']);
+       
+        $writer = new OpenSpoutWriter($file_name);
+        $writer->setWidth([15, 15]);
+        $writer->setHeader($header);
+        $writer->setData($data);
+        $file_path = $writer->returnFile();
+        return response()->download($file_path, urlencode($file_name));
+    }
+
+    /**
+     * 获取头条推送的access_token
+     */
+    public function getTtAccessToken($advertiser_id)
+    {
+        $data = Db::connect('db_advert')->table('ad_jrtt_account')->where('advertiser_id', $advertiser_id)->where('status', 1)->value('access_token');
+        return $data;
+    }
+
+    /**
+     * 获取头条媒体配置
+     */
+    public function getTtMediaConfig()
+    {
+        $data = Db::connect('db_advert')->table('media_list')->where('state', 1)->where('name','今日头条')->select()->toArray();
+        return $data;
+    }
+
+    /**
+     * 获取头条媒体配置
+     */
+    public function getTtAssetid($data = [])
+    {
+        $data = Db::connect('db_advert_log')->table('ad_jrtt_asset')->where('game_id', $data['game_id'])->where('advertiser_id', $data['advertiser_id'])->value('assets_id');
+        return $data;
+    }
+
+    /**
+     * 头条推送事件
+     */
+    public function ttPushNewEvent($data = [])
+    {
+        // 获取头条的游戏
+        $toutiaoGameData = (new GamePackageLogic())->getToutiaoGames();
+
+        // 广告位ID集合
+        $site_ids = $data['site_ids'];
+        // 平台的游戏ID
+        $game_id = $data['game_id'];
+        // 分包标识
+        $fb = $data['fb'];
+        // 推送转化跟踪
+        $zh = $data['zh'];
+        // 头条广告主ID
+        $advertiser_id = $data['advertiser_id'];
+        // 成功数
+        $succ = $succ2 = 0;
+        // 失败数
+        $fail = $fail2 = 0;
+
+        // 广告位数据
+        $agentSiteList = [];
+
+        // 错误数组
+        $error = [];
+
+        // 检查广告位是否传入
+        if(empty($site_ids)){
+            throw new ApiException('请选择广告位');
+        }
+
+        // 获取广告位数据
+        $agentSiteList =  $this->getAgentSiteListBySiteIds($site_ids);
+        if(!$agentSiteList){
+            throw new ApiException('广告位数据错误');
+        }
+        $agentSiteList = array_column($agentSiteList, null, 'id');
+
+        print_r('agentSiteList');
+        print_r($agentSiteList);
+        
+        // 检查游戏是否为头条媒体的母包
+        if(!$game_id || !$toutiaoGameData[$game_id]){
+            throw new ApiException('请选择推送的头条游戏');
+        }
+        // 检查广告位是否为头条媒体的广告位
+        $siteData = (new AgentSiteLogic())->getAgentSiteOptions();
+        $siteData = array_column($siteData, null, 'id');
+        $site_ids = explode(',', $site_ids);
+        foreach($site_ids as $site_id){
+            if($siteData[$site_id]['media_id']!=1){
+                throw new ApiException('请选择头条媒体的广告位');
+            }
+        }
+
+        // 推送头条分包
+        if($fb){
+             // 头条游戏平台
+             $os = $toutiaoGameData[$game_id]['game_os'];
+             if($os == 2){
+                throw new ApiException('IOS不能推送分包');
+             }
+             // 获取头条的access_token
+                $access_token = $this->getTtAccessToken($advertiser_id);
+               
+                if(!$access_token){
+                    throw new ApiException('推送头条的-access_token获取失败');
+                }
+                $header = [
+                    'Access-Token' => $access_token,
+                    'Content-Type' => 'application/json',
+                ];
+                $list = [];
+                
+                foreach ($site_ids as $val) {
+                
+                    $list[] = [
+                        // 渠道ID = 平台游戏ID_渠道ID_广告位ID
+                        'channel_id' => $game_id.'_'.$agentSiteList[$val]['agent_id'].'_'.$val,
+                        // 备注 = 平台游戏名称-广告位ID
+                        'remark'     => $toutiaoGameData[$game_id]['name'].'-'.$val,
+                    ];
+
+                    //记录提交信息
+                    $values = [
+                        'game_id'       => $game_id,
+                        'agent_id'      => $agentSiteList[$val]['agent_id'],
+                        'site_id'       => $val,
+                        'advertiser_id' => $advertiser_id,
+                        'package_id'    => $toutiaoGameData[$game_id]['tt_package_id'],
+                        'remark'        => $toutiaoGameData[$game_id]['name'].'-'.$val,
+                    ];
+
+                    
+                    Db::connect('db_advert_log')->table('ad_jrtt_channel_package')->insert($values);
+                   
+                }
+                // 推送给头条数据
+                $pushData = [
+                    'account_id' => $advertiser_id,
+                    'package_id' => $toutiaoGameData[$game_id]['tt_package_id'],
+                    'channel_list' => $list,
+                    'mode' => 'Manual',
+                ];
+                 $url = 'https://ad.oceanengine.com/open_api/2/tools/app_management/extend_package/create/';
+                // 发送请求
+
+                $client = new Client();
+                $headers = [
+                    'Access-Token' => $access_token,
+                    'Content-Type'  => 'application/json'
+                ];
+
+                // 发起 POST 请求
+                $response = $client->post($url, [
+                    'headers' => $headers,
+                    'json'    => $pushData, // 如果是 application/json
+                ]);
+
+                // 获取响应内容
+                $body = $response->getBody()->getContents();
+                $result = json_decode($body, true);
+               
+                 if($result['message']=='OK'){
+                    $succ = "成功";
+                 } else {
+                    $error[] = "请求:".json_encode($pushData, 256) ."结果:".json_encode($result, 256);
+                    $succ = '失败';
+                 }
+        }
+        // 推送转化跟踪
+        if($zh){
+            // assetId
+             $asset_id  = $this->getTtAssetid(['game_id'=>$game_id,'advertiser_id'=>$advertiser_id]);
+             if(!$asset_id){    
+                throw new ApiException('推送头条的-asset_id获取失败');
+             }
+             $mediaArr = $this->getTtMediaConfig();
+             print_r('mediaArr');
+             print_r($mediaArr);
+            
+             foreach ($site_ids as $val) {
+                    $site_id = $val;
+                    $agent_id = $agentSiteList[$val]['agent_id'];
+                    $group_name = $toutiaoGameData[$game_id]['name'].'_'.$val;
+                   // $error 长度
+                   if(count($error)>0){
+                        $fail2++;
+                        continue;
+                   }
+
+                    if($toutiaoGameData[$game_id]['ios_appid']>0){
+                        $apiurl = $mediaArr[0]['iosurl'];
+                        $downloadurl = 'https://itunes.apple.com/cn/app/id'.$toutiaoGameData[$game_id]['ios_appid'];
+                    } else {
+                        $apiurl = $mediaArr[0]['andurl'];
+                        $downloadurl = 'https://apps.bytesfield.com/download/extend/cur/'.$toutiaoGameData[$game_id]['tt_package_id'].'/'.$toutiaoGameData[$game_id]['id'].'_'.$agent_id.'_'.$val;
+                    }
+                    $yfinfo = $game_id.'_'.$agent_id.'_'.$site_id;
+                    $click_url = str_replace('__YFINFO__', $yfinfo, $apiurl);
+                    $values = [
+                        'game_id'       => $game_id,
+                        'gid'           => $game_id,
+                        'agent_id'      => $agent_id,
+                        'site_id'       => $site_id,
+                        'advertiser_id' => $advertiser_id,
+                        'assets_id'     => $asset_id,
+                        'download_url'  => $downloadurl,
+                        'click_url'     => $click_url,
+                        'group_name'    => $group_name,
+                    ];
+                    $result = Db::connect('db_advert_log')->table('ad_jrtt_asset')->insert($values);
+                    if($result){
+                        $succ2 ++;
+                    } else {
+                        $fail2 ++;
+                    }
+                }
+            } 
+        return ['message' => "分包推送".$succ.",转化推送成功".$succ2.",失败".$fail2];
+    }
+}

+ 51 - 0
app/v1/logic/advert/MediaCostLogic.php

@@ -0,0 +1,51 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\logic\advert;
+
+use app\v1\logic\center\GameLogic;
+use plugin\saiadmin\basic\BaseLogic;
+use plugin\saiadmin\exception\ApiException;
+use plugin\saiadmin\utils\Helper;
+use app\v1\model\advert\MediaCost;
+use plugin\saiadmin\app\logic\system\SystemUserLogic;
+
+/**
+ * 媒体消耗逻辑层
+ */
+class MediaCostLogic extends BaseLogic
+{
+    protected $agentSiteLogic;
+    protected $agentListLogic;
+    protected $gameLogic;
+    protected $systemUserLogic;
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->model = new MediaCost();
+        $this->agentSiteLogic = new AgentSiteLogic();
+        $this->agentListLogic = new AgentListLogic();
+        $this->gameLogic = new GameLogic();
+        $this->systemUserLogic = new SystemUserLogic();
+    }
+
+
+
+    /**
+     * 保存媒体消耗
+     */
+    public function save($data)
+    {
+        $site_id = $data['site_id'];
+        $site_info = $this->agentSiteLogic->read($site_id);
+        $auth_id = $site_info['auth_id'];
+        $data['auth_id'] = $auth_id;
+        $this->model->save($data);
+    }
+
+}

+ 35 - 0
app/v1/logic/advert/MediaListLogic.php

@@ -0,0 +1,35 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\logic\advert;
+
+use plugin\saiadmin\basic\BaseLogic;
+use plugin\saiadmin\exception\ApiException;
+use plugin\saiadmin\utils\Helper;
+use app\v1\model\advert\MediaList;
+
+/**
+ * 广告媒体表逻辑层
+ */
+class MediaListLogic extends BaseLogic
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->model = new MediaList();
+    }
+
+    /**
+     * 查询媒体列表Options
+     */
+    public function getMediaOptions()
+    {
+        $data = $this->model->select();
+        return $data;
+    }
+}

+ 99 - 17
app/v1/logic/center/GameLogic.php

@@ -36,7 +36,12 @@ class GameLogic extends BaseLogic
      */
     public function getIndex($where)
     {
+        $auth_game_list = request()->header('auth_game_list');
         $query = $this->search($where);
+        if(!empty($auth_game_list)) {
+            $authGameList = explode(',', $auth_game_list);
+            $query->where('id', 'in', $authGameList);
+        }
         $query->order('sort', 'desc');
 
         $data = $this->getList($query);
@@ -49,27 +54,46 @@ class GameLogic extends BaseLogic
     }
 
     /**
-     * 获取游戏options列表
+     * 获取游戏options列表(有权限)
      * @return array
      */
-    public function getGameOptions()
+    public function getGameOptions($where)
     {
-        $list = $this->model->field('id,name')->where('status', 1)->order('sort', 'desc')->select()->toArray();
-        $list = array_map(function ($item) {
-            return [
-                'label' => $item['name'],
-                'value' => $item['id']
-            ];
-        }, $list);
+        $auth_game_list = request()->header('auth_game_list');
+        $query = $this->search($where);
+        if(!empty($auth_game_list)) {
+            $authGameList = explode(',', $auth_game_list);
+            $query->where('id', 'in', $authGameList);
+        }
+        $list = $query->select()->toArray();
+        return $list;
+    }
+
+    /**
+     * 获取游戏options列表(无权限)
+     * @return array
+     */
+    public function getGameOptionsNoAuth($where)
+    {
+        $query = $this->search($where);
+        $list = $query->select()->toArray();
         return $list;
     }
     
     /**
      * 获取所有的游戏数据
      */
-    public function getAllGameData()
+    public function getAllGameData($where)
     {
-        $game_list = $this->model->where('status', 1)->order('sort', 'desc')->select()->toArray();
+        $auth_game_list = request()->header('auth_game_list');
+        $query = $this->search($where);
+        if(!empty($auth_game_list)) {
+            $authGameList = explode(',', $auth_game_list);
+            $query->where('id', 'in', $authGameList);
+        }
+        $query->where('status', 1);
+        $query->order('sort', 'desc');
+        $game_list = $this->getList($query);
 
         $mainGameMap = $this->gameMainLogic->getMainGameMap();
         
@@ -80,7 +104,7 @@ class GameLogic extends BaseLogic
             $groupedGames[$mainId]['name'] = $mainGameMap[$mainId] ?? $mainId;
             $groupedGames[$mainId]['children'][] = [
                 'id' => $game['id'],
-                'name' => '【'.$game['id'].'】'.$game['name']
+                'name' => '['.$game['id'].']'.$game['name']
             ];
          }
         return array_values($groupedGames);
@@ -89,12 +113,71 @@ class GameLogic extends BaseLogic
     /**
      * 根据权限获取游戏列表
      */
-    public function getGameListByPermission()
+    public function getGameListByPermission($where)
     {
-        $game_list = $this->getAllGameData();
-        return $game_list;
+        $auth_game_list = request()->header('auth_game_list');
+        $query = $this->search($where);
+        if(!empty($auth_game_list)) {
+            $authGameList = explode(',', $auth_game_list);
+            $query->where('id', 'in', $authGameList);
+        }
+        $query->where('status', 1);
+        $query->order('sort', 'desc');
+        return $query->select()->toArray();
     }
 
+    /**
+     * 根据权限获取游戏列表树形(无权限)
+     */
+    public function getGameListTreeNoAuth($where)
+    {
+ 
+        $game_list = $this->model->where('status', 1)->order('sort', 'desc')->select()->toArray();
+        $mainGameMap = $this->gameMainLogic->getMainGameMap();
+        $groupedGames = [];
+        foreach ($game_list as $game) {
+            $mainId = $game['main_id'];
+            $groupedGames[$mainId]['id'] = 'main_id_'.$mainId;
+            $groupedGames[$mainId]['disabled'] = ($where['single'] ?? false);
+            $groupedGames[$mainId]['name'] = $mainGameMap[$mainId] ?? $mainId;
+            $groupedGames[$mainId]['children'][] = [
+                'id' => $game['id'],
+                'name' => '['.$game['id'].']'.$game['name']
+            ];
+        }
+        return array_values($groupedGames);
+    }
+
+    /**
+     * 根据权限获取游戏列表树形(有权限)
+     */
+    public function getGameListTree($where)
+    {
+        $auth_game_list = request()->header('auth_game_list');
+        $query = $this->search();
+        if(!empty($auth_game_list)) {
+            $authGameList = explode(',', $auth_game_list);
+            $query->where('id', 'in', $authGameList);
+        }
+        $query->where('status', 1);
+        $query->order('sort', 'desc');
+        $game_list = $query->select()->toArray();
+        $mainGameMap = $this->gameMainLogic->getMainGameMap();
+        $groupedGames = [];
+        foreach ($game_list as $game) {
+            $mainId = $game['main_id'];
+            $groupedGames[$mainId]['id'] = 'main_id_'.$mainId;
+            $groupedGames[$mainId]['disabled'] = ($where['single'] ?? false);
+            $groupedGames[$mainId]['name'] = $mainGameMap[$mainId] ?? $mainId;
+            $groupedGames[$mainId]['children'][] = [
+                'id' => $game['id'],
+                'name' => '['.$game['id'].']'.$game['name']
+            ];
+        }
+        return array_values($groupedGames);
+    }
+
+
     /**
      * 根据部门ID获取游戏列表
      * @param array $where
@@ -119,7 +202,7 @@ class GameLogic extends BaseLogic
             $groupedGames[$mainId]['name'] = $mainGameMap[$mainId] ?? $mainId;
             $groupedGames[$mainId]['children'][] = [
                 'id' => $game['id'],
-                'name' => '【'.$game['id'].'】'.$game['name']
+                'name' => '['.$game['id'].']'.$game['name']
             ];
          }
         return array_values($groupedGames);
@@ -136,5 +219,4 @@ class GameLogic extends BaseLogic
         $this->systemDeptLogic->setGameListByDeptId($dept_id, $game_list);
     }
 
-   
 }

+ 27 - 0
app/v1/logic/center/IosPayWayLogic.php

@@ -0,0 +1,27 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\logic\center;
+
+use plugin\saiadmin\basic\BaseLogic;
+use plugin\saiadmin\exception\ApiException;
+use plugin\saiadmin\utils\Helper;
+use app\v1\model\center\IosPayWay;
+
+/**
+ * ios切支付逻辑层
+ */
+class IosPayWayLogic extends BaseLogic
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->model = new IosPayWay();
+    }
+
+}

+ 27 - 0
app/v1/logic/center/QxSwitchLogic.php

@@ -0,0 +1,27 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\logic\center;
+
+use plugin\saiadmin\basic\BaseLogic;
+use plugin\saiadmin\exception\ApiException;
+use plugin\saiadmin\utils\Helper;
+use app\v1\model\center\QxSwitch;
+
+/**
+ * 权限开关逻辑层
+ */
+class QxSwitchLogic extends BaseLogic
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->model = new QxSwitch();
+    }
+
+}

+ 164 - 0
app/v1/logic/customer/AccountLogic.php

@@ -0,0 +1,164 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\logic\customer;
+
+use plugin\saiadmin\basic\BaseLogic;
+use plugin\saiadmin\exception\ApiException;
+use plugin\saiadmin\utils\Helper;
+use app\v1\model\customer\Account;
+
+use support\Redis;
+use support\think\Db;
+
+/**
+ * 账号信息逻辑层
+ */
+class AccountLogic extends BaseLogic
+
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->model = new Account();
+    }
+
+     /**
+     * 获取IP地理位置
+     */
+    public function getIpLocation($ip): string
+    {
+        $ip2region = new \Ip2Region();
+        try {
+            $region = $ip2region->memorySearch($ip);
+        } catch (\Exception $e) {
+            return '未知';
+        }
+        list($country, $number, $province, $city, $network) = explode('|', $region['region']);
+        if ($network === '内网IP') {
+            return $network;
+        }
+        if ($country == '中国') {
+            return $province.'-'.$city.':'.$network;
+        } else if ($country == '0') {
+            return '未知';
+        } else {
+            return $country;
+        }
+    }
+    
+    /**
+     * 列表
+     */
+    public function list($query)
+    {
+        if($query['type'] == '1'){
+            $uid = Db::connect('db_origin')->table('users')->where('user_name', $query['val'])->value('uid');
+            $data = Db::connect('db_origin')->table('user_'.$uid%10)->where('uid', $uid)->select()->toArray();
+        }else{
+            $data = Db::connect('db_origin')->table('user_'.$query['val']%10)->where('uid', $query['val'])->select()->toArray();
+        }
+
+        print_r($data);
+        $data = array_map(function($item){
+            $item['login_ip'] = $item['login_ip'].$this->getIpLocation($item['login_ip']);
+            $item['reg_ip'] = $item['reg_ip'].$this->getIpLocation($item['reg_ip']);
+            $item['reg_time'] = date('Y-m-d H:i:s', $item['reg_time']);
+            $item['login_time'] = date('Y-m-d H:i:s', $item['login_time']);
+            unset($item['user_pwd']);
+            return $item;
+        }, $data);
+
+        return $data;
+    }
+
+    /**
+     * 修改密码
+     */
+    public function updatePwd($data)
+    {
+        $user_pwd = password_hash($data['user_pwd'], PASSWORD_DEFAULT);
+        print_r($data);
+        $result = Db::connect('db_origin')->table('user_'.$data['uid']%10)->where('uid', $data['uid'])->update(['user_pwd' => $user_pwd]);
+        return $result;
+    }
+
+    /**
+     * 修改手机
+     */
+    public function updateMobile($data)
+    {
+        $result = Db::connect('db_origin')->table('user_'.$data['uid']%10)->where('uid', $data['uid'])->update(['mobile' => $data['mobile']]);
+        return $result;
+    }
+
+    /**
+     * 修改真实名
+     */
+    public function updateReal($data)
+    {
+        $result = Db::connect('db_origin')->table('user_'.$data['uid']%10)->where('uid', $data['uid'])->update(['real_name' => $data['real_name'], 'id_card' => $data['id_card']]);
+        return $result;
+    }
+
+    /**
+     * 封禁列表 
+     */
+    public function getBanList($query)
+    {
+        $saiType = request()->input('saiType', 'list');
+        $page = request()->input('page', 1);
+        $limit = request()->input('limit', 10);
+        $orderBy = request()->input('orderBy', '');
+        $orderType = request()->input('orderType', $this->orderType);
+        if(empty($orderBy)) {
+            $orderBy = $this->orderField !== '' ? $this->orderField : $this->model->getPk();
+        }
+        if ($saiType === 'all') {
+            $data = Db::connect('db_game_log')->table('ban_log')->where($query)->order($orderBy, $orderType)->select()->toArray();
+        }
+        $data = Db::connect('db_game_log')->table('ban_log')->where($query)->order($orderBy, $orderType)->paginate($limit, false, ['page' => $page])->toArray();
+
+
+        $data['data'] = array_map(function($item) {
+            $item['action'] = $item['action'] == 1 ? '封禁' : '解封';
+            $item['type'] = $item['type'] == 1 ? 'UID' : ($item['type'] == 2 ? 'IP' : '设备');
+            return $item;
+        }, $data['data']);
+        $data['data'] = $this->trandformListColumn($data['data'],['auth']);
+       return $data;
+    }
+
+    /**
+     * 添加/解除封禁
+     */
+    public function saveBan($data)
+    {
+        $type = $data['type']; // 封禁类型
+        $value = $data['value']; // 封禁值
+        $action = $data['action']; // 操作
+        $reason = $data['reason']; // 理由
+        $auth_id = $data['auth_id']; // 操作人
+
+
+        $data = Db::connect('db_game_log')->table('ban_log')->insert([
+            'type' => $type,
+            'value' => $value,
+            'action' => $action,
+            'reason' => $reason,
+            'auth_id' => $auth_id,
+        ]);
+        // 如果成功插入,则更新redis
+        if($data){
+            $key = $type==1 ? 'ban_uid' : ($type==2 ? 'ban_ip' : ($type==3 ? 'ban_device' : ''));
+            $value = explode(',', $value);
+            $action == 1 ? Redis::sAdd($key, ...$value) : Redis::sRem($key, ...$value);
+        }
+        return $data;
+    }
+}

+ 98 - 0
app/v1/logic/customer/RoleDataLogic.php

@@ -0,0 +1,98 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\logic\customer;
+
+use plugin\saiadmin\basic\BaseLogic;
+use plugin\saiadmin\exception\ApiException;
+use plugin\saiadmin\utils\Helper;
+use app\v1\model\customer\RoleData;
+use support\think\Db;
+
+/**
+ * 角色查询逻辑层
+ */
+class RoleDataLogic extends BaseLogic
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->model = new RoleData();
+    }
+
+    /**
+     * 获取角色查询列表
+     */
+    public function getRoleList($query)
+    {
+        // 获取android数据
+        $table_and = Db::connect('db_game_log')->table('role_data_and')->field('* , "android" as platform')->where($query)->select()->toArray();
+        // 获取ios数据
+        $table_ios = Db::connect('db_game_log')->table('role_data_ios')->field('* , "ios" as platform')->where($query)->select()->toArray();
+
+        // 合并两个表的数据
+        $data = array_merge($table_and, $table_ios);
+
+        // 1. 根据game_id 查找 main_id
+        $game_ids = array_unique(array_column($data, 'game_id'));
+        $main_id_arr = Db::connect('db_center')->table('pf_game')->whereIn('id', $game_ids)->column('main_id','id');
+
+
+        $data = array_map(function($item) use ($main_id_arr){
+           // 最后登录时间
+           $item['login_time'] = Db::connect('db_origin')->table('agent_reg_'.$item['uid']%10)->where('main_id', $main_id_arr[$item['game_id']])->where('uid', $item['uid'])->value('login_time');
+           $item['login_time'] = date('Y-m-d H:i:s', $item['login_time']);
+           // 支付记录
+           $pay_data = Db::connect('db_game_log')->table('sdk_order_success')->where('game_id', $item['game_id'])->where('uid', $item['uid'])->where('role_id', $item['role_id'])->order('pay_date', 'desc');
+           // 最新的一条支付记录时间
+           $item['last_recharge_time'] =  $pay_data->value('pay_date');
+           // 累计充值
+           $item['total_recharge'] = $pay_data->sum('money');
+
+           return $item;
+        }, $data);
+
+
+
+
+
+
+
+
+
+
+        $data = $this->trandformListColumn($data,['game','media','site', 'agent']);
+
+        return $data;
+
+    }
+
+    /**
+     * 更新
+     */
+    public function update($id, $data)
+    {
+        $platform = $data['platform'];
+        $table = $platform === 'android' ? 'role_data_and' : 'role_data_ios';
+        
+        // 移除platform字段,避免更新到数据库
+        unset($data['platform']);
+        
+        // 直接使用Db更新指定表的数据
+        $result = Db::connect('db_game_log')
+            ->table($table)
+            ->where('id', $id)
+            ->update($data);
+            
+        if ($result === false) {
+            throw new ApiException('更新失败');
+        }
+        
+        return $result;
+    }
+}

+ 152 - 0
app/v1/logic/customer/SdkOrderLogic.php

@@ -0,0 +1,152 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\logic\customer;
+
+use plugin\saiadmin\basic\BaseLogic;
+use plugin\saiadmin\exception\ApiException;
+use plugin\saiadmin\utils\Helper;
+use app\v1\model\customer\SdkOrder;
+use DateTime;
+use support\Redis;
+use support\think\Db;
+
+/**
+ * 用户订单记录逻辑层
+ */
+class SdkOrderLogic extends BaseLogic
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->model = new SdkOrder();
+    }
+
+    /**
+     * 获取年月
+     */
+    public function queryOrdersByDateRange($start, $end)
+    {
+            $start = new DateTime($start);
+            $end = new DateTime($end);
+            $end->modify('first day of next month');
+
+            $months = [];
+            while ($start < $end) {
+                $months[] = $start->format('Ym'); // 例如 202505
+                $start->modify('+1 month');
+            }
+            return $months;
+    }
+
+    /**
+     * 获取订单列表
+     */
+    public function getOrderList($where)
+    {
+    $startDate = $where['pay_date'][0];
+    $endDate = $where['pay_date'][1];
+    $page       = max(1, (int)($where['page'] ?? 1));
+    $limit      = max(1, (int)($where['limit'] ?? 10));
+    $offset     = ($page - 1) * $limit;
+    $orderBy =   $where['orderBy'] ? $where['orderBy'] : 'pay_date';
+    $orderType = $where['orderType'] ? $where['orderType'] : 'DESC';
+    $orderBy = $orderBy . ' ' . $orderType;
+
+       // 获取年月
+        $table_name_array = $this->queryOrdersByDateRange($startDate, $endDate);
+       
+        // 合并表 union all
+        
+        $where_sql = "";
+        if(!empty($where['game_id'])){
+            $where_sql .= " AND game_id IN({$where['game_id']})";
+        }
+        if(!empty($where['user_name'])){
+            $where_sql .= " AND user_name = '{$where['user_name']}'";
+        }
+        if(!empty($where['order_id'])){
+            $where_sql .= " AND order_id = '{$where['order_id']}'";
+        }
+        if(!empty($where['trade_id'])){
+            $where_sql .= " AND trade_id = '{$where['trade_id']}'";
+        }
+        if(!empty($where['role_id'])){
+            $where_sql .= " AND role_id = '{$where['role_id']}'";
+        }
+        if(!empty($where['role_name'])){
+            $where_sql .= " AND role_name = '{$where['role_name']}'";
+        }
+        if(!empty($where['pay_date'])){
+            $where_sql .= " AND pay_date BETWEEN '{$startDate} 00:00:00' AND '{$endDate} 23:59:59'";
+        }
+        $sql_parts = [];
+        foreach($table_name_array as $table_name){
+            // 安全过滤,避免 SQL 注入
+            if (!preg_match('/^\d{6}$/', $table_name)) {
+                continue;
+            }
+            $sql_parts[] = "SELECT * FROM sdk_order_{$table_name} WHERE 1=1 {$where_sql}";
+        }
+        if (empty($sql_parts)) {
+            return []; // 或抛异常,或返回空结果
+        }
+
+        $unionSql = implode(" UNION ALL ", $sql_parts);
+
+        // 外层包裹分页、排序
+        $finalSql = "
+            SELECT * FROM ( {$unionSql} ) AS all_orders
+            ORDER BY {$orderBy}
+            LIMIT {$offset}, {$limit}
+        ";
+
+        // 统计总数(用于分页)
+        $countSql = "
+            SELECT COUNT(*) AS total FROM ( {$unionSql} ) AS count_orders
+        ";
+
+        // 总金额查询
+        $sumSql = "
+            SELECT ROUND(SUM(money), 2) AS money_sum FROM (
+                {$unionSql}
+            ) AS sum_orders
+        ";
+    
+        $count = Db::connect('db_game_log')->query($countSql)[0]['total'] ?? 0;
+
+        $data = Db::connect('db_game_log')->query($finalSql);
+
+        $moneySum   = Db::connect('db_game_log')->query($sumSql)[0]['money_sum'] ?? 0;
+
+        $data = $this->trandformListColumn($data,['game','pay_channel']);
+
+
+        return [
+            'total'         => $count,
+            'current_page'  => $page,
+            'per_page'      => $limit,
+            'last_page'     => ceil($count / $limit),
+            'has_more'      => $page < ceil($count / $limit),
+            'data'          => $data,
+            'totalRow'     => $moneySum
+        ];
+   
+   
+   
+    }
+
+    /**
+     * 补发
+     */
+    public function send($orderid)
+    {
+      $res = Redis::lpush("request_cp_callback_queue", $orderid);
+      return $res;
+    }
+}

+ 39 - 0
app/v1/logic/gameLog/GamePackLogLogic.php

@@ -0,0 +1,39 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\logic\gameLog;
+
+use plugin\saiadmin\basic\BaseLogic;
+use plugin\saiadmin\exception\ApiException;
+use plugin\saiadmin\utils\Helper;
+use app\v1\model\gameLog\GamePackLog;
+use Illuminate\Support\Facades\Date;
+use plugin\saiadmin\service\OpenSpoutWriter;
+
+/**
+ * 打包记录逻辑层
+ */
+class GamePackLogLogic extends BaseLogic
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->model = new GamePackLog();
+    }
+    
+    /**
+     * 批量打包
+     */
+    public function batchSave($data)
+    {
+        $res = $this->model->insertAll($data);
+        return $res;
+    }
+
+
+}

+ 47 - 0
app/v1/logic/gameLog/GamePackageLogic.php

@@ -0,0 +1,47 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\logic\gameLog;
+
+use plugin\saiadmin\basic\BaseLogic;
+use plugin\saiadmin\exception\ApiException;
+use plugin\saiadmin\utils\Helper;
+use app\v1\model\gameLog\GamePackage;
+
+/**
+ * 母包管理逻辑层
+ */
+class GamePackageLogic extends BaseLogic
+{
+    /**
+     * 构造函数
+     */
+    public function __construct()
+    {
+        $this->model = new GamePackage();
+    }
+
+    /**
+     * 获取母包Options
+     */
+    public function getPackageOptions($where = [])
+    {
+        $data = $this->model->where($where)->select()->toArray();
+        return $data;
+    }
+
+    /**
+     * 获取头条游戏
+     */
+    public function getToutiaoGames()
+    {
+        $data = $this->model->where('media_id', 1)->select()->toArray();
+        $data = $this->trandformListColumn($data, ['game']);
+        // 以game_id为key,value为数组
+        $data = array_column($data, null, 'game_id');
+        return $data;
+    }
+}

+ 10 - 9
app/v1/middleware/FilterPermission.php

@@ -11,6 +11,8 @@ use Webman\MiddlewareInterface;
  */
 class FilterPermission implements MiddlewareInterface
 {
+   
+
     public function process(Request $request, callable $handler) : Response
     {
 
@@ -23,14 +25,16 @@ class FilterPermission implements MiddlewareInterface
         $userAuthCache = new UserInfoCache($token['id']);
         $user_info = $userAuthCache->getUserInfo();
 
+        // $user_info = $this->systemUserLogic->read($token['id']);
+
         // 获取游戏数据权限
-        $auth_game_list = $user_info['game_list'] ?? -1;
+        $auth_game_list = $user_info['game_list'] ?? '';
 
         // 获取游戏自然量数据权限
-        $auth_normal_game_list = $user_info['normal_game_list'] ?? -1;
+        $auth_normal_game_list = $user_info['normal_game_list'] ?? '';
 
-        // 获取游戏自然量数据权限
-        $auth_ad_permission = $user_info['ad_permission'] ?? -1;
+        // 获取广告投放数据权限
+        $auth_ad_permission = $user_info['ad_permission'] ?? '';
 
         // 追加参数逻辑
         $extraParams = [
@@ -40,11 +44,8 @@ class FilterPermission implements MiddlewareInterface
         ];
        
         // 合并并设置回 request
-        if ($method === 'GET') {
-            $request->setGet(array_merge($request->get(), $extraParams));
-        } elseif ($method === 'POST') {
-            $request->setPost(array_merge($request->post(), $extraParams));
-        }
+        $origin_header = $request->header();
+        $request->setHeader(array_merge($origin_header, $extraParams));
 
         return $handler($request);
     }

+ 42 - 0
app/v1/model/advert/AgentList.php

@@ -0,0 +1,42 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\model\advert;
+
+use plugin\saiadmin\basic\BaseNormalModel;
+
+/**
+ * 渠道管理模型
+ */
+class AgentList extends BaseNormalModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 数据库表名称
+     * @var string
+     */
+    protected $table = 'agent_list';
+
+    /**
+     * 数据库连接
+     * @var string
+     */
+    protected $connection = 'db_advert';
+
+    /**
+     * 渠道名称 搜索
+     */
+    public function searchNameAttr($query, $value)
+    {
+        $query->where('name', 'like', '%'.$value.'%');
+    }
+
+}

+ 42 - 0
app/v1/model/advert/AgentSite.php

@@ -0,0 +1,42 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\model\advert;
+
+use plugin\saiadmin\basic\BaseNormalModel;
+
+/**
+ * 广告位列表模型
+ */
+class AgentSite extends BaseNormalModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 数据库表名称
+     * @var string
+     */
+    protected $table = 'agent_site';
+
+    /**
+     * 数据库连接
+     * @var string
+     */
+    protected $connection = 'db_advert';
+
+    /**
+     * 广告位名称 搜索
+     */
+    public function searchNameAttr($query, $value)
+    {
+        $query->where('name', 'like', '%'.$value.'%');
+    }
+
+}

+ 50 - 0
app/v1/model/advert/MediaCost.php

@@ -0,0 +1,50 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\model\advert;
+
+use plugin\saiadmin\basic\BaseNormalModel;
+
+/**
+ * 媒体消耗模型
+ */
+class MediaCost extends BaseNormalModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 数据库表名称
+     * @var string
+     */
+    protected $table = 'media_cost';
+
+    /**
+     * 数据库连接
+     * @var string
+     */
+    protected $connection = 'db_advert';
+
+    /**
+     * 结算日期 搜索
+     */
+    public function searchTdateAttr($query, $value)
+    {
+        $query->whereTime('tdate', 'between', $value);
+    }
+
+    /**
+     * 录入时间 搜索
+     */
+    public function searchCreateTimeAttr($query, $value)
+    {
+        $query->whereTime('create_time', 'between', $value);
+    }
+
+}

+ 50 - 0
app/v1/model/advert/MediaList.php

@@ -0,0 +1,50 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\model\advert;
+
+use plugin\saiadmin\basic\BaseNormalModel;
+
+/**
+ * 广告媒体表模型
+ */
+class MediaList extends BaseNormalModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 数据库表名称
+     * @var string
+     */
+    protected $table = 'media_list';
+
+    /**
+     * 数据库连接
+     * @var string
+     */
+    protected $connection = 'db_advert';
+
+    /**
+     * 媒体名称 搜索
+     */
+    public function searchNameAttr($query, $value)
+    {
+        $query->where('name', 'like', '%'.$value.'%');
+    }
+
+    /**
+     * 媒体渠道简称 搜索
+     */
+    public function searchChannelNameAttr($query, $value)
+    {
+        $query->where('channel_name', 'like', '%'.$value.'%');
+    }
+
+}

+ 34 - 0
app/v1/model/center/IosPayWay.php

@@ -0,0 +1,34 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\model\center;
+
+use plugin\saiadmin\basic\BaseNormalModel;
+
+/**
+ * ios切支付模型
+ */
+class IosPayWay extends BaseNormalModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 数据库表名称
+     * @var string
+     */
+    protected $table = 'ios_pay_way';
+
+    /**
+     * 数据库连接
+     * @var string
+     */
+    protected $connection = 'db_center';
+
+}

+ 42 - 0
app/v1/model/center/QxSwitch.php

@@ -0,0 +1,42 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\model\center;
+
+use plugin\saiadmin\basic\BaseNormalModel;
+
+/**
+ * 权限开关模型
+ */
+class QxSwitch extends BaseNormalModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 数据库表名称
+     * @var string
+     */
+    protected $table = 'qx_switch';
+
+    /**
+     * 数据库连接
+     * @var string
+     */
+    protected $connection = 'db_center';
+
+    /**
+     * 包名 搜索
+     */
+    public function searchPackageNameAttr($query, $value)
+    {
+        $query->where('package_name', 'like', '%'.$value.'%');
+    }
+
+}

+ 50 - 0
app/v1/model/customer/Account.php

@@ -0,0 +1,50 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\model\customer;
+
+use plugin\saiadmin\basic\BaseNormalModel;
+
+/**
+ * 账号信息模型
+ */
+class Account extends BaseNormalModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 数据库表名称
+     * @var string
+     */
+    protected $table = 'user_0';
+
+    /**
+     * 数据库连接
+     * @var string
+     */
+    protected $connection = 'db_origin';
+
+    /**
+     * 用户名 搜索
+     */
+    public function searchUserNameAttr($query, $value)
+    {
+        $query->where('user_name', 'like', '%'.$value.'%');
+    }
+
+    /**
+     * 用户真实名 搜索
+     */
+    public function searchRealNameAttr($query, $value)
+    {
+        $query->where('real_name', 'like', '%'.$value.'%');
+    }
+
+}

+ 61 - 0
app/v1/model/customer/RoleData.php

@@ -0,0 +1,61 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\model\customer;
+
+use plugin\saiadmin\basic\BaseNormalModel;
+
+/**
+ * 角色查询模型
+ */
+class RoleData extends BaseNormalModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 数据库表名称
+     * @var string
+     */
+    protected $table = 'role_data_and';
+
+    /**
+     * 数据库连接
+     * @var string
+     */
+    protected $connection = 'db_game_log';
+
+    /**
+     * 用户名 搜索
+     */
+    public function searchUserNameAttr($query, $value)
+    {
+        $query->where('user_name', 'like', '%'.$value.'%');
+    }
+
+    /**
+     * 角色名 搜索
+     */
+    public function searchRoleNameAttr($query, $value)
+    {
+        $query->where('role_name', 'like', '%'.$value.'%');
+    }
+
+     /**
+     * 游戏ID搜索器
+     */
+    public function searchGameIdAttr($query, $value)
+    {
+        if (is_array($value)) {
+            $query->whereIn('game_id', $value);
+        } else {
+            $query->where('game_id', $value);
+        }
+    }
+}

+ 42 - 0
app/v1/model/customer/SdkOrder.php

@@ -0,0 +1,42 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\model\customer;
+
+use plugin\saiadmin\basic\BaseNormalModel;
+
+/**
+ * 用户订单记录模型
+ */
+class SdkOrder extends BaseNormalModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 数据库表名称
+     * @var string
+     */
+    protected $table = 'sdk_order_202507';
+
+    /**
+     * 数据库连接
+     * @var string
+     */
+    protected $connection = 'db_game_log';
+
+    /**
+     * 支付时间 搜索
+     */
+    public function searchPayDateAttr($query, $value)
+    {
+        $query->whereTime('pay_date', 'between', $value);
+    }
+
+}

+ 42 - 0
app/v1/model/gameLog/GamePackLog.php

@@ -0,0 +1,42 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\model\gameLog;
+
+use plugin\saiadmin\basic\BaseNormalModel;
+
+/**
+ * 打包记录模型
+ */
+class GamePackLog extends BaseNormalModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 数据库表名称
+     * @var string
+     */
+    protected $table = 'game_pack_log';
+
+    /**
+     * 数据库连接
+     * @var string
+     */
+    protected $connection = 'db_game_log';
+
+    /**
+     * 游戏名 搜索
+     */
+    public function searchGameNameAttr($query, $value)
+    {
+        $query->where('game_name', 'like', '%'.$value.'%');
+    }
+
+}

+ 34 - 0
app/v1/model/gameLog/GamePackage.php

@@ -0,0 +1,34 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\model\gameLog;
+
+use plugin\saiadmin\basic\BaseNormalModel;
+
+/**
+ * 母包管理模型
+ */
+class GamePackage extends BaseNormalModel
+{
+    /**
+     * 数据表主键
+     * @var string
+     */
+    protected $pk = 'id';
+
+    /**
+     * 数据库表名称
+     * @var string
+     */
+    protected $table = 'game_package';
+
+    /**
+     * 数据库连接
+     * @var string
+     */
+    protected $connection = 'db_game_log';
+
+}

+ 50 - 0
app/v1/validate/advert/AgentListValidate.php

@@ -0,0 +1,50 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\validate\advert;
+
+use think\Validate;
+
+/**
+ * 渠道管理验证器
+ */
+class AgentListValidate extends Validate
+{
+    /**
+     * 定义验证规则
+     */
+    protected $rule =   [
+        'auth_id' => 'require',
+        'name' => 'require',
+        'media_id' => 'require',
+    ];
+
+    /**
+     * 定义错误信息
+     */
+    protected $message  =   [
+        'auth_id' => '后台归属人必须填写',
+        'name' => '渠道名称必须填写',
+        'media_id' => '媒体ID必须填写',
+    ];
+
+    /**
+     * 定义场景
+     */
+    protected $scene = [
+        'save' => [
+            'auth_id',
+            'name',
+            'media_id',
+        ],
+        'update' => [
+            'auth_id',
+            'name',
+            'media_id',
+        ],
+    ];
+
+}

+ 54 - 0
app/v1/validate/advert/AgentSiteValidate.php

@@ -0,0 +1,54 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\validate\advert;
+
+use think\Validate;
+
+/**
+ * 广告位列表验证器
+ */
+class AgentSiteValidate extends Validate
+{
+    /**
+     * 定义验证规则
+     */
+    protected $rule =   [
+        'media_id' => 'require',
+        'agent_id' => 'require',
+        'auth_id' => 'require',
+        'name' => 'require',
+    ];
+
+    /**
+     * 定义错误信息
+     */
+    protected $message  =   [
+        'media_id' => '媒体ID必须填写',
+        'agent_id' => '渠道ID必须填写',
+        'auth_id' => '负责人ID必须填写',
+        'name' => '广告位名称必须填写',
+    ];
+
+    /**
+     * 定义场景
+     */
+    protected $scene = [
+        'save' => [
+            'media_id',
+            'agent_id',
+            'auth_id',
+            'name',
+        ],
+        'update' => [
+            'media_id',
+            'agent_id',
+            'auth_id',
+            'name',
+        ],
+    ];
+
+}

+ 54 - 0
app/v1/validate/advert/MediaCostValidate.php

@@ -0,0 +1,54 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\validate\advert;
+
+use think\Validate;
+
+/**
+ * 媒体消耗验证器
+ */
+class MediaCostValidate extends Validate
+{
+    /**
+     * 定义验证规则
+     */
+    protected $rule =   [
+        'tdate' => 'require',
+        'game_id' => 'require',
+        'site_id' => 'require',
+        'money' => 'require',
+    ];
+
+    /**
+     * 定义错误信息
+     */
+    protected $message  =   [
+        'tdate' => '结算日期必须填写',
+        'game_id' => '投放游戏必须填写',
+        'site_id' => '广告位ID必须填写',
+        'money' => '消耗金额必须填写',
+    ];
+
+    /**
+     * 定义场景
+     */
+    protected $scene = [
+        'save' => [
+            'tdate',
+            'game_id',
+            'site_id',
+            'money',
+        ],
+        'update' => [
+            'tdate',
+            'game_id',
+            'site_id',
+            'money',
+        ],
+    ];
+
+}

+ 66 - 0
app/v1/validate/advert/MediaListValidate.php

@@ -0,0 +1,66 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\validate\advert;
+
+use think\Validate;
+
+/**
+ * 广告媒体表验证器
+ */
+class MediaListValidate extends Validate
+{
+    /**
+     * 定义验证规则
+     */
+    protected $rule =   [
+        'name' => 'require',
+        'channel_name' => 'require',
+        'andurl' => 'require',
+        'iosurl' => 'require',
+        'xyxurl' => 'require',
+        'appleturl' => 'require',
+        'state' => 'require',
+    ];
+
+    /**
+     * 定义错误信息
+     */
+    protected $message  =   [
+        'name' => '媒体名称必须填写',
+        'channel_name' => '媒体渠道简称必须填写',
+        'andurl' => '安卓监测链接必须填写',
+        'iosurl' => 'ios监测链接必须填写',
+        'xyxurl' => '小游戏监测链接必须填写',
+        'appleturl' => '小游戏路径参数补充必须填写',
+        'state' => '状态必须填写',
+    ];
+
+    /**
+     * 定义场景
+     */
+    protected $scene = [
+        'save' => [
+            'name',
+            'channel_name',
+            'andurl',
+            'iosurl',
+            'xyxurl',
+            'appleturl',
+            'state',
+        ],
+        'update' => [
+            'name',
+            'channel_name',
+            'andurl',
+            'iosurl',
+            'xyxurl',
+            'appleturl',
+            'state',
+        ],
+    ];
+
+}

+ 62 - 0
app/v1/validate/center/IosPayWayValidate.php

@@ -0,0 +1,62 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\validate\center;
+
+use think\Validate;
+
+/**
+ * ios切支付验证器
+ */
+class IosPayWayValidate extends Validate
+{
+    /**
+     * 定义验证规则
+     */
+    protected $rule =   [
+        'game_id' => 'require',
+        'pay_money' => 'require',
+        'pay_num' => 'require',
+        'reg_day' => 'require',
+        'apple_pay' => 'require',
+        'pay_way' => 'require',
+    ];
+
+    /**
+     * 定义错误信息
+     */
+    protected $message  =   [
+        'game_id' => '游戏名称必须填写',
+        'pay_money' => '充值金额必须填写',
+        'pay_num' => '充值次数必须填写',
+        'reg_day' => '注册天数必须填写',
+        'apple_pay' => '苹果支付必须填写',
+        'pay_way' => '充值渠道开关必须填写',
+    ];
+
+    /**
+     * 定义场景
+     */
+    protected $scene = [
+        'save' => [
+            'game_id',
+            'pay_money',
+            'pay_num',
+            'reg_day',
+            'apple_pay',
+            'pay_way',
+        ],
+        'update' => [
+            'game_id',
+            'pay_money',
+            'pay_num',
+            'reg_day',
+            'apple_pay',
+            'pay_way',
+        ],
+    ];
+
+}

+ 54 - 0
app/v1/validate/center/QxSwitchValidate.php

@@ -0,0 +1,54 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\validate\center;
+
+use think\Validate;
+
+/**
+ * 权限开关验证器
+ */
+class QxSwitchValidate extends Validate
+{
+    /**
+     * 定义验证规则
+     */
+    protected $rule =   [
+        'package_name' => 'require',
+        'qx' => 'require',
+        'ystc' => 'require',
+        'init' => 'require',
+    ];
+
+    /**
+     * 定义错误信息
+     */
+    protected $message  =   [
+        'package_name' => '包名必须填写',
+        'qx' => '咨询允许获得必须填写',
+        'ystc' => '隐私弹窗必须填写',
+        'init' => '登录框同意勾选文案必须填写',
+    ];
+
+    /**
+     * 定义场景
+     */
+    protected $scene = [
+        'save' => [
+            'package_name',
+            'qx',
+            'ystc',
+            'init',
+        ],
+        'update' => [
+            'package_name',
+            'qx',
+            'ystc',
+            'init',
+        ],
+    ];
+
+}

+ 42 - 0
app/v1/validate/customer/AccountValidate.php

@@ -0,0 +1,42 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\validate\customer;
+
+use think\Validate;
+
+/**
+ * 账号信息验证器
+ */
+class AccountValidate extends Validate
+{
+    /**
+     * 定义验证规则
+     */
+    protected $rule =   [
+     
+    ];
+
+    /**
+     * 定义错误信息
+     */
+    protected $message  =   [
+        'uid' => '用户UID必须填写',
+    ];
+
+    /**
+     * 定义场景
+     */
+    protected $scene = [
+        'save' => [
+            'uid',
+        ],
+        'update' => [
+            'uid',
+        ],
+    ];
+
+}

+ 54 - 0
app/v1/validate/customer/RoleDataValidate.php

@@ -0,0 +1,54 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\validate\customer;
+
+use think\Validate;
+
+/**
+ * 角色查询验证器
+ */
+class RoleDataValidate extends Validate
+{
+    /**
+     * 定义验证规则
+     */
+    protected $rule =   [
+        'site_id' => 'require',
+        'server_name' => 'require',
+        'user_name' => 'require',
+        'role_name' => 'require',
+    ];
+
+    /**
+     * 定义错误信息
+     */
+    protected $message  =   [
+        'site_id' => '广告位ID必须填写',
+        'server_name' => '玩家所在服务器的名称必须填写',
+        'user_name' => '用户名必须填写',
+        'role_name' => '角色名必须填写',
+    ];
+
+    /**
+     * 定义场景
+     */
+    protected $scene = [
+        'save' => [
+            'site_id',
+            'server_name',
+            'user_name',
+            'role_name',
+        ],
+        'update' => [
+            'site_id',
+            'server_name',
+            'user_name',
+            'role_name',
+        ]
+    ];
+
+}

+ 122 - 0
app/v1/validate/customer/SdkOrderValidate.php

@@ -0,0 +1,122 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\validate\customer;
+
+use think\Validate;
+
+/**
+ * 用户订单记录验证器
+ */
+class SdkOrderValidate extends Validate
+{
+    /**
+     * 定义验证规则
+     */
+    protected $rule =   [
+        'orderid' => 'require',
+        'cp_orderid' => 'require',
+        'pay_channel' => 'require',
+        'money' => 'require',
+        'paid_amount' => 'require',
+        'game_id' => 'require',
+        'media_id' => 'require',
+        'auth_id' => 'require',
+        'agent_id' => 'require',
+        'site_id' => 'require',
+        'uid' => 'require',
+        'user_name' => 'require',
+        'user_ip' => 'require',
+        'server_id' => 'require',
+        'server_name' => 'require',
+        'role_name' => 'require',
+        'payname' => 'require',
+        'pay_date' => 'require',
+        'sync_status' => 'require',
+        'send_status' => 'require',
+        'product_name' => 'require',
+    ];
+
+    /**
+     * 定义错误信息
+     */
+    protected $message  =   [
+        'orderid' => '订单号必须填写',
+        'cp_orderid' => '研发订单号必须填写',
+        'pay_channel' => '充值方式必须填写',
+        'money' => '金额必须填写',
+        'paid_amount' => '净额必须填写',
+        'game_id' => '充值游戏必须填写',
+        'media_id' => '媒体ID必须填写',
+        'auth_id' => '负责人ID必须填写',
+        'agent_id' => '渠道ID必须填写',
+        'site_id' => '广告位ID必须填写',
+        'uid' => 'UID必须填写',
+        'user_name' => '充值账号必须填写',
+        'user_ip' => '充值IP必须填写',
+        'server_id' => '服务器ID必须填写',
+        'server_name' => '充值区服必须填写',
+        'role_name' => '角色名必须填写',
+        'payname' => '必须填写',
+        'pay_date' => '支付时间必须填写',
+        'sync_status' => '支付状态必须填写',
+        'send_status' => '发货状态必须填写',
+        'product_name' => '充值商品名必须填写',
+    ];
+
+    /**
+     * 定义场景
+     */
+    protected $scene = [
+        'save' => [
+            'orderid',
+            'cp_orderid',
+            'pay_channel',
+            'money',
+            'paid_amount',
+            'game_id',
+            'media_id',
+            'auth_id',
+            'agent_id',
+            'site_id',
+            'uid',
+            'user_name',
+            'user_ip',
+            'server_id',
+            'server_name',
+            'role_name',
+            'payname',
+            'pay_date',
+            'sync_status',
+            'send_status',
+            'product_name',
+        ],
+        'update' => [
+            'orderid',
+            'cp_orderid',
+            'pay_channel',
+            'money',
+            'paid_amount',
+            'game_id',
+            'media_id',
+            'auth_id',
+            'agent_id',
+            'site_id',
+            'uid',
+            'user_name',
+            'user_ip',
+            'server_id',
+            'server_name',
+            'role_name',
+            'payname',
+            'pay_date',
+            'sync_status',
+            'send_status',
+            'product_name',
+        ],
+    ];
+
+}

+ 53 - 0
app/v1/validate/gameLog/GamePackLogValidate.php

@@ -0,0 +1,53 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\validate\gameLog;
+
+use think\Validate;
+
+/**
+ * 打包记录验证器
+ */
+class GamePackLogValidate extends Validate
+{
+    /**
+     * 定义验证规则
+     */
+    protected $rule =   [
+        'package_id' => 'require',
+    ];
+
+    /**
+     * 定义错误信息
+     */
+    protected $message  =   [
+        'package_id' => '母包ID必须填写',
+       
+    ];
+
+    /**
+     * 定义场景
+     */
+    protected $scene = [
+        'save' => [
+            'package_id',
+            'letter',
+            'game_id',
+            'agent_id',
+            'site_id',
+            'icon',
+        ],
+        'update' => [
+            'package_id',
+            'letter',
+            'game_id',
+            'agent_id',
+            'site_id',
+            'icon',
+        ],
+    ];
+
+}

+ 58 - 0
app/v1/validate/gameLog/GamePackageValidate.php

@@ -0,0 +1,58 @@
+<?php
+// +----------------------------------------------------------------------
+// | saiadmin [ saiadmin快速开发框架 ]
+// +----------------------------------------------------------------------
+// | Author: your name
+// +----------------------------------------------------------------------
+namespace app\v1\validate\gameLog;
+
+use think\Validate;
+
+/**
+ * 母包管理验证器
+ */
+class GamePackageValidate extends Validate
+{
+    /**
+     * 定义验证规则
+     */
+    protected $rule =   [
+        'media_id' => 'require',
+        'game_id' => 'require',
+        'name' => 'require',
+        'package_name' => 'require',
+        'appid' => 'require',
+    ];
+
+    /**
+     * 定义错误信息
+     */
+    protected $message  =   [
+        'media_id' => '媒体ID必须填写',
+        'game_id' => '游戏ID必须填写',
+        'name' => '母包名称必须填写',
+        'package_name' => '母包包名com.xxx必须填写',
+        'appid' => '媒体APPID必须填写',
+    ];
+
+    /**
+     * 定义场景
+     */
+    protected $scene = [
+        'save' => [
+            'media_id',
+            'game_id',
+            'name',
+            'package_name',
+            'appid',
+        ],
+        'update' => [
+            'media_id',
+            'game_id',
+            'name',
+            'package_name',
+            'appid',
+        ],
+    ];
+
+}

+ 35 - 0
config/think-orm.php

@@ -213,5 +213,40 @@ return [
                 'heartbeat_interval' => 50, // 心跳检测间隔,需要小于60秒
             ],
         ],
+        'db_advert_log' => [
+            // 数据库类型
+            'type' => getenv('DB_TYPE'),
+            // 服务器地址
+            'hostname' => getenv('DB_HOST'),
+            // 数据库名
+            'database' => getenv('DB_ADVERT_LOG'),
+            // 数据库用户名
+            'username' => getenv('DB_USER'),
+            // 数据库密码
+            'password' => getenv('DB_PASSWORD'),
+            // 数据库连接端口
+            'hostport' => getenv('DB_PORT'),
+            // 数据库连接参数
+            'params' => [
+                // 连接超时3秒
+                \PDO::ATTR_TIMEOUT => 3,
+            ],
+            // 数据库编码默认采用utf8
+            'charset' => 'utf8',
+            // 数据库表前缀
+            'prefix' => getenv('DB_PREFIX'),
+            // 断线重连
+            'break_reconnect' => true,
+            // 自定义分页类
+            'bootstrap' =>  '',
+            // 连接池配置
+            'pool' => [
+                'max_connections' => 5, // 最大连接数
+                'min_connections' => 1, // 最小连接数
+                'wait_timeout' => 3,    // 从连接池获取连接等待超时时间
+                'idle_timeout' => 60,   // 连接最大空闲时间,超过该时间会被回收
+                'heartbeat_interval' => 50, // 心跳检测间隔,需要小于60秒
+            ],
+        ],
     ],
 ];

+ 124 - 0
plugin/saiadmin/basic/BaseLogic.php

@@ -160,6 +160,71 @@ class BaseLogic
         return $this->model->withSearch($withSearch, $data);
     }
 
+    /**
+     * 根据权限搜索器
+     * @param array $searchWhere
+     * @param array $withSearch 搜索器
+     * @return mixed
+     */
+     public function searchByAuth(array $searchWhere = []): mixed
+    {
+        $withSearch = array_keys($searchWhere);
+        $data = $searchWhere;
+       
+        $auth_game_list = request()->header('auth_game_list');
+        $auth_normal_game_list = request()->header('auth_normal_game_list');
+        $auth_ad_permission = request()->header('auth_ad_permission');
+
+
+        foreach ($withSearch as $k => $v) {
+            if ($data[$v] === '') {
+                unset($data[$v]);
+                unset($withSearch[$k]);
+            }
+        }
+        
+        // 游戏权限
+        if(!empty($auth_game_list)){
+            // 如果传入的game_id存在,则取交集
+            if(!empty($data['game_id'])){
+                $data['game_id'] = array_values(array_intersect(explode(',', $data['game_id']), explode(',', $auth_game_list)));
+            }else{
+                // 如果传入的game_id不存在,则取权限中的game_id
+                $data['game_id'] =  $auth_game_list?explode(',', $auth_game_list) : '';
+            }
+        }
+           
+        // 自然量游戏权限
+        if(!empty($auth_normal_game_list)){
+            // 如果传入的game_id存在,则取交集
+            if(!empty($data['nomal_game_id'])){
+                $data['nomal_game_id'] = array_values(array_intersect(explode(',', $data['nomal_game_id']), explode(',', $auth_normal_game_list)));
+            }else{
+                // 如果传入的game_id不存在,则取权限中的game_id
+                $data['nomal_game_id'] =  $auth_normal_game_list?explode(',', $auth_normal_game_list) : '';
+            }
+        }
+            
+        // 广告数据权限
+        // 全部
+        if($auth_ad_permission==1){
+            $data['auth_id'] = '';
+        }
+        // 自己以及下面组员
+        if($auth_ad_permission==2){
+            $current_user_id = $this->adminInfo['id'];
+            $result = Db::connect('db_system')->table('sa_system_user')->field('dept_id')->where('id', $current_user_id)->select()->toArray();
+            $dept_ids = array_column($result, 'dept_id');
+            $under_user_ids = Db::connect('db_system')->table('sa_system_user')->field('id')->where('dept_id', 'in', $dept_ids)->select()->toArray();
+            $under_user_ids = array_column($under_user_ids, 'id');
+            $data['auth_id'] =  $under_user_ids;
+        }
+        
+        return $this->model->withSearch($withSearch, $data);
+    }
+
+
+    
     /**
      * 分页查询数据
      * @param $query
@@ -198,6 +263,65 @@ class BaseLogic
         return $query->select()->toArray();
     }
 
+
+    /**
+     * 转换列表列
+     * @param $data
+     * @param $fields
+     * @return mixed
+     */
+    public function trandformListColumn($data, $fields=['site', 'agent', 'game', 'auth', 'media',  'pay_channel']){
+
+        if(in_array('site', $fields)){
+            $agentSiteList = Db::connect('db_advert')->table('agent_site')->field('id,name')->select()->toArray();
+            $agentSiteList = array_column($agentSiteList, 'name', 'id');
+          
+        }
+        if(in_array('agent', $fields)){
+            $agentList = Db::connect('db_advert')->table('agent_list')->field('id,name')->select()->toArray();
+            $agentList = array_column($agentList, 'name', 'id');
+           
+        }
+        if(in_array('game', $fields)){
+            $gameList = Db::connect('db_center')->table('pf_game')->field('id,name,os,ios_appid')->select()->toArray();
+            $gameList = array_column($gameList, null, 'id');
+           
+        }
+        if(in_array('auth', $fields)){
+            $authList = Db::connect('db_system')->table('sa_system_user')->field('id,username')->select()->toArray();
+            $authList = array_column($authList, 'username', 'id');
+          
+        }
+        if(in_array('media', $fields)){
+            $mediaList = Db::connect('db_advert')->table('media_list')->field('id,name')->select()->toArray();
+            $mediaList = array_column($mediaList, 'name', 'id');
+        }
+        // if(in_array('package', $fields)){
+        //     $packageList = Db::connect('db_game_log')->table('game_package')->field('id,name')->select()->toArray();
+        //     $packageList = array_column($packageList, 'name', 'id');
+        // }
+
+        if(in_array('pay_channel', $fields)){
+            $payChannelList = Db::connect('db_center')->table('pay_channel')->field('id,name')->where('status',1)->select()->toArray();
+            $payChannelList = array_column($payChannelList, 'name', 'id');
+        }
+
+
+        foreach ($data as $key => $value) {
+    
+            $data[$key]['site_name'] = !empty($agentSiteList) ? $agentSiteList[$value['site_id']] ?? '':'';
+            $data[$key]['agent_name'] = !empty($agentList) ? $agentList[$value['agent_id']] ?? '':'';
+            $data[$key]['game_name'] = !empty($gameList) ? $gameList[$value['game_id']]['name'] ?? '':'';
+            $data[$key]['game_os'] =  !empty($gameList) ? $gameList[$value['game_id']]['os'] ?? '':'';
+            $data[$key]['ios_appid'] =  !empty($gameList) ? $gameList[$value['game_id']]['ios_appid'] ?? '':'';
+            $data[$key]['auth_name'] = !empty($authList) ? $authList[$value['auth_id']] ?? '':'';
+            $data[$key]['media_name'] = !empty($mediaList) ? $mediaList[$value['media_id']] ?? '':'';
+            // $data[$key]['package_name'] = !empty($packageList) ? $packageList[$value['package_id']] ?? '':'';
+            $data[$key]['pay_channel_name'] = !empty($payChannelList) ? $payChannelList[$value['pay_channel_id']] ?? '':'';
+        }
+        return $data;
+    }
+
     /**
      * 获取上传的导入文件
      * @param $file

+ 36 - 0
plugin/saiadmin/basic/BaseModel.php

@@ -53,4 +53,40 @@ class BaseModel extends Model
         $info && $model->setAttr('updated_by', $info['id']);
     }
 
+    /**
+     * 游戏ID搜索
+     */
+    public function searchGameIdAttr($query, $value)
+    {
+        if (is_array($value)) {
+            $query->whereIn('game_id', $value);
+        } else if($value!='') {
+            $query->where('game_id', $value);
+        }
+    }
+
+    /**
+     * 负责人ID搜索
+     */
+    public function searchAuthIdAttr($query, $value)
+    {
+        if(is_array($value)){
+            $query->whereIn('auth_id', $value);
+        }else if($value!=''){
+            $query->where('auth_id', $value);
+        }
+    }
+
+    /**
+     * ID搜索
+     */
+    public function searchIdAttr($query, $value)
+    {
+        if (is_array($value)) {
+            $query->whereIn('id', $value);
+        } else if($value!=''){
+            $query->where('id', $value);
+        }
+    }
+
 }

BIN
plugin/saiadmin/public/export/分包标识数据20250704113640.xlsx


BIN
plugin/saiadmin/public/export/分包标识数据20250704113853.xlsx


BIN
plugin/saiadmin/public/export/广点通分包_标识数据_20250704114709.xlsx


BIN
plugin/saiadmin/public/export/广点通分包_标识数据_20250704143112.xlsx


BIN
plugin/saiadmin/public/export/快手分包_分包标识数据_20250704114152.xlsx