Browse Source

Base控制器优化

wufeng 2 years ago
parent
commit
ac2b4f178b
1 changed files with 7 additions and 5 deletions
  1. 7 5
      app/admin/controller/Base.php

+ 7 - 5
app/admin/controller/Base.php

@@ -48,12 +48,14 @@ class Base extends \app\BaseController
         if($companyNo!=""){
             $where=["companyNo"=>$companyNo];
         }
-        $user_role = Db::name("user_role")
-            ->where(["uid"=>$this->uid,"is_del"=>0])
-            ->where($where)
-            ->findOrEmpty();
-        if(empty($user_role)) return error_show(101,"没有该公司的默认角色");
 
+        if ($effetc['data']['level'] != 1) {
+            $user_role = Db::name("user_role")
+                ->where(["uid" => $this->uid, "is_del" => 0])
+                ->where($where)
+                ->findOrEmpty();
+            if (empty($user_role)) return error_show(101, "没有该公司的默认角色");
+        }
 
         $this->roleid=$user_role['roleid'];
 //        $role =Db::name("role")