From a04654afda3213d643d6bbb040fb86f141667c2a Mon Sep 17 00:00:00 2001 From: liapples Date: Thu, 26 Aug 2021 19:50:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=95=86=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MySQL_change.sql | 25 ++++++++++ .../Controllers/SettingController.php | 18 +++++++ app/AdminAgent/Forms/Setting.php | 49 +++++++++++++++++++ app/Models/AgentSetting.php | 18 +++++++ resources/lang/zh_CN/setting.php | 13 +++++ 5 files changed, 123 insertions(+) create mode 100644 app/AdminAgent/Controllers/SettingController.php create mode 100644 app/AdminAgent/Forms/Setting.php create mode 100644 app/Models/AgentSetting.php create mode 100644 resources/lang/zh_CN/setting.php diff --git a/MySQL_change.sql b/MySQL_change.sql index 85f0d54..8b839fb 100644 --- a/MySQL_change.sql +++ b/MySQL_change.sql @@ -177,3 +177,28 @@ ALTER TABLE `agent_products` # 11:07 2021/8/26 DROP TABLE `waterfall_ads`; + +# 19:25 2021/8/26 +CREATE TABLE `pay_debugs` ( + `id` INT(10) NOT NULL AUTO_INCREMENT, + `agent_id` INT(10) NOT NULL DEFAULT '0' COMMENT '代理商ID', + `type` TINYINT(3) NOT NULL DEFAULT '0' COMMENT '1:支付;2:退款;', + `content` TEXT NULL DEFAULT NULL COMMENT '回调内容' COLLATE 'utf8_general_ci', + `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) USING BTREE, + INDEX `agent_id` (`agent_id`) USING BTREE +) +COMMENT='微信支付回调记录' +COLLATE='utf8_general_ci' +ENGINE=InnoDB; + +CREATE TABLE `agent_settings` ( + `id` INT(10) NOT NULL AUTO_INCREMENT, + `agent_id` INT(10) NOT NULL COMMENT '代理商ID', + `setting` JSON NOT NULL COMMENT '设置值,JSON格式', + PRIMARY KEY (`id`) USING BTREE, + UNIQUE INDEX `agent_id` (`agent_id`) USING BTREE +) +COMMENT='代理商设置配置' +COLLATE='utf8_general_ci' +ENGINE=InnoDB; diff --git a/app/AdminAgent/Controllers/SettingController.php b/app/AdminAgent/Controllers/SettingController.php new file mode 100644 index 0000000..9696df8 --- /dev/null +++ b/app/AdminAgent/Controllers/SettingController.php @@ -0,0 +1,18 @@ +title('系统设置') + ->body(new Card(' ', new Setting())); + } +} diff --git a/app/AdminAgent/Forms/Setting.php b/app/AdminAgent/Forms/Setting.php new file mode 100644 index 0000000..3a4ff26 --- /dev/null +++ b/app/AdminAgent/Forms/Setting.php @@ -0,0 +1,49 @@ + Admin::user()->id], + ['setting' => json_encode($input), 'agent_id' => Admin::user()->id], + ); + + return $this->response()->success('保存成功')->refresh(); + } + + /** + * Build a form here. + */ + public function form() + { + $this->text('earnest')->required()->help('用户支付订金、定金、首付款的金额'); + $this->text('earnest_timeout')->required()->help('单位:分钟。当通过订金、定金、首付款支付时,用户超过该时间未支付将关闭订单,且定金不退'); + } + + /** + * The data of the form. + * + * @return array + */ + public function default() + { + $setting = AgentSetting::where('agent_id', Admin::user()->id)->value('setting'); + return is_string($setting) ? json_decode($setting, true) : []; + } +} diff --git a/app/Models/AgentSetting.php b/app/Models/AgentSetting.php new file mode 100644 index 0000000..0e9ed1e --- /dev/null +++ b/app/Models/AgentSetting.php @@ -0,0 +1,18 @@ +timestamps = false; + } +} diff --git a/resources/lang/zh_CN/setting.php b/resources/lang/zh_CN/setting.php new file mode 100644 index 0000000..19a7f60 --- /dev/null +++ b/resources/lang/zh_CN/setting.php @@ -0,0 +1,13 @@ + [ + 'Setting' => '系统设置', + 'setting' => '系统设置', + ], + 'fields' => [ + 'earnest' => '定金金额', + 'earnest_timeout' => '定金支付超时时间', + ], + 'options' => [ + ], +];