feat(PayNotifyLogic): 修复用户订单支付逻辑,优化代码,增加条件判断

This commit is contained in:
mkm 2024-06-23 20:12:50 +08:00
parent e7a74c1b10
commit 3e425d97fc

View File

@ -395,17 +395,19 @@ class PayNotifyLogic extends BaseLogic
$financeLogic->user = ['uid' => $order['uid']]; $financeLogic->user = ['uid' => $order['uid']];
$financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付 $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); //用户订单支付
$financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
$financeLogic->out($transaction_id,$order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); $financeLogic->out($transaction_id, $order['pay_price'], OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
$user_number = bcmul($order['pay_price'], '0.10', 2); if ($order['uid'] > 0) {
$sing = [ $user_number = bcmul($order['pay_price'], '0.10', 2);
'uid' => $order['uid'], $sing = [
'order_id' => $order['order_id'], 'uid' => $order['uid'],
'title' => '购买商品获得兑换券', 'order_id' => $order['order_id'],
'store_id' => $order['store_id'], 'title' => '购买商品获得兑换券',
'number' => $user_number, 'store_id' => $order['store_id'],
]; 'number' => $user_number,
$user_sing->save($sing); ];
User::where('id', $order['uid'])->inc('integral', $user_number)->update(); $user_sing->save($sing);
User::where('id', $order['uid'])->inc('integral', $user_number)->update();
}
return false; return false;
$vipFen = 0; $vipFen = 0;
if ($order['uid'] > 0) { if ($order['uid'] > 0) {
@ -752,14 +754,13 @@ class PayNotifyLogic extends BaseLogic
'product_id' => $v['product_id'], 'product_id' => $v['product_id'],
] ]
)->withTrashed()->find(); )->withTrashed()->find();
if($StoreBranchProduct){ if ($StoreBranchProduct) {
$updateData[] = [ $updateData[] = [
'id' => $StoreBranchProduct['id'], 'id' => $StoreBranchProduct['id'],
'stock' => $StoreBranchProduct['stock'] - $v['cart_num'], 'stock' => $StoreBranchProduct['stock'] - $v['cart_num'],
'sales' => ['inc', $v['cart_num']] 'sales' => ['inc', $v['cart_num']]
]; ];
} }
} }
(new StoreBranchProduct())->saveAll($updateData); (new StoreBranchProduct())->saveAll($updateData);