ith5 5 kuukautta sitten
vanhempi
commit
9f4c181432

+ 4 - 3
app/v1/controller/CommonController.php

@@ -126,6 +126,7 @@ class CommonController extends BaseController
         $currentUserRoleList = $user_info['roleList'];
         $currentUserRoleList = array_column($currentUserRoleList, 'id');
 
+      
 
         // 管理员角色ID:1, 则不限制权限
         if(in_array(1,$currentUserRoleList)){
@@ -133,11 +134,11 @@ class CommonController extends BaseController
             $deptList = SystemDept::where('1=1')->select()->toArray();
         }else{
             // 看公司的广告数据权限
-            if($user_info['auth_ad_permission'] == 1){
+            if($user_info['ad_permission'] == 1){
                 $data = $this->systemUserLogic->field('id as value, username as label,dept_id')->select()->toArray();
                 $deptList = SystemDept::where('1=1')->select()->toArray();
             }
-            if($user_info['auth_ad_permission'] == 2){
+            if($user_info['ad_permission'] == 2){
                 // 看自己以及组员
                 // 1. 查看自己是哪个组
                 $deptId = $user_info['dept_id'];
@@ -145,7 +146,7 @@ class CommonController extends BaseController
                 $data = $this->systemUserLogic->field('id as value, username as label,dept_id')->where('dept_id',$deptId)->select()->toArray();
                 $deptList = SystemDept::where('id',$deptId)->select()->toArray();
             }
-            if($user_info['auth_ad_permission'] == ''){
+            if($user_info['ad_permission'] == 0){
                 // 仅看自己
                 $data = $this->systemUserLogic->field('id as value, username as label,dept_id')->where('id',$user_info['id'])->select()->toArray();
                 $deptList = SystemDept::where('id',$user_info['dept_id'])->select()->toArray();

+ 1 - 1
app/v1/middleware/FilterPermission.php

@@ -41,7 +41,7 @@ class FilterPermission implements MiddlewareInterface
         if(in_array(1,$currentUserRoleList)){
             $auth_ad_permission = 1;
         }else{
-            $auth_ad_permission = $user_info['ad_permission'] ?? '';
+            $auth_ad_permission = $user_info['ad_permission'];
         }
 
         // 追加参数逻辑

+ 3 - 4
plugin/saiadmin/app/controller/system/SystemUserController.php

@@ -60,7 +60,8 @@ class SystemUserController extends BaseController
             'sa_system_user.create_time' => 'create_time', 
             'sa_system_dept.name' => 'dept_name',
             'GROUP_CONCAT(sa_system_user_role.role_id)' => 'role_id',
-            'GROUP_CONCAT(sa_system_role.name)' => 'role_name'
+            'GROUP_CONCAT(sa_system_role.name)' => 'role_name',
+            'sa_system_user.ad_permission' => 'ad_permission'
         ]);
         $query->leftJoin('sa_system_user_role', 'sa_system_user.id = sa_system_user_role.user_id');
         $query->leftJoin('sa_system_dept', 'sa_system_user.dept_id = sa_system_dept.id');
@@ -204,9 +205,7 @@ class SystemUserController extends BaseController
         if ($normal_game_list) {
             $data['normal_game_list'] = $normal_game_list;
         }
-        if ($ad_permission) {
-            $data['ad_permission'] = $ad_permission;
-        }
+        $data['ad_permission'] = $ad_permission;
         $this->logic->authEdit($id, $data);
         $userInfoCache = new UserInfoCache($id);
         $userInfoCache->clearUserInfo();

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

@@ -172,10 +172,10 @@ class BaseLogic
         $data = $searchWhere;
        
         // 获取游戏权限
-        $auth_game_list = request()->header('auth_game_list');
+        $authGameList = request()->header('auth_game_list');
 
-        $auth_normal_game_list = request()->header('auth_normal_game_list');
-        $auth_ad_permission = request()->header('auth_ad_permission');
+        $authNormalGameList = request()->header('auth_normal_game_list');
+        $authAdPermission = request()->header('auth_ad_permission');
 
 
         foreach ($withSearch as $k => $v) {
@@ -186,39 +186,39 @@ class BaseLogic
         }
         
         // 游戏权限
-        if(!empty($auth_game_list)){
+        if(!empty($authGameList)){
             if(!empty($data['game_id'])){
                 $inputGameIds = is_array($data['game_id']) ? $data['game_id'] : explode(',', $data['game_id']);
-                $authGameIds = explode(',', $auth_game_list);
+                $authGameIds = explode(',', $authGameList);
                 $data['game_id'] = array_values(array_intersect($inputGameIds, $authGameIds));
             }else{
-                $data['game_id'] = $auth_game_list ? explode(',', $auth_game_list) : '';
+                $data['game_id'] = $authGameList ? explode(',', $authGameList) : '';
             }
         }
            
         // 自然量游戏权限
-        if(!empty($auth_normal_game_list)){
+        if(!empty($authNormalGameList)){
             // 如果传入了game_id,则取auth_normal_game_list交集
             if(!empty($data['game_id'])){
-                $data['nomal_game_id'] = array_values(array_intersect($auth_normal_game_list, $data['game_id']));
+                $data['nomal_game_id'] = array_values(array_intersect($authNormalGameList, $data['game_id']));
             }else{
-                $data['nomal_game_id'] = $auth_normal_game_list ? explode(',', $auth_normal_game_list) : '';
+                $data['nomal_game_id'] = $authNormalGameList ? explode(',', $authNormalGameList) : '';
             }
         }
 
         /**广告数据权限-开始***************************************** */
         // 广告数据权限-全公司数据
-        if($auth_ad_permission==1){
+        if($authAdPermission==1){
             // 如果传入了auth_id,则取交集
             if(!empty($data['auth_id'])){
-                $data['auth_id'] = array_values(array_intersect(explode(',', $data['auth_id']), explode(',', $auth_ad_permission)));
+                $data['auth_id'] = array_values(array_intersect(explode(',', $data['auth_id']), explode(',', $authAdPermission)));
             }else{
                 $data['auth_id'] =  '';
             }
         }
 
         // 广告数据权限-自己以及下面组员
-        if($auth_ad_permission==2){
+        if($authAdPermission==2){
             // 如果没有传入负责人ID, 则取当前用户以及下面组员
             $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();
@@ -236,7 +236,7 @@ class BaseLogic
         }
 
         // 广告数据权限-如果auth_id为空,则取当前用户
-        if($auth_ad_permission==''){
+        if($authAdPermission==0){
             $current_user_id = $this->adminInfo['id'];
             if(!empty($data['auth_id'])){
                // 如果传入了负责人ID,则取交集