ith5 5 місяців тому
батько
коміт
6b2ca22e90

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

@@ -10,6 +10,7 @@ use app\v1\logic\center\GameLogic;
 use plugin\saiadmin\basic\BaseController;
 use app\v1\logic\center\GameMainLogic;
 use plugin\saiadmin\app\cache\UserInfoCache;
+use plugin\saiadmin\app\logic\system\SystemConfigLogic;
 use plugin\saiadmin\app\logic\system\SystemUserLogic;
 use plugin\saiadmin\app\model\system\SystemDept;
 use support\Request;
@@ -21,6 +22,12 @@ use support\think\Db;
  */
 class CommonController extends BaseController
 {
+
+    /**
+        * 不需要登录的方法
+    */
+   protected array $noNeedLogin = ['getSystemConfig'];
+
     protected $gameMainLogic;
     protected $gameLogic;
     protected $mediaListLogic;
@@ -29,6 +36,7 @@ class CommonController extends BaseController
     protected $gamePackageLogic;
     protected $agentSiteLogic;
     protected $gameGroupLogic;
+    protected $systemConfigLogic;
 
     /**
      * 构造函数
@@ -44,6 +52,7 @@ class CommonController extends BaseController
         $this->gamePackageLogic = new GamePackageLogic();
         $this->agentSiteLogic = new AgentSiteLogic();
         $this->gameGroupLogic = new GameGroupLogic();
+        $this->systemConfigLogic = new SystemConfigLogic();
     }
 
 
@@ -292,5 +301,32 @@ class CommonController extends BaseController
         $data = $this->gameGroupLogic->getGameListOptionsByDeptId($where);
         return $this->success($data);
     }
+    
+    /**
+     * 获取产品ID, 获取游戏列表
+     */
+    public function getAllGameOptions(): Response
+    {
+        $data = $this->gameLogic->getAllGameOptions();
+        return $this->success($data);
+    }
+
+
+    /**
+     * 获取系统配置
+     * group_code: 配置组标识
+     * key: 配置key
+     * @param Request $request
+     * @return Response
+     */
+    public function getSystemConfig(Request $request): Response
+    {
+        $where = $request->more([
+            ['group_code', ''],
+            ['key', '']
+        ]);
+        $data = $this->systemConfigLogic->getSystemConfig($where);
+        return $this->success($data);
+    }
 
 }

+ 2 - 1
app/v1/controller/advert/MediaCostController.php

@@ -47,6 +47,7 @@ class MediaCostController extends BaseController
             ['tdate', ''],
             ['game_id', ''],
             ['media_id', ''],
+            ['advertiser_id', ''],
             ['agent_id', ''],
             ['site_id', ''],
             ['auth_id', ''],
@@ -65,7 +66,7 @@ class MediaCostController extends BaseController
 
         $data = $this->logic->getList($query)['data'];
 
-        $data = $this->logic->trandformListColumn($data, ['site', 'agent', 'game', 'auth']);
+        $data = $this->logic->trandformListColumn($data, ['site', 'agent', 'game', 'auth','media']);
       
         return $this->success($data);
     }

+ 20 - 0
app/v1/logic/center/GameLogic.php

@@ -73,6 +73,26 @@ class GameLogic extends BaseLogic
         return $this->getGameGroupTree($list, $hasPackage);
     }
 
+    /**
+     * 获取所有游戏
+     * @param mixed $where
+     * @return array
+     */
+    public function getAllGameOptions(): array
+    {
+        $query = $this->search([]);
+        $query->where('status', 1);
+        $list = $query->select()->toArray();
+        $data= [];
+        foreach($list as $key => $value){
+            $data[] = [
+                'value' => $value['id'],
+                'label' => '['.$value['id'].']'.$value['name']
+            ];
+        }
+        return $data;
+    }
+
     /**
      * 获取游戏options列表(无权限限制)
      * @return array

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

@@ -67,6 +67,9 @@ class AccountLogic extends BaseLogic
             $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']);
+            $item['pay_time'] = $item['pay_time'] == 0 ? '' : date('Y-m-d H:i:s', $item['pay_time']);
+            $item['id_card'] = $item['id_card'] == '' ? '' : substr($item['id_card'], 0, 4).'****'.substr($item['id_card'], -4);
+
             unset($item['user_pwd']);
             return $item;
         }, $data);

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

@@ -15,10 +15,6 @@ class MediaListValidate extends Validate
     protected $rule =   [
         'name' => 'require',
         'channel_name' => 'require',
-        'andurl' => 'require',
-        'iosurl' => 'require',
-        'xyxurl' => 'require',
-        'appleturl' => 'require',
         'state' => 'require',
     ];
 
@@ -28,10 +24,6 @@ class MediaListValidate extends Validate
     protected $message  =   [
         'name' => '媒体名称必须填写',
         'channel_name' => '媒体渠道简称必须填写',
-        'andurl' => '安卓监测链接必须填写',
-        'iosurl' => 'ios监测链接必须填写',
-        'xyxurl' => '小游戏监测链接必须填写',
-        'appleturl' => '小游戏路径参数补充必须填写',
         'state' => '状态必须填写',
     ];
 

+ 19 - 0
plugin/saiadmin/app/logic/system/SystemConfigLogic.php

@@ -12,6 +12,7 @@ use plugin\saiadmin\app\model\system\SystemConfig;
 use plugin\saiadmin\app\model\system\SystemConfigGroup;
 use support\Cache;
 use plugin\saiadmin\utils\Helper;
+use support\think\Db;
 
 /**
  * 参数配置逻辑层
@@ -45,4 +46,22 @@ class SystemConfigLogic extends BaseLogic
         return $info;
     }
 
+    /**
+     * 获取系统配置
+     */
+    public function getSystemConfig($where)
+    {
+        $groupCode = $where['group_code'];
+        $key = $where['key'];
+        $data = Db::connect('db_system')->table('sa_system_config_group')->where('code', $groupCode)->find();
+        if(empty($data)){
+            throw new ApiException('配置组不存在');
+        }
+        $data = Db::connect('db_system')->table('sa_system_config')->where('group_id', $data['id'])->where('key', $key)->find();
+        if(empty($data)){
+            throw new ApiException('配置不存在');
+        }
+        return $data;
+    }
+
 }

+ 6 - 1
plugin/saiadmin/app/logic/system/SystemUserLogic.php

@@ -99,7 +99,12 @@ class SystemUserLogic extends BaseLogic
      */
     public function edit($id, $data): mixed
     {
-        unset($data['password']);
+       
+        if(!empty($data['password'])){
+            $data['password'] = password_hash($data['password'], PASSWORD_DEFAULT);
+        }else{
+            unset($data['password']);
+        }
         return $this->transaction(function () use ($data, $id) {
             $role_ids = $data['role_ids'] ?? [];
             $post_ids = $data['post_ids'] ?? [];

+ 3 - 0
plugin/saiadmin/app/middleware/CheckAuth.php

@@ -24,6 +24,9 @@ class CheckAuth implements MiddlewareInterface
         $controller = new ReflectionClass($request->controller);
         $noNeedLogin = $controller->getDefaultProperties()['noNeedLogin'] ?? [];
 
+        print_r($request->action);
+       print_r($noNeedLogin);
+
         // 不登录访问,无需权限验证
         if (in_array($request->action, $noNeedLogin)) {
             return $handler($request);

+ 2 - 2
plugin/saiadmin/basic/BaseLogic.php

@@ -252,7 +252,7 @@ class BaseLogic
             if(!empty($data['auth_id'])){
                 $data['auth_id'][] = 0;
             }else{
-                $data['auth_id'] =  [0];
+                $data['auth_id'] =  [];
             }
         }
 
@@ -526,7 +526,7 @@ class BaseLogic
         // 负责人
         if (!empty($params['auth_id'])) {
             if (is_array($params['auth_id'])) {
-                
+
                 $whereSql .= " AND auth_id IN(" . implode(',', $params['auth_id']) . ")";
             } else {
                 $whereSql .= " AND auth_id = {$params['auth_id']}";