|
|
@@ -13,6 +13,7 @@ namespace App\Services\Common;
|
|
|
|
|
|
use App\Models\StoreModel;
|
|
|
use App\Models\UserModel;
|
|
|
+use App\Models\UserRoleModel;
|
|
|
use App\Services\BaseService;
|
|
|
|
|
|
/**
|
|
|
@@ -198,12 +199,17 @@ class StoreService extends BaseService
|
|
|
$result = $this->model->edit($data);
|
|
|
|
|
|
// 删除已存在的用户角色关系数据
|
|
|
+ $userRoleService = new UserRoleService();
|
|
|
+ $userRole = UserRoleModel::where(['user_id'=>$result,'role_id'=>6])->first();
|
|
|
if($id<=0){
|
|
|
- $userRoleService = new UserRoleService();
|
|
|
$userRoleService->deleteUserRole($result);
|
|
|
// 插入用户角色关系数据
|
|
|
$userRoleService->insertUserRole($result, [6]);
|
|
|
|
|
|
+ }else if(empty($userRole)){
|
|
|
+ $userRoleService->deleteUserRole($result);
|
|
|
+ // 插入用户角色关系数据
|
|
|
+ $userRoleService->insertUserRole($result, [6]);
|
|
|
}
|
|
|
|
|
|
return $result;
|