From cbb467a725d069074cda3c18a8b7ee3b8f0371cf Mon Sep 17 00:00:00 2001 From: limu Date: Tue, 30 Jan 2024 12:00:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E7=BB=AD=E8=B4=B9=E8=AF=BB=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/model/Setting.php | 12 ++++++++++++ app/api/model/dealer/Withdraw.php | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/app/api/model/Setting.php b/app/api/model/Setting.php index 2e0beeb9..a81bd165 100644 --- a/app/api/model/Setting.php +++ b/app/api/model/Setting.php @@ -46,6 +46,18 @@ class Setting extends SettingModel return static::getItem(SettingEnum::TRADE)['order']['closeHours']; } + /** + * 获取提现手续费(%) + * @return mixed + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public static function getFinanceCommission() + { + return static::getItem(SettingEnum::TRADE)['finance_process']; + } + /** * 获取充值设置 * @return array diff --git a/app/api/model/dealer/Withdraw.php b/app/api/model/dealer/Withdraw.php index cc86a512..9afa42b0 100644 --- a/app/api/model/dealer/Withdraw.php +++ b/app/api/model/dealer/Withdraw.php @@ -72,6 +72,13 @@ class Withdraw extends WithdrawModel if (!$this->validation($dealer, $data)) { return false; } + //手续费 + if(empty($data['is_invoice'])){ + $commission = \app\api\model\Setting::getFinanceCommission(); + if (empty($commission)) { + $data['commission_price'] = bcmath($data['money'], $commission / 100, 2); + } + } // 事务处理 $this->transaction(function () use ($dealer, $data) { // 新增申请记录 @@ -143,6 +150,7 @@ class Withdraw extends WithdrawModel $this->error = '请上传发票信息'; return false; } + return true; } }