diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index d2c67b43f..4dac5898d 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -228,164 +228,12 @@ class PayNotifyLogic extends BaseLogic self::dealGoodsLeft($checkArr, $order['uid'], $order['id']); } - // $count = UserSign::where([ - // 'uid'=>$order['uid'], - // 'type'=>1, - // 'status'=>0 - // ])->count(); - // - // if($count){ - // self::addFlowLog($order); - // } - //收银台下单直接到账 - // if($order['shipping_type'] == 3){ - // self::descStock($order['id']); - // } - - // Redis::send('push-platform-print', ['id' => $order['id']], 60); if(in_array($order['shipping_type'],[1,2])){ PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); } } - //采购款支付后如果有对应的冻结的话就去反对应的log - public static function addFlowLog($order) - { - //查询当前用户有无对应的充值的冻结金额 - if ($order['uid'] > 0) { - $query = UserSign::where([ - 'uid' => $order['uid'], - 'type' => 1, - 'status' => 0 - ]); - // $query1 = clone $query; - // $ids = $query->column('id'); - $check = $query->sum('number'); - // $count = $query1->count(); - if ($check && $check > 0) { - $backPurchase = bcmul($order['pay_price'], 0.1, 2); - - // if($count == 1){ - //存在拆单子否 - //少了就冻结减去这个对应的金额 - $one = UserSign::where([ - 'uid' => $order['uid'], - 'type' => 1, - 'status' => 0 - ])->find(); - $data = [ - 'sid' => $one['id'], - 'uid' => $order['uid'], - 'order_id' => $order['order_id'], - 'title' => '充值获得冻结兑换券', - 'financial_pm' => 1, - 'type' => 1, - 'status' => 1, - ]; - - if ($one['number'] >= $backPurchase) { - // $wait = bcsub($one['number'],$backPurchase,2)??0; - $data['number'] = $backPurchase; - - Db::name('user_sign_log')->insert($data); - - //总的减去采购款百分之十剩余的 - // if(empty($wait)){ - // UserSign::where('id',$one['id'])->update( - // [ - // 'number'=>0, - // 'status'=>1 - // ] - // ); - // }else{ - // //add - // UserSign::where('id',$one['id'])->update( - // [ - // 'number'=>$wait - // ] - // ); - // } - - //并且加到对应的用户的采购款中 - // User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update(); - } else { - //对比采购款支付的多少 多了就拿冻结金额即可 - $data['number'] = $one['number']; - //都存到对应的log日志 - Db::name('user_sign_log')->insert($data); - // UserSign::where('id',$one['id'])->update( - // [ - // 'number'=>0, - // 'status'=>1 - // ] - // ); - //并且加到对应的用户的采购款中 - // User::where('id',$order['uid'])->inc('purchase_funds',$wait)->update(); - } - } - /* else{ - //大于0的时候 - //先处理金额大的再处理剩余的 - //把所有的金额改为正的再加一条后再加 - UserSign::where([ - 'uid'=>$order['uid'], - 'type'=>1, - 'status'=>0 - ])->update([ - 'status'=>1, - 'title'=>json_encode($ids) - ]); - if ($check >= $backPurchase) { - //补一条待解冻的 - $left = bcsub($check,$backPurchase,2); - if($left > 0){ - $data = [ - 'uid' => $order['uid'], - 'order_id' => $order['order_id'], - 'title' => '补冻结兑换券', - 'financial_pm' => 0, - 'type' => 1, - ]; - $data['number'] =$check; - $sid = Db::name('user_sign')->insertGetId($data); - - $data = [ - 'uid' => $order['uid'], - 'sid' => $sid, - 'order_id' => $order['order_id'], - 'title' => '充值获得冻结兑换券', - 'financial_pm' => 1, - 'type' => 1, - ]; - $data['number'] =$backPurchase; - Db::name('user_sign_log')->insert($data); - } -// User::where('id',$order['uid'])->inc('purchase_funds',$backPurchase)->update();//add - - }else{ - //log - $data = [ - 'uid' => $order['uid'], - 'order_id' => $order['order_id'], - 'title' => '充值获得冻结兑换券', - 'financial_pm' => 1, - 'type' => 1, - ]; - $data['number'] =$check; - Db::name('user_sign_log')->insert($data); -// User::where('id',$order['uid'])->inc('purchase_funds',$check)->update();//add - } - - }*/ - - // } - return true; - } - - return true; - } - /** * @notes 微信通用回调 * @param $orderSn @@ -735,7 +583,7 @@ class PayNotifyLogic extends BaseLogic } //积分写入 - if($order['pay_type']<=14){ + if(in_array($order['pay_type'],[3,7,9,13,17])&&$order['uid']>0){ UserSignLogic::OrderWrite($order); } if ($off_activity == 1) {