改进 Description 的变量覆盖问题
This commit is contained in:
parent
6ad35be1a0
commit
9f0096aca0
@ -55,10 +55,10 @@ class Transaction extends Model
|
|||||||
|
|
||||||
|
|
||||||
// scope this user
|
// scope this user
|
||||||
public function scopeThisUser($query)
|
// public function scopeThisUser($query)
|
||||||
{
|
// {
|
||||||
return $query->where('user_id', auth()->id());
|
// return $query->where('user_id', auth()->id());
|
||||||
}
|
// }
|
||||||
|
|
||||||
private function addLog($user_id, $data)
|
private function addLog($user_id, $data)
|
||||||
{
|
{
|
||||||
@ -182,7 +182,7 @@ public function addHostPayoutBalance($user_id, $host_id, $module_id, $amount, $d
|
|||||||
/**
|
/**
|
||||||
* @throws ChargeException
|
* @throws ChargeException
|
||||||
*/
|
*/
|
||||||
public function addAmount($user_id, $payment = 'console', $amount = 0, $description = null, $add_to_balances = false)
|
public function addAmount($user_id, $payment = 'console', $amount = 0, $description = null, $add_charge_log = false)
|
||||||
{
|
{
|
||||||
$lock = Cache::lock("user_balance_lock_" . $user_id, 10);
|
$lock = Cache::lock("user_balance_lock_" . $user_id, 10);
|
||||||
try {
|
try {
|
||||||
@ -196,12 +196,10 @@ public function addAmount($user_id, $payment = 'console', $amount = 0, $descript
|
|||||||
$user->increment('balance', $amount);
|
$user->increment('balance', $amount);
|
||||||
|
|
||||||
if (!$description) {
|
if (!$description) {
|
||||||
$description = '充值金额。';
|
|
||||||
} else {
|
|
||||||
$description = '充值 ' . $amount . ' 元';
|
$description = '充值 ' . $amount . ' 元';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($add_to_balances) {
|
if ($add_charge_log) {
|
||||||
$data = [
|
$data = [
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
|
Loading…
Reference in New Issue
Block a user