增加 状态判断函数
This commit is contained in:
parent
803cb019b2
commit
ac6112ac20
@ -110,6 +110,16 @@ public function isStopped(): bool
|
||||
return $this->status === 'stopped';
|
||||
}
|
||||
|
||||
public function isPending(): bool
|
||||
{
|
||||
return $this->status === 'pending';
|
||||
}
|
||||
|
||||
public function isUnavailable(): bool
|
||||
{
|
||||
return $this->status === 'unavailable';
|
||||
}
|
||||
|
||||
public function renew(): bool
|
||||
{
|
||||
if (! $this->isCycle()) {
|
||||
|
@ -111,6 +111,7 @@ private function getResponse(Response $response): array
|
||||
* @param $path
|
||||
* @param $requests
|
||||
* @param array $files
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function request($method, $path, $requests, array $files = []): array
|
||||
@ -206,6 +207,7 @@ public function calculate(): array
|
||||
* @param string|null $description
|
||||
* @param bool $fail
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function reduce(string|null $amount = '0', string|null $description = '消费', bool $fail = false, array $options = []): string
|
||||
@ -253,6 +255,7 @@ public function reduce(string|null $amount = '0', string|null $description = '
|
||||
* @param string $payment
|
||||
* @param string|null $description
|
||||
* @param array $options
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function charge(string|null $amount = '0', string $payment = 'console', string|null $description = '充值', array $options = []): string
|
||||
@ -297,4 +300,19 @@ public function whereHasBalance(string $amount = '0'): self|Builder|CachedBuilde
|
||||
{
|
||||
return $this->where('balance', '>=', $amount);
|
||||
}
|
||||
|
||||
public function isUp(): bool
|
||||
{
|
||||
return $this->status === 'up';
|
||||
}
|
||||
|
||||
public function isDown(): bool
|
||||
{
|
||||
return $this->status === 'down';
|
||||
}
|
||||
|
||||
public function isMaintenance(): bool
|
||||
{
|
||||
return $this->status === 'maintenance';
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user