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