改进 扣费

This commit is contained in:
iVampireSP.com 2023-01-17 14:34:23 +08:00
parent ecc1eb5570
commit 7b77e96018
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -188,12 +188,11 @@ public function cost(string $amount = null, $auto = true): bool
$days = now()->daysInMonth;
// 本月每天的每小时的价格
// 使用 bcmath 函数,解决浮点数计算精度问题
$real_price = bcdiv($real_price, $days, 4);
$real_price = bcdiv($real_price, 24, 4);
$real_price = bcdiv($real_price, $days, 8);
$real_price = bcdiv($real_price, 24, 8);
}
if ($real_price == 0) {
echo '价格为 0不扣费';
return true;
}