feat: 修改支付通知逻辑以增加新的用户签到功能

This commit is contained in:
mkm 2024-06-18 09:21:17 +08:00
parent d43d26163f
commit 4292c80301

View File

@ -276,7 +276,6 @@ class PayNotifyLogic extends BaseLogic
if ($order->pay_type == 9) { if ($order->pay_type == 9) {
$order->status = 2; $order->status = 2;
self::afterPay($order); self::afterPay($order);
} }
if ($order->pay_type == 9) { if ($order->pay_type == 9) {
@ -298,6 +297,8 @@ class PayNotifyLogic extends BaseLogic
public static function afterPay($order, $transaction_id = 0) public static function afterPay($order, $transaction_id = 0)
{ {
$financeLogic = new StoreFinanceFlowLogic(); $financeLogic = new StoreFinanceFlowLogic();
$user_sing = new UserSign();
$financeLogic->order = $order; $financeLogic->order = $order;
$financeLogic->user = ['uid' => $order['uid']]; $financeLogic->user = ['uid' => $order['uid']];
// if ($order->pay_type != 9 || $order->pay_type != 10) { // if ($order->pay_type != 9 || $order->pay_type != 10) {
@ -305,6 +306,15 @@ class PayNotifyLogic extends BaseLogic
$count_frees = 0; $count_frees = 0;
//商户应该获得的钱 每个商品的price-ot_price 利润 //商户应该获得的钱 每个商品的price-ot_price 利润
// if (isset($order->profit) && $order->profit > 0) { // if (isset($order->profit) && $order->profit > 0) {
if($order['uid']>0){
$sing = [
'uid' => $order['uid'],
'title' => '购买商品获得兑换券',
'store_id' => $order['store_id'],
'number' => bcmul($order['pay_price'], '0.01', 2),
];
$user_sing->save($sing);
}
//平台手续费 //平台手续费
$fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2); $fees = bcdiv(bcmul($order['pay_price'], '0.02', 2), 1, 2);
@ -378,7 +388,6 @@ class PayNotifyLogic extends BaseLogic
if ($fees > 0) { if ($fees > 0) {
//村长获得 //村长获得
$sing = []; $sing = [];
$user_sing=new UserSign();
$sing[] = [ $sing[] = [
'uid' => $village_uid, 'uid' => $village_uid,
@ -415,7 +424,6 @@ class PayNotifyLogic extends BaseLogic
if ($fees > 0) { if ($fees > 0) {
$financeLogic->in($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']); $financeLogic->in($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], 0, 0, $order['pay_type']);
$financeLogic->out($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']); $financeLogic->out($transaction_id, $fees, OrderEnum::SUPPLIER_ORDER_OBTAINS, $order['store_id'], $order['staff_id'], 0, $order['pay_type']);
} }
// } // }
$financeLogic->save(); $financeLogic->save();