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