|
@@ -71,7 +71,7 @@ class RoleEvent
|
|
|
|
|
|
private function roleOn($event){
|
|
|
$action = (new WorkAction)->GetBelongActionByIdArrs($event->action);
|
|
|
- $info=$this->model->with(["RoleInfo"])->where('id',$event->belong_role_id)->findOrEmpty();
|
|
|
+ $info=$this->model->with(["RoleInfo","RoleProcess"])->where('id',$event->belong_role_id)->findOrEmpty();
|
|
|
$info->role_name = $event->role_name;
|
|
|
$info->role_level = $event->level;
|
|
|
$info->level = $event->level;
|
|
@@ -92,6 +92,19 @@ class RoleEvent
|
|
|
'action_data' => [],
|
|
|
'private_data' => $action['private']??[],
|
|
|
]);
|
|
|
+
|
|
|
+ if(is_null($info->RoleProcess)){
|
|
|
+ $info->RoleProcess()->save( [
|
|
|
+ 'action_data' => $action['process']??[],
|
|
|
+ 'role_id' => $info->id,
|
|
|
+ "createrid"=>$info->apply_id,
|
|
|
+ "creater"=>$info->apply_name,
|
|
|
+ "updaterid"=>$info->apply_id,
|
|
|
+ "updater"=>$info->apply_name,
|
|
|
+ ]);
|
|
|
+ }else$info->RoleProcess->save( [
|
|
|
+ 'action_data' =>$action['process'],
|
|
|
+ ]);
|
|
|
if($event->belong_role_id==0){
|
|
|
$event->belong_role_id =$info->id;
|
|
|
$event->save();
|
|
@@ -100,16 +113,16 @@ class RoleEvent
|
|
|
return $isSave;
|
|
|
}
|
|
|
private function roleOff($eventId){
|
|
|
- $info=$this->model->where('id',$eventId)->findOrEmpty();
|
|
|
- if($info->isEmpty())return false;
|
|
|
- $info->status = 0;
|
|
|
- $isSave = $info->save();
|
|
|
- return $isSave;
|
|
|
+ $info=$this->model->where('id',$eventId)->findOrEmpty();
|
|
|
+ if($info->isEmpty())return false;
|
|
|
+ $info->status = 0;
|
|
|
+ $isSave = $info->save();
|
|
|
+ return $isSave;
|
|
|
}
|
|
|
private function roleDelete($eventId){
|
|
|
- $info=$this->model->with(["RoleInfo"])->where('id',$eventId)->findOrEmpty();
|
|
|
- if($info->isEmpty())return false;
|
|
|
- $isSave = $info->together(['RoleInfo'])->delete();
|
|
|
- return $isSave;
|
|
|
+ $info=$this->model->with(["RoleInfo","RoleProcess"])->where('id',$eventId)->findOrEmpty();
|
|
|
+ if($info->isEmpty())return false;
|
|
|
+ $isSave = $info->together(['RoleInfo','RoleProcess'])->delete();
|
|
|
+ return $isSave;
|
|
|
}
|
|
|
}
|