From a56dc73a4ed88dde5a32bb9f8106468461522fe8 Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Thu, 24 Oct 2024 17:27:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E9=94=80=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E6=B3=A8=E5=86=8C=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/controller/distribution/Member.php | 19 +++++++ app/admin/logic/distribution/MemberLogic.php | 38 +++++++++++++ .../distribution/member/register_treaty.html | 55 +++++++++++++++++++ app/common/enum/TreatyEnum.php | 1 + 4 files changed, 113 insertions(+) create mode 100644 app/admin/view/distribution/member/register_treaty.html diff --git a/app/admin/controller/distribution/Member.php b/app/admin/controller/distribution/Member.php index fd063a7d..c819c2ff 100755 --- a/app/admin/controller/distribution/Member.php +++ b/app/admin/controller/distribution/Member.php @@ -151,6 +151,7 @@ class Member extends AdminBase } } + // 佣金提现协议 public function treaty() { if ($this->request->isAjax()) { @@ -167,4 +168,22 @@ class Member extends AdminBase 'detail' => MemberLogic::treaty() ]); } + + // 分销会员注册协议 + public function registerTreaty() + { + if ($this->request->isAjax()) { + $post = $this->request->post(); + $res = MemberLogic::registerSetTreaty($post); + if ($res === false) { + $error = MemberLogic::getError() ?: '更新失败'; + return JsonServer::error($error); + } + return JsonServer::success('更新成功'); + } + + return view('', [ + 'detail' => MemberLogic::registerTreaty() + ]); + } } \ No newline at end of file diff --git a/app/admin/logic/distribution/MemberLogic.php b/app/admin/logic/distribution/MemberLogic.php index ef95f57f..6fc42671 100755 --- a/app/admin/logic/distribution/MemberLogic.php +++ b/app/admin/logic/distribution/MemberLogic.php @@ -455,4 +455,42 @@ class MemberLogic extends Logic ->where(['type' => TreatyEnum::COMMISSION_WITHDRAWAL_TYPE]) ->findOrEmpty()->toArray(); } + + // 设置佣金提现协议 + public static function registerSetTreaty($post) + { + try { + $treaty = Treaty::where(['type'=>TreatyEnum::DISTRIBUTION_MEMBERS_TYPE])->findOrEmpty(); + $time = time(); + if($treaty->isEmpty()) { // 新增 + $addData = [ + 'name' => '分析会员注册协议', + 'content' => $post['content'] ?? '', + 'type' => TreatyEnum::DISTRIBUTION_MEMBERS_TYPE, + 'create_time' => $time, + 'update_time' => $time + ]; + Treaty::create($addData); + }else{ // 更新 + Treaty::update([ + 'name' => '分析会员注册协议', + 'content' => $post['content'] ?? '', + 'update_time' => $time + ], ['type' => TreatyEnum::DISTRIBUTION_MEMBERS_TYPE]); + } + return true; + } catch (\Exception $e) { + static::$error = $e->getMessage(); + return false; + } + } + + // 佣金提现协议 + public static function registerTreaty() + { + $model = new Treaty(); + return $model->field(true) + ->where(['type' => TreatyEnum::DISTRIBUTION_MEMBERS_TYPE]) + ->findOrEmpty()->toArray(); + } } \ No newline at end of file diff --git a/app/admin/view/distribution/member/register_treaty.html b/app/admin/view/distribution/member/register_treaty.html new file mode 100644 index 00000000..1fba1722 --- /dev/null +++ b/app/admin/view/distribution/member/register_treaty.html @@ -0,0 +1,55 @@ +{layout name="layout1" /} + +
+
+ +
+
+
+ +
+

*设置佣金提现协议。

+

*您可以在下面的编辑框中,编辑更新协议内容。

+
+
+
+
+ + +
+
+ +
+
+ +
+
+ +
+
+ + \ No newline at end of file diff --git a/app/common/enum/TreatyEnum.php b/app/common/enum/TreatyEnum.php index 85ced046..2ce34b48 100755 --- a/app/common/enum/TreatyEnum.php +++ b/app/common/enum/TreatyEnum.php @@ -25,4 +25,5 @@ class TreatyEnum const SHOP_ENTER_TYPE = 10; // 商城商家入驻协议 const LOCAL_STORE_ENTER_TYPE = 11; // 本地生活商家入驻协议 const COMMISSION_WITHDRAWAL_TYPE = 12; // 佣金提现协议 + const DISTRIBUTION_MEMBERS_TYPE = 13; // 分销会员注册协议 } \ No newline at end of file