改进
This commit is contained in:
parent
6acac5de82
commit
ecc1eb5570
@ -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();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user