From 3b88d70fbc22c1d2f2e2fa6ef80450f45dab3ba0 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Sat, 4 Feb 2023 01:46:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=E6=8F=90=E6=88=90?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Jobs/Module/SendModuleEarningsJob.php | 6 ++++-- app/Models/Host.php | 2 +- config/billing.php | 6 ------ config/settings.php | 3 +++ 4 files changed, 8 insertions(+), 9 deletions(-) delete mode 100644 config/billing.php diff --git a/app/Jobs/Module/SendModuleEarningsJob.php b/app/Jobs/Module/SendModuleEarningsJob.php index 6ac78b7..066f8ad 100644 --- a/app/Jobs/Module/SendModuleEarningsJob.php +++ b/app/Jobs/Module/SendModuleEarningsJob.php @@ -53,8 +53,10 @@ private function send(Module $module): void $total_should = 0; foreach ($months as $month => $m) { - $total += round($m['balance'], 2); - $total_should += round($m['should_balance'], 2); + // bc 保留两位小数 + $total = bcadd($total, $m['balance'], 2); + $total_should = bcadd($total_should, $m['should_balance'], 2); + $text .= <<module_id; // 应支付的提成 - $commission = config('billing.commission'); + $commission = config('settings.billing.commission'); $should_amount = bcmul($amount, $commission, 4); // 应得的余额 diff --git a/config/billing.php b/config/billing.php deleted file mode 100644 index 69f3a44..0000000 --- a/config/billing.php +++ /dev/null @@ -1,6 +0,0 @@ - 0.1, -]; diff --git a/config/settings.php b/config/settings.php index ed5d7e3..90461df 100644 --- a/config/settings.php +++ b/config/settings.php @@ -1,6 +1,9 @@ [ + 'commission' => '0.1', + ], 'wecom' => [ 'robot_hook' => [ 'default' => env('WECOM_ROBOT_HOOK_DEFAULT', ''),