添加 充值记录
This commit is contained in:
parent
353790dd3b
commit
a9ef38ff5f
@ -154,10 +154,15 @@ public function checkAndCharge($out_trade_no, Balance $balance)
|
|||||||
$balance->paid_at = now();
|
$balance->paid_at = now();
|
||||||
$balance->save();
|
$balance->save();
|
||||||
|
|
||||||
|
$transaction = new Transaction();
|
||||||
|
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
try {
|
try {
|
||||||
$balance->user->increment('balance', $trade->totalAmount);
|
$balance->user->increment('balance', $trade->totalAmount);
|
||||||
|
|
||||||
|
$description = '充值 ' . $trade->totalAmount . ' 元,对端订单号: ' . $out_trade_no;
|
||||||
|
$transaction->addIncomeBalance($balance->user_id, 'alipay', $trade->totalAmount, $description);
|
||||||
|
|
||||||
DB::commit();
|
DB::commit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
DB::rollBack();
|
DB::rollBack();
|
||||||
|
Loading…
Reference in New Issue
Block a user