|
@@ -40,21 +40,47 @@ class Base extends \app\BaseController
|
|
|
$action=[];
|
|
|
$role =Db::name("role_action")->where(["role_id"=>$uid['roleid'],"status"=>1])->find();
|
|
|
$action['action_conllect']=isset($role['action_conllect'])? $role['action_conllect']:'';
|
|
|
- $action['write'][]=$uid;
|
|
|
+ $action['write'][]=$this->uid;
|
|
|
$group=[];
|
|
|
- // $group = Db::name("role_group")->where("FIND_IN_SET($uid,group_user) >0")->column("id");
|
|
|
- $share =Db::name("role_share")->where(["is_del"=>0,"status"=>1])->whereOr(["to_user"=>$this->uid,"to_group"=>$group])->select();
|
|
|
+ $group = Db::name("role_group")->where("FIND_IN_SET($this->uid,group_user) > 0")->column("id");
|
|
|
+ // echo Db::name("role_group")->getLastSql();
|
|
|
+ $where="to_user=$this->uid";
|
|
|
+ if(!empty($group)){
|
|
|
+ $where.=" or to_group in (".implode(",",$group).")";
|
|
|
+ }
|
|
|
+ // var_dump($group);
|
|
|
+ $share =Db::name("role_share")->where(["is_del"=>0,"status"=>1])->where($where) ->select();
|
|
|
+ // echo Db::name("role_share")->getLastSql();
|
|
|
if(!empty($share)){
|
|
|
foreach ($share as $value){
|
|
|
- if($value['action_collect']!=''){
|
|
|
- $act =Db::name("action")->where(['menuid'=>explode(",",$value['action_collect']),"action_code"=>'001'])->column("id");
|
|
|
- $action['action_conllect'].=empty($act)?"":",".implode(",",$act);
|
|
|
- }
|
|
|
if($value['action']==1){
|
|
|
- if($value['share_user']!="") $action['write'][]=$value['share_user'];
|
|
|
+ if($value['share_user']!=""){
|
|
|
+ $action['write'][]=$value['share_user'];
|
|
|
+ $user=Db::name("user_role")->where(['uid'=>$value['share_user'],"is_del"=>0,"status"=>1])->find();
|
|
|
+ if($user!=false){
|
|
|
+ $role =Db::name("role_action")->where(["role_id"=>$user['roleid'],"status"=>1])->find();
|
|
|
+ if($role!=false){
|
|
|
+ $conlect =Db::name("action")->where(['menuid'=>explode(",",$value['action_collect'])])->column("id");
|
|
|
+ $shar=explode(",",$value['action_collect']);
|
|
|
+ $wish =array_intersect($conlect,$shar);
|
|
|
+ $action['action_conllect'].=empty($wish)?"":",".implode(",",$wish);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
if($value['action']===0){
|
|
|
if($value['share_user']!="") $action['write'][]=$value['share_user'];
|
|
|
+ if($value['action_collect']!=''){
|
|
|
+ $act =Db::name("action")->where(['menuid'=>explode(",",$value['action_collect']),"action_code"=>'001'])->column("id");
|
|
|
+ $action['action_conllect'].=empty($act)?"":",".implode(",",$act);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($value['action']===''){
|
|
|
+ if($value['action_collect']!=''){
|
|
|
+ $act =Db::name("action")->where(['menuid'=>explode(",",$value['action_collect']),"action_code"=>'001'])->column("id");
|
|
|
+ $action['action_conllect'].=empty($act)?"":",".implode(",",$act);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|