From 47cdd4c92d5b37043e981ba3dcabc83ab281d8b0 Mon Sep 17 00:00:00 2001 From: jsasg <735273025@qq.com> Date: Mon, 27 Apr 2026 17:59:34 +0800 Subject: [PATCH] =?UTF-8?q?admin=20-=20=E6=96=B0=E5=A2=9E=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E5=85=A5=E4=BC=9A=E7=B1=BB=E5=9E=8Bid=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=9D=83=E7=9B=8A=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/wdsxh/member/Level.php | 24 +++++++++++++++++++ .../model/wdsxh/member/MemberBenefits.php | 7 ++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/application/admin/controller/wdsxh/member/Level.php b/application/admin/controller/wdsxh/member/Level.php index 236efce..46b2da0 100644 --- a/application/admin/controller/wdsxh/member/Level.php +++ b/application/admin/controller/wdsxh/member/Level.php @@ -107,6 +107,30 @@ class Level extends Backend $this->error(__('No rows were deleted')); } + /** + * 根据入会类型筛选权益 + * + * @param type $param + * @return type + */ + public function benefits() + { + $join_config_id = $this->request->get('join_config_id'); + $benefits = $this->benefit_model->getSimpleByStatus(0, $join_config_id); + if (empty($benefits)) { + return json([ + 'code' => 1, + 'msg' => __('No benefits found'), + 'data' => [] + ]); + } + return json([ + 'code' => 0, + 'msg' => 'success', + 'data' => $benefits, + ]); + } + /** * 添加 * diff --git a/application/admin/model/wdsxh/member/MemberBenefits.php b/application/admin/model/wdsxh/member/MemberBenefits.php index 4d07ace..7d22b66 100644 --- a/application/admin/model/wdsxh/member/MemberBenefits.php +++ b/application/admin/model/wdsxh/member/MemberBenefits.php @@ -54,12 +54,15 @@ class MemberBenefits extends Model return isset($list[$value]) ? $list[$value] : ''; } - public function getSimpleByStatus($disabled = 0) + public function getSimpleByStatus($disabled = 0, $join_config_id = null) { - return Self::field(['id', 'title'])->where(function($query) use ($disabled) { + return Self::field(['id', 'title'])->where(function($query) use ($disabled, $join_config_id) { if (null !== $disabled) { $query->where('disabled', '=', $disabled); } + if (null !== $join_config_id) { + $query->where('join_config_id', '=', $join_config_id); + } })->order('sort', 'asc')->select(); } }