改进 扣费
This commit is contained in:
parent
f50b49ba05
commit
7ba00243d1
@ -116,7 +116,7 @@ public function isUnavailable(): bool
|
|||||||
return $this->status === 'unavailable';
|
return $this->status === 'unavailable';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renew($first): bool
|
public function renew($first = false): bool
|
||||||
{
|
{
|
||||||
if (! $this->isCycle()) {
|
if (! $this->isCycle()) {
|
||||||
return false;
|
return false;
|
||||||
@ -285,7 +285,7 @@ public function safeDelete(): bool
|
|||||||
$days = $this->next_due_at->diffInDays(now());
|
$days = $this->next_due_at->diffInDays(now());
|
||||||
|
|
||||||
// 算出 1 天的价格
|
// 算出 1 天的价格
|
||||||
$price = bcdiv($this->last_paid, $this->next_due_at->daysInMonth, 4);
|
$price = bcdiv($this->getPrice(), 31, 4);
|
||||||
|
|
||||||
// 算出退还的金额
|
// 算出退还的金额
|
||||||
$amount = bcmul($price, $days, 4);
|
$amount = bcmul($price, $days, 4);
|
||||||
|
Loading…
Reference in New Issue
Block a user