修改加入冻结礼品券
This commit is contained in:
parent
862b05496e
commit
f64294494c
@ -458,9 +458,54 @@ class OrderLogic extends BaseLogic
|
||||
$money=$financeFlow->where(['order_id'=>$order['id'],'financial_pm'=>1,'financial_type'=>2])->value('number');
|
||||
$financeFlowLogic->updateStatusStore($order['id'],$order['store_id'],$money,$deposit);
|
||||
|
||||
$check = Db::name('user_sign_log')->where('order_id',$order['order_id'])->find();
|
||||
$check = Db::name('user_sign_log')->where('order_id',$order['order_id'])
|
||||
->where(['status'=>0])
|
||||
->find();
|
||||
if($check){
|
||||
User::where('id',$order['uid'])->inc('purchase_funds',$check['number'])->update();
|
||||
// User::where('id',$order['uid'])->inc('purchase_funds',$check['number'])->update();
|
||||
// $user_number = bcmul($order['pay_price'], '0.10', 2);
|
||||
|
||||
$base = UserSign::where([
|
||||
'uid'=>$order['uid'],
|
||||
'type'=>1,
|
||||
'status'=>0
|
||||
])->find();
|
||||
$user_sing = new UserSign();
|
||||
if($base['number'] > 0 && $base['number'] >= $check['number']){
|
||||
$sing = [
|
||||
'uid' => $order['uid'],
|
||||
'order_id' => $order['order_id'].'-b',
|
||||
'title' => '返还兑换券',
|
||||
'financial_pm' => 1,
|
||||
'store_id' => $order['store_id'],
|
||||
];
|
||||
$sing['number'] = $check['number'];
|
||||
$user_sing->save($sing);
|
||||
if($base['number'] == $check['number']){
|
||||
UserSign::where([
|
||||
'uid'=>$order['uid'],
|
||||
'type'=>1,
|
||||
'status'=>0
|
||||
])->update(['status'=>1]);
|
||||
}
|
||||
}
|
||||
if($base['number'] < $check['number']){
|
||||
$sing = [
|
||||
'uid' => $order['uid'],
|
||||
'order_id' => $order['order_id'].'-b',
|
||||
'title' => '返还兑换券',
|
||||
'financial_pm' => 1,
|
||||
'store_id' => $base['number'],
|
||||
];
|
||||
$sing['number'] = $check['number'];
|
||||
$user_sing->save($sing);
|
||||
UserSign::where([
|
||||
'uid'=>$order['uid'],
|
||||
'type'=>1,
|
||||
'status'=>0
|
||||
])->update(['status'=>1]);
|
||||
}
|
||||
|
||||
Db::name('user_sign_log')->where('order_id',$order['order_id'])->update(['status'=>1]);
|
||||
}
|
||||
|
||||
|
@ -236,10 +236,12 @@ class PayNotifyLogic extends BaseLogic
|
||||
]);
|
||||
$query1 = clone $query;
|
||||
$ids = $query->column('id');
|
||||
$check = $query->sum('back_num');
|
||||
$check = $query->sum('number');
|
||||
$count = $query1->count();
|
||||
if($check && $check >0){
|
||||
$backPurchase = bcsub($order['pay_price'],0.1,2);
|
||||
$backPurchase = bcmul($order['pay_price'],0.1,2);
|
||||
|
||||
|
||||
if($count == 1){
|
||||
//存在拆单子否
|
||||
//少了就冻结减去这个对应的金额
|
||||
@ -259,12 +261,13 @@ class PayNotifyLogic extends BaseLogic
|
||||
if($one['back_num'] >= $backPurchase){
|
||||
$wait = bcsub($one['back_num'],$backPurchase,2)??0;
|
||||
$data['number'] =$backPurchase;
|
||||
|
||||
Db::name('user_sign_log')->insert($data);
|
||||
//总的减去采购款百分之十剩余的
|
||||
if(empty($wait)){
|
||||
UserSign::where('id',$one['id'])->update(
|
||||
[
|
||||
'back_num'=>0,
|
||||
'number'=>0,
|
||||
'status'=>1
|
||||
]
|
||||
);
|
||||
@ -272,7 +275,7 @@ class PayNotifyLogic extends BaseLogic
|
||||
//add
|
||||
UserSign::where('id',$one['id'])->update(
|
||||
[
|
||||
'back_num'=>$wait
|
||||
'number'=>$wait
|
||||
]
|
||||
);
|
||||
}
|
||||
@ -287,7 +290,7 @@ class PayNotifyLogic extends BaseLogic
|
||||
Db::name('user_sign_log')->insert($data);
|
||||
UserSign::where('id',$one['id'])->update(
|
||||
[
|
||||
'back_num'=>0,
|
||||
'number'=>0,
|
||||
'status'=>1
|
||||
]
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user