Fix balance
This commit is contained in:
parent
99158b86b3
commit
5c6cb51305
@ -47,7 +47,7 @@ class Transaction extends Model
|
||||
'outcome_drops',
|
||||
|
||||
// 可用余额
|
||||
'balance',
|
||||
'balances',
|
||||
|
||||
// 可用 Drops
|
||||
'drops',
|
||||
@ -168,7 +168,7 @@ public function addIncomeDrops($user_id, $amount, $description)
|
||||
{
|
||||
$data = [
|
||||
'type' => 'income',
|
||||
'payment' => 'balance',
|
||||
'payment' => 'balances',
|
||||
'description' => $description,
|
||||
'income' => 0,
|
||||
'income_drops' => (float) $amount,
|
||||
@ -198,7 +198,7 @@ public function addPayoutBalance($user_id, $amount, $description, $module_id = n
|
||||
{
|
||||
$data = [
|
||||
'type' => 'payout',
|
||||
'payment' => 'balance',
|
||||
'payment' => 'balances',
|
||||
'description' => $description,
|
||||
'income' => 0,
|
||||
'income_drops' => 0,
|
||||
@ -217,7 +217,7 @@ public function addHostPayoutBalance($user_id, $host_id, $module_id, $amount, $d
|
||||
{
|
||||
$data = [
|
||||
'type' => 'payout',
|
||||
'payment' => 'balance',
|
||||
'payment' => 'balances',
|
||||
'description' => $description,
|
||||
'income' => 0,
|
||||
'income_drops' => 0,
|
||||
@ -267,7 +267,7 @@ public function reduceAmountModuleFail($user_id, $module_id, $amount = 0, $descr
|
||||
|
||||
$user->balance -= $amount;
|
||||
|
||||
// if balance < 0
|
||||
// if balances < 0
|
||||
if ($user->balance < 0) {
|
||||
throw new BalanceNotEnoughException('余额不足。');
|
||||
}
|
||||
@ -346,7 +346,7 @@ private function addLog($user_id, $data)
|
||||
$user = User::find($user_id);
|
||||
|
||||
$current = [
|
||||
'balance' => $user->balance,
|
||||
'balances' => $user->balance,
|
||||
'drops' => $this->getDrops($user_id),
|
||||
'user_id' => intval($user_id),
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user