修复 充值问题

This commit is contained in:
iVampireSP.com 2022-11-07 12:03:46 +08:00
parent 74f9c245e6
commit 93d0030e9d
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132
2 changed files with 6 additions and 2 deletions

View File

@ -83,7 +83,7 @@ public function show(Balance $balance)
$pay = Pay::alipay()->web([
'out_trade_no' => $balance->order_id,
'total_amount' => 10,
'total_amount' => $balance->amount,
'subject' => config('app.display_name') . ' 充值',
]);
@ -140,6 +140,10 @@ public function checkAndCharge(Balance $balance, $check = false)
}
}
if ($balance->paid_at !== null) {
return true;
}
try {
(new Transaction)->addAmount($balance->user_id, 'alipay', $balance->amount);

View File

@ -30,7 +30,7 @@ public function handle()
Balance::where('paid_at', null)->chunk(100, function ($balances) use ($bc) {
foreach ($balances as $balance) {
if (!$bc->checkAndCharge($balance)) {
if (!$bc->checkAndCharge($balance, true)) {
if (now()->diffInDays($balance->created_at) > 1) {
$balance->delete();
}