From 9a6dc1883f56c017902b879eb8b8073f184957b3 Mon Sep 17 00:00:00 2001 From: lemon <15040771@qq.com> Date: Fri, 17 Sep 2021 20:46:39 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServicePersonsSettingController.php | 17 ++++++ app/Admin/Forms/ServicePersonsSetting.php | 56 +++++++++++++++++++ app/Admin/routes.php | 1 + 3 files changed, 74 insertions(+) create mode 100755 app/Admin/Controllers/ServicePersonsSettingController.php create mode 100644 app/Admin/Forms/ServicePersonsSetting.php diff --git a/app/Admin/Controllers/ServicePersonsSettingController.php b/app/Admin/Controllers/ServicePersonsSettingController.php new file mode 100755 index 0000000..e2f61e1 --- /dev/null +++ b/app/Admin/Controllers/ServicePersonsSettingController.php @@ -0,0 +1,17 @@ +title('交易设置') + ->body(new Card(new ServicePersonsSetting())); + } +} diff --git a/app/Admin/Forms/ServicePersonsSetting.php b/app/Admin/Forms/ServicePersonsSetting.php new file mode 100644 index 0000000..00fab2d --- /dev/null +++ b/app/Admin/Forms/ServicePersonsSetting.php @@ -0,0 +1,56 @@ +firstOrCreate([ + 'key' => 'single' + ]); + + $arr = [ + 'price' => $input['price'], + ]; + $system->value = $arr; + $system->save(); + return $this + ->response() + ->success('设置成功') + ->refresh(); + } + + /** + * Build a form here. + */ + public function form() + { + $this->decimal('price','单人头交易费')->rules('required|numeric|min:0|not_in:0',[ + '*' => '金额为必填字段且必须大于0', + ]); + } + + /** + * The data of the form. + * + * @return array + */ + public function default() + { + $system = \App\Models\SystemSetting::query()->where('key','single')->value('value'); + return [ + 'price' => $system['price'] ?? 0, + ]; + } +} diff --git a/app/Admin/routes.php b/app/Admin/routes.php index 474d488..3625df6 100644 --- a/app/Admin/routes.php +++ b/app/Admin/routes.php @@ -46,4 +46,5 @@ Route::group([ $router->resource('withdrawal', 'WithdrawalController'); $router->resource('system', 'SystemSettingController'); $router->resource('deposit', 'DepositController'); + $router->resource('setting_single', 'ServicePersonsSettingController'); });