改进 区分新购和续费

This commit is contained in:
iVampireSP.com 2023-02-13 17:07:55 +08:00
parent dc157ea7fb
commit d20d11f33f
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 3 additions and 3 deletions

View File

@ -116,7 +116,7 @@ public function isUnavailable(): bool
return $this->status === 'unavailable';
}
public function renew(): bool
public function renew($first): bool
{
if (! $this->isCycle()) {
return false;
@ -124,7 +124,7 @@ public function renew(): bool
$price = $this->getRenewPrice();
$description = '续费 '.$this->name.',价格:'.$price.' 元。';
$description = ($first ? '新购' : '续费').' '.$this->name.',价格:'.$price.' 元。';
try {
$this->user->reduce($price, $description, true, [

View File

@ -39,7 +39,7 @@ public function created(Host $host): void
$host->user->notify(new WebNotification($host, 'hosts.created'));
if ($host->isCycle()) {
$host->renew();
$host->renew(true);
}
$host->save();