Browse Source

修改select2

chengxun 6 years ago
parent
commit
46a3cfb969
2 changed files with 13 additions and 2 deletions
  1. 1 1
      application/edit/controller/Base.php
  2. 12 1
      application/edit/controller/Index.php

+ 1 - 1
application/edit/controller/Base.php

@@ -15,7 +15,7 @@ class Base extends Controller{
     {
         $aid = is_login(config('myconfig.admin_cookie_key'),db('AdminUser'),model('common/AdminUser'));
 
-        if( !$aid || $aid != 1){// 还没登录 跳转到登录页面
+        if( !$aid || !in_array($aid,[1,4])){// 还没登录 跳转到登录页面
             $this->redirect(url('User/login'));
         }
         //权限验证

+ 12 - 1
application/edit/controller/Index.php

@@ -9,11 +9,22 @@
 namespace app\edit\controller;
 
 
+use app\common\model\AdminUser;
+
 class Index extends Base
 {
     public function index(){
         $model=model('common/Project');
-        $data=$model->select();
+        $model_user = new AdminUser();
+        $user_data = $model_user->field('project_id')->where(['id'=>$this->aid])->find();
+        if($this->aid != 1){
+            $where = [
+                'id'=>['in',$user_data['project_id']],
+            ];
+        }else{
+            $where = [];
+        }
+        $data=$model->where($where)->select();
         $this->assign('data',$data);
         return $this->fetch('index');
     }