diff --git a/app/Models/Host.php b/app/Models/Host.php index 830e29d..7bf4fad 100644 --- a/app/Models/Host.php +++ b/app/Models/Host.php @@ -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);