parent
df96d485c7
commit
20c77494a7
|
|
@ -1319,6 +1319,7 @@ class UserRepository extends BaseRepository
|
|||
$rules = [
|
||||
Elm::select($field, '级别',$data->$field)->options(function () use($type){
|
||||
$options = app()->make(UserBrokerageRepository::class)->options(['type' => $type])->toArray();
|
||||
$options = array_merge([['value'=>0,'label'=>'请选择等级']],$options);
|
||||
return $options;
|
||||
}),
|
||||
];
|
||||
|
|
@ -1332,8 +1333,10 @@ class UserRepository extends BaseRepository
|
|||
$user = $this->dao->get($id);
|
||||
$field = $type ? 'member_level' : 'brokerage_level';
|
||||
if ($data[$field] == $user->$field) return true;
|
||||
$has = $make->fieldExists('brokerage_level', $data[$field], null, $type);
|
||||
if (!$has) throw new ValidateException('等级不存在');
|
||||
if($field != 'brokerage_level'){
|
||||
$has = $make->fieldExists('brokerage_level', $data[$field], null, $type);
|
||||
if (!$has) throw new ValidateException('等级不存在');
|
||||
}
|
||||
Db::transaction(function() use($id, $data, $field, $user, $type){
|
||||
$user->$field = $data[$field];
|
||||
if ($type) $user->member_value = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue