改进 区分新购和续费
This commit is contained in:
parent
dc157ea7fb
commit
d20d11f33f
@ -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, [
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user