|
@@ -3,7 +3,8 @@ declare (strict_types = 1);
|
|
|
|
|
|
namespace app\admin\controller;
|
|
|
|
|
|
-use app\BaseController;
|
|
|
+use app\admin\model\RoleGroup;
|
|
|
+use app\admin\model\RoleShare;use app\BaseController;
|
|
|
use think\App;
|
|
|
|
|
|
class Base extends BaseController
|
|
@@ -40,4 +41,39 @@ class Base extends BaseController
|
|
|
if($this->roleid==='') throw new \Exception( '没有该公司的角色','101');
|
|
|
}
|
|
|
}
|
|
|
+ public function checkRole(){
|
|
|
+ $action = [
|
|
|
+ 'action_conllect'=>'',
|
|
|
+ 'write'=>[],
|
|
|
+ 'platform'=>[],
|
|
|
+ 'roleid'=>$this->roleid
|
|
|
+ ];
|
|
|
+ if($this->level==2){
|
|
|
+ $roleinfo =\app\admin\model\RoleAction::where('roleid',$this->roleid)->findOrEmpty();
|
|
|
+ $action['action_conllect'] = $roleinfo->action_conllect;
|
|
|
+ $action['write'][] = $this->uid;
|
|
|
+ $group= RoleGroup::whereFindInSet('group_user',$this->uid)->column("id");
|
|
|
+ $where = ["to_user"=>$this->uid];
|
|
|
+ if(!empty($group)){
|
|
|
+ $where['to_group'] =$group;
|
|
|
+ }
|
|
|
+ $platform = \app\admin\model\UserPlatform::where(['uid' => $this->uid, 'is_del' => 0])->findOrEmpty();
|
|
|
+ $action['platform'] = $platform->platform??[];
|
|
|
+ $share = RoleShare::where(['is_del' => 0, 'status' => 1])->whereOr($where)->select();
|
|
|
+ if(!$share->isEmpty()){
|
|
|
+ $share->each(function ($item) use (&$action) {
|
|
|
+ switch ($item->action) {
|
|
|
+ case 1:
|
|
|
+ if($item->share_user==''){
|
|
|
+ $action['write'][] =$item->share_user;
|
|
|
+ $user = \app\admin\model\UserRole::where(["uid"=>$item->share_user,"is_del"=>0,"status"=>1])->findOrEmpty();
|
|
|
+ if(!$user->isEmpty()){
|
|
|
+ $action['write'][] =$user->roleid;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|