改进 扣费
This commit is contained in:
parent
ecc1eb5570
commit
7b77e96018
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user