From 20c77494a74946f95be8c2fa3148b54c273419be Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Mon, 25 Dec 2023 13:50:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=88=86=E9=94=80?= =?UTF-8?q?=E5=95=86=E7=AD=89=E7=BA=A7=E5=85=81=E8=AE=B8=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=BA0(=E6=97=A0=E7=AD=89=E7=BA=A7)=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=EF=BC=9A=E5=88=86=E9=94=80=E5=95=86=E5=88=97=E8=A1=A8=20-=20?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9=E5=90=8E=E6=9C=AA=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E4=BF=A1=E6=81=AF=EF=BC=8C=E4=BE=9D=E7=84=B6=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=BF=AE=E6=94=B9=E7=9A=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/repositories/user/UserRepository.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/common/repositories/user/UserRepository.php b/app/common/repositories/user/UserRepository.php index 150ccfb..1a2a4f0 100644 --- a/app/common/repositories/user/UserRepository.php +++ b/app/common/repositories/user/UserRepository.php @@ -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;