This commit is contained in:
mkm 2024-06-27 20:47:20 +08:00
commit a54cc8adac
2 changed files with 32 additions and 24 deletions

View File

@ -458,7 +458,7 @@ class OrderLogic extends BaseLogic
$money=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>2])->value('number'); $money=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>2])->value('number');
$financeFlowLogic->updateStatusStore($order['id'],$order['store_id'],$money,$deposit); $financeFlowLogic->updateStatusStore($order['id'],$order['store_id'],$money,$deposit);
$check = Db::name('user_sign_log')->where('order_id',$order['order_id']) /* $check = Db::name('user_sign_log')->where('order_id',$order['order_id'])
->where(['status'=>0]) ->where(['status'=>0])
->find();//$check['number']扣的 ->find();//$check['number']扣的
if($check){ if($check){
@ -468,7 +468,7 @@ class OrderLogic extends BaseLogic
$base = UserSign::where([ $base = UserSign::where([
'uid'=>$order['uid'], 'uid'=>$order['uid'],
'type'=>1, 'type'=>1,
'status'=>0 'status'=>1
])->find(); ])->find();
$user_sing = new UserSign(); $user_sing = new UserSign();
if($base['number'] > 0 && $base['number'] >= $check['number']){ if($base['number'] > 0 && $base['number'] >= $check['number']){
@ -513,7 +513,7 @@ class OrderLogic extends BaseLogic
} }
Db::name('user_sign_log')->where('order_id',$order['order_id'])->update(['status'=>1]); Db::name('user_sign_log')->where('order_id',$order['order_id'])->update(['status'=>1]);
} }*/
Db::commit(); Db::commit();
return true; return true;

View File

@ -206,15 +206,15 @@ class PayNotifyLogic extends BaseLogic
OrderLogic::writeOff($params); OrderLogic::writeOff($params);
} }
self::dealProductLog($order); self::dealProductLog($order);
$count = UserSign::where([ // $count = UserSign::where([
'uid'=>$order['uid'], // 'uid'=>$order['uid'],
'type'=>1, // 'type'=>1,
'status'=>0 // 'status'=>0
])->count(); // ])->count();
//
if($count){ // if($count){
self::addFlowLog($order); // self::addFlowLog($order);
} // }
// if($order['shipping_type'] == 3){ // if($order['shipping_type'] == 3){
// self::descStock($order['id']); // self::descStock($order['id']);
// } // }
@ -234,15 +234,14 @@ class PayNotifyLogic extends BaseLogic
'type'=>1, 'type'=>1,
'status'=>0 'status'=>0
]); ]);
$query1 = clone $query; // $query1 = clone $query;
$ids = $query->column('id'); // $ids = $query->column('id');
$check = $query->sum('number'); $check = $query->sum('number');
$count = $query1->count(); // $count = $query1->count();
if($check && $check >0){ if($check && $check >0){
$backPurchase = bcmul($order['pay_price'],0.1,2); $backPurchase = bcmul($order['pay_price'],0.1,2);
// if($count == 1){
if($count == 1){
//存在拆单子否 //存在拆单子否
//少了就冻结减去这个对应的金额 //少了就冻结减去这个对应的金额
$one = UserSign::where([ $one = UserSign::where([
@ -257,13 +256,15 @@ class PayNotifyLogic extends BaseLogic
'title' => '充值获得冻结兑换券', 'title' => '充值获得冻结兑换券',
'financial_pm' => 1, 'financial_pm' => 1,
'type' => 1, 'type' => 1,
'status' => 1,
]; ];
if($one['back_num'] >= $backPurchase){ if($one['number'] >= $backPurchase){
// $wait = bcsub($one['back_num'],$backPurchase,2)??0; // $wait = bcsub($one['number'],$backPurchase,2)??0;
$data['number'] =$backPurchase; $data['number'] =$backPurchase;
Db::name('user_sign_log')->insert($data); Db::name('user_sign_log')->insert($data);
//总的减去采购款百分之十剩余的 //总的减去采购款百分之十剩余的
// if(empty($wait)){ // if(empty($wait)){
// UserSign::where('id',$one['id'])->update( // UserSign::where('id',$one['id'])->update(
@ -300,10 +301,10 @@ class PayNotifyLogic extends BaseLogic
} }
} }
else{ /* else{
//大于0的时候 //大于0的时候
//先处理金额大的再处理剩余的 //先处理金额大的再处理剩余的
/**** 把所有的金额改为正的再加一条后再加***/ //把所有的金额改为正的再加一条后再加
UserSign::where([ UserSign::where([
'uid'=>$order['uid'], 'uid'=>$order['uid'],
'type'=>1, 'type'=>1,
@ -353,9 +354,9 @@ class PayNotifyLogic extends BaseLogic
// User::where('id',$order['uid'])->inc('purchase_funds',$check)->update();//add // User::where('id',$order['uid'])->inc('purchase_funds',$check)->update();//add
} }
} }*/
} // }
return true; return true;
} }
@ -613,10 +614,12 @@ class PayNotifyLogic extends BaseLogic
'financial_pm' => 1, 'financial_pm' => 1,
'store_id' => $order['store_id'], 'store_id' => $order['store_id'],
'type' => 1, 'type' => 1,
'status' => 1,
'number' => $total_vip, 'number' => $total_vip,
'back_num' => $total_vip, 'back_num' => $total_vip,
]; ];
$user_sing->save($sing); $user_sing->save($sing);
User::where('id',$order->uid)->inc('integral',$total_vip)->update();
return true; return true;
} }
@ -660,7 +663,12 @@ class PayNotifyLogic extends BaseLogic
if($order['other_uid']>0){ if($order['other_uid']>0){
$uid=$order['other_uid']; $uid=$order['other_uid'];
} }
self::dealRechargeFrozen($order); $check = UserSign::where(['uid'=>$order->uid,'type'=>1])->count();
if(empty($check)){
self::dealRechargeFrozen($order);
}
PushService::push('wechat_mmp_' . $uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]); PushService::push('wechat_mmp_' . $uid, $uid, ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]);
PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]); PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type'=>'INDUSTRYMEMBERS','msg'=>'订单支付成功','data'=>['id'=>$order['id'],'paid'=>1]]);
if (!empty($extra['payer']['openid'])) { if (!empty($extra['payer']['openid'])) {