改进 扣费

This commit is contained in:
iVampireSP.com 2023-02-13 18:18:14 +08:00
parent f50b49ba05
commit 7ba00243d1
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -116,7 +116,7 @@ public function isUnavailable(): bool
return $this->status === 'unavailable';
}
public function renew($first): bool
public function renew($first = false): bool
{
if (! $this->isCycle()) {
return false;
@ -285,7 +285,7 @@ public function safeDelete(): bool
$days = $this->next_due_at->diffInDays(now());
// 算出 1 天的价格
$price = bcdiv($this->last_paid, $this->next_due_at->daysInMonth, 4);
$price = bcdiv($this->getPrice(), 31, 4);
// 算出退还的金额
$amount = bcmul($price, $days, 4);