wugg 8 bulan lalu
induk
melakukan
ddb0fdcefc

+ 2 - 2
app/bug/controller/WorkRole.php

@@ -96,7 +96,7 @@ class WorkRole extends Base{
 		$add = $info->save();
 		$messg= \app\bug\model\WorkRole::$statusCn[$param['status']];
 		if($add==false)return error("岗位角色{$messg}失败");
-        event('role_sync',$info);
+        event('role_sync',['info_id'=>$info->id,'type'=>$param['status']==1?"on":'off']);
 		return success("岗位角色{$messg}成功");
 	}
 	public function  delete(){
@@ -107,7 +107,7 @@ class WorkRole extends Base{
         if($user->isEmpty()==false)return error('岗位角色有账户正在使用无法删除');
         $delete = $info->delete();
         if($delete==false)return error('删除失败');
-         event('role_sync',$info,"delete");
+         event('role_sync',["info_id"=>$id,"type"=>"delete"]);
         return success('删除成功');
 	}
 	

+ 7 - 1
app/bug/model/WorkAction.php

@@ -1,7 +1,7 @@
 <?php
 namespace app\bug\model;
 
-use think\model\concern\SoftDelete;
+use think\helper\Arr;use think\model\concern\SoftDelete;
 class WorkAction extends Base
 {
 //设置字段信息
@@ -112,4 +112,10 @@ class WorkAction extends Base
         if($ave->isEmpty())throw new \Exception("功能创建失败");
         return array_column($ave->toArray(),"id");
     }
+
+    public function GetBelongActionByIdArrs($IdArrs){
+         $list = $this->whereIn('id',$IdArrs)->field('belong_action')->select();
+         if($list->isEmpty())return [];
+          return array_unique(Arr::flatten($list->toArray()));
+    }
 }

+ 4 - 0
app/cxinv/model/Role.php

@@ -14,4 +14,8 @@ class Role extends Base
         'addtime'  =>'datetime',//
         'updatetime'  =>'datetime',//
        ];
+
+    public function RoleInfo(){
+      return  $this->belongsTo('RoleAction','id','role_id');
+    }
 }