feat(PayNotifyLogic): 修改支付通知逻辑,增加活动价结算功能

This commit is contained in:
mkm 2024-06-24 18:17:27 +08:00
parent 17697bf361
commit 49ee6b0c1c

View File

@ -7,6 +7,7 @@ use app\common\enum\OrderEnum;
use app\common\enum\PayEnum; use app\common\enum\PayEnum;
use app\common\enum\user\UserShipEnum; use app\common\enum\user\UserShipEnum;
use app\common\enum\YesNoEnum; use app\common\enum\YesNoEnum;
use app\common\model\Config;
use app\common\model\dict\DictType; use app\common\model\dict\DictType;
use app\common\model\finance\CapitalFlow; use app\common\model\finance\CapitalFlow;
use app\common\model\finance\PayNotifyLog; use app\common\model\finance\PayNotifyLog;
@ -300,7 +301,6 @@ class PayNotifyLogic extends BaseLogic
//退款 //退款
$capitalFlowDao->userIncome('system_purchase_back', 'system_back', $order['id'], $deal_money); $capitalFlowDao->userIncome('system_purchase_back', 'system_back', $order['id'], $deal_money);
} }
} }
//微信日志 user_order_refund //微信日志 user_order_refund
$capitalFlowDao->userIncome('user_order_refund', 'system_back', $order['id'], $deal_money, '', 1); $capitalFlowDao->userIncome('user_order_refund', 'system_back', $order['id'], $deal_money, '', 1);
@ -333,7 +333,6 @@ class PayNotifyLogic extends BaseLogic
$value['create_time'] = time(); $value['create_time'] = time();
} }
(new StoreFinanceFlow)->saveAll($data); (new StoreFinanceFlow)->saveAll($data);
} }
/** /**
@ -515,6 +514,27 @@ class PayNotifyLogic extends BaseLogic
{ {
$financeLogic = new StoreFinanceFlowLogic(); $financeLogic = new StoreFinanceFlowLogic();
$user_sing = new UserSign(); $user_sing = new UserSign();
$off_activity = Config::where('name', 'off_activity')->value('value');
if ($off_activity == 1) {
//-----活动价结算更改
$financeLogic->order = $order;
$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::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']);
if ($order['uid'] > 0) {
$user_number = bcmul($order['pay_price'], '0.10', 2);
$sing = [
'uid' => $order['uid'],
'order_id' => $order['order_id'],
'title' => '购买商品获得兑换券',
'store_id' => $order['store_id'],
'number' => $user_number,
];
$user_sing->save($sing);
}
return false;
}
$vipFen = 0; $vipFen = 0;
if ($order['uid'] > 0) { if ($order['uid'] > 0) {
// 结算金额 要支付的钱减去冻结得钱去走后面得逻辑 发得兑换券也要去减去 // 结算金额 要支付的钱减去冻结得钱去走后面得逻辑 发得兑换券也要去减去