马铁龙 hace 6 años
padre
commit
1e9e1f2952
Se han modificado 1 ficheros con 20 adiciones y 0 borrados
  1. 20 0
      application/admin/controller/Intention.php

+ 20 - 0
application/admin/controller/Intention.php

@@ -60,15 +60,35 @@ class Intention extends Backend
                 return $this->selectpage();
             }
             list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+
+            $rules = AuthGroup::getRulesByGroupId(Session::get('admin')['depart_id']);
+
+
+            if($rules == '*'){
+                $where_usr_id = false;      // 管理员可以看到所有
+            } else {
+                $auth_group = Db::table('auth_group')->select();        // 所有组别
+                $depart_id = Session::get('admin')['depart_id'];        // 所属组别
+
+                // 获取所有子级部门
+                $arr = AuthGroup::getSubs($auth_group,$depart_id);
+                array_push($arr,$depart_id);
+
+                // 只能查看自己和自己子级的保护客户和签单客户
+                $where_usr_id = ['depart_id'=>['in',$arr]];
+            }
+
             $where1 = array('isdel'=>0);
             $total = $this->model
                 ->where($where)
+                ->where($where_usr_id)
                 ->where($where1)
                 ->order($sort, $order)
                 ->count();
 
             $list = $this->model
                 ->where($where)
+                ->where($where_usr_id)
                 ->where($where1)
                 ->order($sort, $order)
                 ->limit($offset, $limit)