wzh 5 vuotta sitten
vanhempi
commit
1924b22198
1 muutettua tiedostoa jossa 20 lisäystä ja 2 poistoa
  1. 20 2
      api/application/controllers/Lampcontrol.php

+ 20 - 2
api/application/controllers/Lampcontrol.php

@@ -27,8 +27,7 @@ class Lampcontrol extends Base_Controller {
     // 灯控列表
     public function get() {
         $userid = $this->get_user_info('id');
-        $role = $this->get_user_info('role');
-        $company = $this->input->post('company',true);
+        
 
         $project_id = intval($this->input->post('project_id', true));
         if (empty($project_id)) exit(json_result('0007',$this->response['0007']));
@@ -58,6 +57,25 @@ class Lampcontrol extends Base_Controller {
                 $filter .= ' AND P.cityid = '.$company;
             }
         }
+
+        $role = $this->get_user_info('role');
+        $company2 = $this->get_user_info('company');
+
+        if ($role != SYSTEM_ADMIN) {
+            if ($role == 2) {
+                // $filter .= ' AND L.manu = '.$company2;
+                // $countWhere[] = 'manu = '.$company2;
+            }elseif ($role == 3) {
+                $filter .= ' AND L.supplier = '.$company2;
+                $countWhere[] = 'supplier = '.$company2;
+            }elseif ($role == 4) {
+                $filter .= ' AND L.po = '.$company2;
+                $countWhere[] = 'po = '.$company2;
+            }else {
+                $filter .= ' AND P.cityid = '.$company2;
+            }
+        }
+
         if (!empty($section)) {
             $filter .= ' AND L.section = "'.$section.'"';
             $countWhere[] = 'section = "'.$section.'"';