修改加入冻结兑换券中
This commit is contained in:
parent
9ded85b66f
commit
bc6855fc7c
@ -206,6 +206,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
OrderLogic::writeOff($params);
|
OrderLogic::writeOff($params);
|
||||||
}
|
}
|
||||||
self::dealProductLog($order);
|
self::dealProductLog($order);
|
||||||
|
self::addFlowLog($order);
|
||||||
// if($order['shipping_type'] == 3){
|
// if($order['shipping_type'] == 3){
|
||||||
// self::descStock($order['id']);
|
// self::descStock($order['id']);
|
||||||
// }
|
// }
|
||||||
@ -220,9 +221,9 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
{
|
{
|
||||||
//查询当前用户有无对应的充值的冻结金额
|
//查询当前用户有无对应的充值的冻结金额
|
||||||
if($order['uid'] >0 ){
|
if($order['uid'] >0 ){
|
||||||
$query = VipFlow::where([
|
$query = UserSign::where([
|
||||||
'user_id'=>$order['uid'],
|
'user_id'=>$order['uid'],
|
||||||
'type'=>2,
|
'type'=>1,
|
||||||
'status'=>0
|
'status'=>0
|
||||||
]);
|
]);
|
||||||
$query1 = clone $query;
|
$query1 = clone $query;
|
||||||
@ -234,30 +235,27 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
if($count == 1){
|
if($count == 1){
|
||||||
//存在拆单子否
|
//存在拆单子否
|
||||||
//少了就冻结减去这个对应的金额
|
//少了就冻结减去这个对应的金额
|
||||||
$one = VipFlow::where([
|
$one = UserSign::where([
|
||||||
'user_id'=>$order['uid'],
|
'user_id'=>$order['uid'],
|
||||||
'type'=>2,
|
'type'=>1,
|
||||||
'status'=>0
|
'status'=>0
|
||||||
])->find();
|
])->find();
|
||||||
$data = [
|
$data = [
|
||||||
'vip_flow_id'=>$one['id'],
|
'uid' => $order['uid'],
|
||||||
'order_id' => $order['id'],
|
'order_id' => $order['order_id'],
|
||||||
'order_sn' => $order['order_id'],
|
'title' => '充值获得冻结兑换券',
|
||||||
'user_id' => $order['uid'],
|
'financial_pm' => 1,
|
||||||
'pay_type' => $pay_type ?? 1,
|
|
||||||
'status' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
'store_id' => $order['store_id'],
|
'store_id' => $order['store_id'],
|
||||||
'staff_id' => $order['staff_id'],
|
'type' => 1,
|
||||||
'create_time' => time()
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if($one['back_num'] >= $backPurchase){
|
if($one['back_num'] >= $backPurchase){
|
||||||
$data['number'] =$backPurchase;
|
$data['number'] =$backPurchase;
|
||||||
Db::name('la_vip_flow_log')->insert($data);
|
Db::name('user_sign_log')->insert($data);
|
||||||
//总的减去采购款百分之十剩余的
|
//总的减去采购款百分之十剩余的
|
||||||
$wait = bcsub($one['back_num'],$backPurchase,2);
|
$wait = bcsub($one['back_num'],$backPurchase,2);
|
||||||
if(empty($wait)){
|
if(empty($wait)){
|
||||||
VipFlow::where('id',$one['id'])->update(
|
UserSign::where('id',$one['id'])->update(
|
||||||
[
|
[
|
||||||
'back_num'=>0,
|
'back_num'=>0,
|
||||||
'status'=>1
|
'status'=>1
|
||||||
@ -265,7 +263,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
);
|
);
|
||||||
}else{
|
}else{
|
||||||
//add
|
//add
|
||||||
VipFlow::where('id',$one['id'])->update([
|
UserSign::where('id',$one['id'])->update([
|
||||||
[
|
[
|
||||||
'back_num'=>$wait
|
'back_num'=>$wait
|
||||||
]
|
]
|
||||||
@ -273,12 +271,13 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
}
|
}
|
||||||
//并且加到对应的用户的采购款中
|
//并且加到对应的用户的采购款中
|
||||||
User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update();
|
User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update();
|
||||||
}else{
|
}
|
||||||
|
else{
|
||||||
//对比采购款支付的多少 多了就拿冻结金额即可
|
//对比采购款支付的多少 多了就拿冻结金额即可
|
||||||
$data['number'] =$one['number'];
|
$data['number'] =$one['number'];
|
||||||
//都存到对应的log日志
|
//都存到对应的log日志
|
||||||
Db::name('la_vip_flow_log')->insert($data);
|
Db::name('user_sign_log')->insert($data);
|
||||||
VipFlow::where('id',$one['id'])->update(
|
UserSign::where('id',$one['id'])->update(
|
||||||
[
|
[
|
||||||
'back_num'=>0,
|
'back_num'=>0,
|
||||||
'status'=>1
|
'status'=>1
|
||||||
@ -292,56 +291,46 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
//大于0的时候
|
//大于0的时候
|
||||||
//先处理金额大的再处理剩余的
|
//先处理金额大的再处理剩余的
|
||||||
/**** 把所有的金额改为正的再加一条后再加***/
|
/**** 把所有的金额改为正的再加一条后再加***/
|
||||||
VipFlow::where([
|
UserSign::where([
|
||||||
'user_id'=>$order['uid'],
|
'user_id'=>$order['uid'],
|
||||||
'type'=>2,
|
'type'=>1,
|
||||||
'status'=>0
|
'status'=>0
|
||||||
])->update([
|
])->update([
|
||||||
'status'=>1,
|
'status'=>1,
|
||||||
'remark'=>json_encode($ids)
|
'title'=>json_encode($ids)
|
||||||
]);
|
]);
|
||||||
if ($check >= $backPurchase) {
|
if ($check >= $backPurchase) {
|
||||||
//补一条待解冻的
|
//补一条待解冻的
|
||||||
// $data = [
|
$left = bcsub($check,$backPurchase,2);
|
||||||
// 'order_id' => $order['id'],
|
if($left > 0){
|
||||||
// 'transaction_id' => $transaction_id ?? 0,
|
$data = [
|
||||||
// 'order_sn' => $order['order_id'],
|
'uid' => $order['uid'],
|
||||||
// 'user_id' => $order['uid'],
|
'order_id' => $order['order_id'],
|
||||||
// 'number' => $total_vip,
|
'title' => '补冻结兑换券',
|
||||||
// 'back_num' => $total_vip,
|
'financial_pm' => 0,
|
||||||
// 'pay_type' => $pay_type ?? 1,
|
'store_id' => $order['store_id'],
|
||||||
// 'status' => 0,
|
'type' => 1,
|
||||||
// 'type' => 1,
|
];
|
||||||
// 'store_id' => $order['store_id'],
|
$data['number'] =$check;
|
||||||
// 'staff_id' => $order['staff_id'],
|
Db::name('user_sign')->insert($data);
|
||||||
// 'create_time' => time()
|
}
|
||||||
// ];
|
User::where('id',$order['uid'])->inc('purchase_funds',$backPurchase)->update();//add
|
||||||
// Db::name('vip_flow')->insert($data);
|
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
//log
|
//log
|
||||||
$data = [
|
$data = [
|
||||||
'vip_flow_id'=>0,
|
'uid' => $order['uid'],
|
||||||
'remark'=>$ids,
|
'order_id' => $order['order_id'],
|
||||||
'order_id' => $order['id'],
|
'title' => '充值获得冻结兑换券',
|
||||||
'order_sn' => $order['order_id'],
|
'financial_pm' => 1,
|
||||||
'user_id' => $order['uid'],
|
|
||||||
'pay_type' => $pay_type ?? 1,
|
|
||||||
'status' => 1,
|
|
||||||
'type' => 1,
|
|
||||||
'store_id' => $order['store_id'],
|
'store_id' => $order['store_id'],
|
||||||
'staff_id' => $order['staff_id'],
|
'type' => 1,
|
||||||
'create_time' => time()
|
|
||||||
];
|
];
|
||||||
$data['number'] =$check;
|
$data['number'] =$check;
|
||||||
Db::name('la_vip_flow_log')->insert($data);
|
Db::name('user_sign_log')->insert($data);
|
||||||
User::where('id',$order['uid'])->inc('purchase_funds',$check)->update();//add
|
User::where('id',$order['uid'])->inc('purchase_funds',$check)->update();//add
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -349,7 +338,7 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -594,21 +583,19 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
public static function dealRechargeFrozen($order)
|
public static function dealRechargeFrozen($order)
|
||||||
{
|
{
|
||||||
$total_vip = bcmul($order['price'],0.1,2);
|
$total_vip = bcmul($order['price'],0.1,2);
|
||||||
$data = [
|
$user_sing = new UserSign();
|
||||||
'order_id' => $order['id'],
|
$sing = [
|
||||||
'transaction_id' => $transaction_id ?? 0,
|
'uid' => $order['uid'],
|
||||||
'order_sn' => $order['order_id'],
|
'order_id' => $order['order_id'],
|
||||||
'user_id' => $order['uid'],
|
'title' => '充值获得冻结兑换券',
|
||||||
|
'financial_pm' => 1,
|
||||||
|
'store_id' => $order['store_id'],
|
||||||
|
'type' => 1,
|
||||||
'number' => $total_vip,
|
'number' => $total_vip,
|
||||||
'back_num' => $total_vip,
|
'back_num' => $total_vip,
|
||||||
'pay_type' => $pay_type ?? 1,
|
|
||||||
'status' => 0,
|
|
||||||
'type' => 1,
|
|
||||||
'store_id' => $order['store_id'],
|
|
||||||
'staff_id' => $order['staff_id'],
|
|
||||||
'create_time' => time()
|
|
||||||
];
|
];
|
||||||
Db::name('vip_flow')->insert($data);
|
$user_sing->save($sing);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user