This commit is contained in:
iVampireSP.com 2023-01-17 13:09:06 +08:00
parent 6acac5de82
commit ecc1eb5570
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -169,15 +169,19 @@ public function startTransfer(User $to, string $amount, string|null $description
/** /**
* 扣除费用 * 扣除费用
* *
* @param string $amount * @param string|null $amount
* @param string $description * @param string $description
* @param bool $fail * @param bool $fail
* @param array $options * @param array $options
* *
* @return string * @return string
*/ */
public function reduce(string $amount = "0", string $description = "消费", bool $fail = false, array $options = []): string public function reduce(string|null $amount = "0", string $description = "消费", bool $fail = false, array $options = []): string
{ {
if ($amount === null || $amount === '') {
return $this->balance;
}
Cache::lock('user_balance_' . $this->id, 10)->block(10, function () use ($amount, $fail, $description, $options) { Cache::lock('user_balance_' . $this->id, 10)->block(10, function () use ($amount, $fail, $description, $options) {
$this->refresh(); $this->refresh();