|
|
|
@ -616,11 +616,20 @@ class User extends BaseController |
|
|
|
|
$id = (int)$this->request->param('uid', ''); |
|
|
|
|
if (!$this->repository->exists($id)) |
|
|
|
|
return app('json')->fail('数据不存在'); |
|
|
|
|
$is_cf = false; |
|
|
|
|
foreach ($partner_id as $k => $value) { |
|
|
|
|
$count = array_count_values($partner_id); // 统计每个元素的出现次数 |
|
|
|
|
if (isset($count[$value]) && $count[$value] > 1) { |
|
|
|
|
$is_cf = true; |
|
|
|
|
} |
|
|
|
|
$partner_ids[$k] = (int)$value; |
|
|
|
|
if (!$partnerRepository->exists((int)$value)) |
|
|
|
|
if (!$partnerRepository->exists((int)$value)) { |
|
|
|
|
return app('json')->fail('所选合作人角色不存在'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if($is_cf){ |
|
|
|
|
return app('json')->fail('请勿给用户设置重复的角色'); |
|
|
|
|
} |
|
|
|
|
foreach ($user_role_id as $k => $value) { |
|
|
|
|
$user_role_ids[$k] = (int)$value; |
|
|
|
|
if (!$partnerRepository->roleExists((int)$value)) |
|
|
|
|