feat: 修改支付回调处理逻辑和订单入账规则

This commit is contained in:
mkm 2024-06-11 10:22:13 +08:00
parent ff53552f49
commit 71ebcb10db

View File

@ -29,8 +29,8 @@ class PayNotifyLogic extends BaseLogic
public static function handle($action, $orderSn, $extra = []) public static function handle($action, $orderSn, $extra = [])
{ {
Db::startTrans(); // Db::startTrans();
try { // try {
if ($action != 'cash_pay' && $action != 'balancePay') { if ($action != 'cash_pay' && $action != 'balancePay') {
$payNotifyLogLogic = new PayNotifyLogLogic(); $payNotifyLogLogic = new PayNotifyLogLogic();
if ($action == 'refund') { if ($action == 'refund') {
@ -40,13 +40,13 @@ class PayNotifyLogic extends BaseLogic
} }
} }
self::$action($orderSn, $extra); self::$action($orderSn, $extra);
Db::commit(); // Db::commit();
return true; return true;
} catch (\Exception $e) { // } catch (\Exception $e) {
Db::rollback(); // Db::rollback();
Log::error('支付回调处理失败' . $e->getMessage() . ',lien:' . $e->getLine() . ',file:' . $e->getFile()); // Log::error('支付回调处理失败' . $e->getMessage() . ',lien:' . $e->getLine() . ',file:' . $e->getFile());
throw new \Exception($e->getMessage()); // throw new \Exception($e->getMessage());
} // }
} }
/** /**
@ -251,7 +251,7 @@ class PayNotifyLogic extends BaseLogic
if ($order->pay_type != 9 || $order->pay_type != 10) { if ($order->pay_type != 9 || $order->pay_type != 10) {
$financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY); //用户单入账 $financeLogic->in($transaction_id, $order['pay_price'], OrderEnum::USER_ORDER_PAY); //用户单入账
//商户应该获得的钱 每个商品的price-ot_price 利润 //商户应该获得的钱 每个商品的price-ot_price 利润
if ($order->profit !== "0.00") { if (is_int($order->profit) &&$order->profit >0) {
//手续费 //手续费
$fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2); $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2);
$financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_COMMITION, $order['store_id']); //手续费入账 $financeLogic->in($transaction_id, $fees, OrderEnum::ORDER_COMMITION, $order['store_id']); //手续费入账