修复 充值问题
This commit is contained in:
parent
74f9c245e6
commit
93d0030e9d
@ -83,7 +83,7 @@ public function show(Balance $balance)
|
|||||||
|
|
||||||
$pay = Pay::alipay()->web([
|
$pay = Pay::alipay()->web([
|
||||||
'out_trade_no' => $balance->order_id,
|
'out_trade_no' => $balance->order_id,
|
||||||
'total_amount' => 10,
|
'total_amount' => $balance->amount,
|
||||||
'subject' => config('app.display_name') . ' 充值',
|
'subject' => config('app.display_name') . ' 充值',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -140,6 +140,10 @@ public function checkAndCharge(Balance $balance, $check = false)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($balance->paid_at !== null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
(new Transaction)->addAmount($balance->user_id, 'alipay', $balance->amount);
|
(new Transaction)->addAmount($balance->user_id, 'alipay', $balance->amount);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ public function handle()
|
|||||||
|
|
||||||
Balance::where('paid_at', null)->chunk(100, function ($balances) use ($bc) {
|
Balance::where('paid_at', null)->chunk(100, function ($balances) use ($bc) {
|
||||||
foreach ($balances as $balance) {
|
foreach ($balances as $balance) {
|
||||||
if (!$bc->checkAndCharge($balance)) {
|
if (!$bc->checkAndCharge($balance, true)) {
|
||||||
if (now()->diffInDays($balance->created_at) > 1) {
|
if (now()->diffInDays($balance->created_at) > 1) {
|
||||||
$balance->delete();
|
$balance->delete();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user