任敬轩 пре 3 месеци
родитељ
комит
843e42c6ba
1 измењених фајлова са 29 додато и 6 уклоњено
  1. 29 6
      Modules/Admin/Http/Controllers/Api/ApiController.php

+ 29 - 6
Modules/Admin/Http/Controllers/Api/ApiController.php

@@ -481,6 +481,7 @@ class ApiController extends BaseController
 
     //设备管理权限
     public function sbglRole(){
+        $id = Input::get('id', '');
         $staff_num = Input::get('staff_num', '');
         $unit_id = Input::get('unit_id', '');
         $type = Input::get('type', '');
@@ -499,16 +500,38 @@ class ApiController extends BaseController
 
         $result['status'] = true;
         $result['msg']    = ApiEnum::RETURN_SUCCESS;
-        $result['data']   = [];
+        $result['data']   = 2;//无权限
 
-        $people_list = DB::connection('mysql_fwe10')->table('uf_zhxx_sbgl_rygl')->where('ssdw',$unit_id)->where('gh',$staff_num)->where($type,0)->where('is_delete',0)->get();
-
-        if(count($people_list) > 0){
-            $result['data'] = 1;//有权限
+        if($type == 'sbgly'){
+            $people_list = DB::connection('mysql_fwe10')->table('uf_zhxx_sbgl_rygl')->where('ssdw',$unit_id)->where('gh',$staff_num)->where('sbgly',0)->where('is_delete',0)->get();
+            if(count($people_list) > 0){
+                $result['data'] = 1;//有权限
+            }
         }else{
-            $result['data'] = 2;//无权限
+            $people_list = DB::connection('mysql_fwe10')->table('uf_uf_zhxx_sbgl')->where('id',$id)->get();
+            if($type == 'xsbdhfzr' && $staff_num == $people_list[0]->xsbdhfzr){
+                $result = 1;
+            }
+            if($type == 'dxfzr' && $staff_num == $people_list[0]->dxfzr){
+                $result = 1;
+            }
+            if($type == 'jxfzr' && $staff_num == $people_list[0]->jxfzr){
+                $result = 1;
+            }
+            if($type == 'jxysfzr' && $staff_num == $people_list[0]->jxysfzr){
+                $result = 1;
+            }
+            if($type == 'dbffzr' && $staff_num == $people_list[0]->dbffzr){
+                $result = 1;
+            }
+            if($type == 'bffzr' && $staff_num == $people_list[0]->bffzr){
+                $result = 1;
+            }
         }
 
+
+
+
         return self::successResponse($result);
     }
 }