From 0471c0d2d96859c65974e480f3c42bd87386632e Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Fri, 24 Apr 2026 17:47:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=9A=E5=91=98=E7=BA=A7=E5=88=AB=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=85=B3=E8=81=94=E6=9D=83=E7=9B=8A=E5=8F=8A=E5=9B=BE?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/wdsxh/member/Level.php | 8 ++++++- .../admin/model/wdsxh/member/Level.php | 16 ++++++++------ .../model/wdsxh/member/MemberBenefits.php | 9 ++++++++ .../admin/view/wdsxh/member/level/add.html | 19 +++++++---------- .../admin/view/wdsxh/member/level/edit.html | 21 ++++++++----------- 5 files changed, 43 insertions(+), 30 deletions(-) diff --git a/application/admin/controller/wdsxh/member/Level.php b/application/admin/controller/wdsxh/member/Level.php index c392ab5..476978e 100644 --- a/application/admin/controller/wdsxh/member/Level.php +++ b/application/admin/controller/wdsxh/member/Level.php @@ -1,6 +1,6 @@ model = new \app\admin\model\wdsxh\member\Level; + $this->member_benefit_model = new \app\admin\model\wdsxh\member\MemberBenefits; $this->view->assign("statusList", $this->model->getStatusList()); $pay_method = (new FeesConfig())->where('id',1)->value('pay_method'); $this->pay_method = $pay_method; @@ -112,6 +114,8 @@ class Level extends Backend public function add() { if (false === $this->request->isPost()) { + $benefits = $this->member_benefit_model->getSimpleByStatus(0); + $this->view->assign('benefits', $benefits); return $this->view->fetch(); } $params = $this->request->post('row/a'); @@ -166,6 +170,8 @@ class Level extends Backend $this->error(__('You have no permission')); } if (false === $this->request->isPost()) { + $benefits = $this->member_benefit_model->getSimpleByStatus(0); + $this->view->assign('benefits', $benefits); $this->view->assign('row', $row); return $this->view->fetch(); } diff --git a/application/admin/model/wdsxh/member/Level.php b/application/admin/model/wdsxh/member/Level.php index c58b8e2..fbd0d60 100644 --- a/application/admin/model/wdsxh/member/Level.php +++ b/application/admin/model/wdsxh/member/Level.php @@ -1,6 +1,6 @@ 'json', + ]; + // 追加属性 protected $append = [ 'status_text' ]; - + protected static function init() { @@ -46,7 +50,7 @@ class Level extends Model }); } - + public function getStatusList() { return ['normal' => __('Status normal'), 'hidden' => __('Status hidden')]; diff --git a/application/admin/model/wdsxh/member/MemberBenefits.php b/application/admin/model/wdsxh/member/MemberBenefits.php index a810cf4..4d07ace 100644 --- a/application/admin/model/wdsxh/member/MemberBenefits.php +++ b/application/admin/model/wdsxh/member/MemberBenefits.php @@ -53,4 +53,13 @@ class MemberBenefits extends Model $list = $this->getDisabledList(); return isset($list[$value]) ? $list[$value] : ''; } + + public function getSimpleByStatus($disabled = 0) + { + return Self::field(['id', 'title'])->where(function($query) use ($disabled) { + if (null !== $disabled) { + $query->where('disabled', '=', $disabled); + } + })->order('sort', 'asc')->select(); + } } diff --git a/application/admin/view/wdsxh/member/level/add.html b/application/admin/view/wdsxh/member/level/add.html index 9bb03dd..dd82625 100644 --- a/application/admin/view/wdsxh/member/level/add.html +++ b/application/admin/view/wdsxh/member/level/add.html @@ -16,13 +16,10 @@