chengzhiyixia 1 год назад
Родитель
Сommit
d590474dfd

+ 54 - 0
app/common/repositories/store/order/StoreOrderRepository.php

@@ -1080,6 +1080,10 @@ class StoreOrderRepository extends BaseRepository
1080 1080
                             }
1081 1081
 
1082 1082
 
1083
+                        }else if(!empty($array_fzone_paytype['type'] == 'a3')){
1084
+                           
1085
+                            $paystage_status = 1;
1086
+                          
1083 1087
                         }else if(!empty($array_fzone_paytype['type'] == 'c1')){
1084 1088
                             //复购区 复购金支付
1085 1089
 
@@ -9807,6 +9811,56 @@ class StoreOrderRepository extends BaseRepository
9807 9811
             }
9808 9812
 
9809 9813
 
9814
+                //会员专区用户如果是用的现金+VR。直接用VR付款的情况下。
9815
+                $fzone_paytype = json_decode($store_order_data['fzone_paytype'],true);
9816
+                
9817
+                $user_data = Db::name('user')->where('uid',$store_order_data['uid'])->find();
9818
+
9819
+                //会员专区的现金+VR支付
9820
+                if($fzone_paytype['type'] == 'a3'){
9821
+                  
9822
+                  //如果是用的VR支付,不是现金支付的情况下
9823
+                  if($fzone_paytype['price'] <= 0.1){
9824
+                        
9825
+                        $dev_vr = $user_data['vr'] - $fzone_paytype['other'];
9826
+
9827
+                        if($dev_vr >= 0){
9828
+                            $user_data_dev_vr = Db::name('user')->where('uid',$store_order_data['uid'])->update(["vr"=>$dev_vr]);
9829
+                        
9830
+                            if($user_data_dev_vr){
9831
+                                //支出账号存到log日志
9832
+                                $log_data = [
9833
+                                    'uid'=>$user_data['uid'],
9834
+                                    'number'=>$fzone_paytype['other'],
9835
+                                    'mark'=>"购买会员专区商品消费VR:" . $fzone_paytype['other'],
9836
+                                    'desc'=>"VR",
9837
+                                    'order_id'=>0,
9838
+                                    'surplus'=>$dev_vr,
9839
+                                    'order_type'=>0,
9840
+                                    'type'=>2,
9841
+                                    'addtime'=>time()
9842
+                                ];
9843
+                                $user_res_log = Db::name("user_sign_vr")->insert( $log_data);
9844
+                            }
9845
+                        }else{
9846
+                            $log_data = [
9847
+                              
9848
+                                'note'=>"uid:" . $store_order_data['uid'] . " 购买会员专区商品消费VR:" .$fzone_paytype['other'] . " 用户消费前的VR余额:" .  $user_data['vr'] . "描述:" ."未扣成功!" . "备注:" . json_encode($fzone_paytype),
9849
+                               
9850
+                                'create_time'=>date("Y-m-d H:i:s",time())
9851
+                            ];
9852
+                            Db::name("test_log")->insert( $log_data);
9853
+                        }
9854
+                      
9855
+                  }
9856
+
9857
+                    
9858
+
9859
+                    
9860
+                }
9861
+
9862
+
9863
+
9810 9864
         }
9811 9865
         
9812 9866
         //1.0老用户在新2.0表中升级

+ 1 - 1
app/controller/api/store/order/StoreOrder.php

@@ -521,7 +521,7 @@ class StoreOrder extends BaseController
521 521
                     //查询当前用户的上级在1.0中是有数据的,那么老用户介绍新用户。
522 522
                     $sf = Db::name('old_user_jbp')->where('id',$userdatas['uid'])->find();//父级在旧表有注册
523 523
 
524
-                   // $sf1 = Db::name('old_user_jbp')->where('id',$userdatas['id'])->find();
524
+                    // $sf1 = Db::name('old_user_jbp')->where('id',$userdatas['id'])->find();
525 525
  
526 526
                     // 当前用户是在2.0注册的新用户,父级是在1.0
527 527
 

+ 54 - 2
app/controller/api/user/User.php

@@ -1370,9 +1370,11 @@ class User extends BaseController
1370 1370
 
1371 1371
 
1372 1372
         if($teamid == 592){
1373
-             $teamid = 17;//593
1373
+             $teamid = 221;//593
1374 1374
 
1375
-            
1375
+             $team_userinfo_old_jbp2 = $this->getPerformance33($teamid);
1376
+
1377
+            var_dump($team_userinfo_old_jbp2);return;
1376 1378
 
1377 1379
                 $team_userinfo_old_jbp1 = $this->getPerformance22($teamid);
1378 1380
 
@@ -3774,6 +3776,56 @@ function getRecursiveChildren_s($parentUid) {
3774 3776
  /**
3775 3777
      * 获取当前用户业绩
3776 3778
      */
3779
+    public function userupdates($user_id) {
3780
+      
3781
+
3782
+        $children = Db::name("user")
3783
+        ->where("spread_uid", $user_id)
3784
+        ->select(); // 获取子级的 uid 列表
3785
+
3786
+        $total_pv = 0;
3787
+        
3788
+        foreach($children as $k=>$v){
3789
+            //$children_pv = Db::name("store_order")->where("uid", $v['uid'])->whereIn("status",[0,1,2,3])->select();
3790
+            $children_pv = Db::name("user_sign_gongxian")->where("uid", $v['uid'])->where("status",1)->select();
3791
+            foreach($children_pv as $k1=>$v1){
3792
+                $total_pv += $v1['number'];
3793
+            }
3794
+           
3795
+        }  
3796
+        
3797
+        $userdatas = Db::name("user")->where("uid", $user_id)->find();
3798
+       // var_dump($userdatas['user_group']);
3799
+        //如果当前用户是普通消费者的情况下
3800
+        if($userdatas['user_group'] == 1){
3801
+            if($total_pv != 0){
3802
+             
3803
+                if($total_pv >= 1180 && $total_pv < 11800){
3804
+                
3805
+                    Db::name("user")->where("uid", $user_id)->update(['user_group',2]);
3806
+                }
3807
+                
3808
+            }
3809
+        }
3810
+
3811
+        //如果当前用户是业务员消费者的情况下
3812
+        if($userdatas['user_group'] <= 2){
3813
+            if($total_pv != 0){
3814
+             
3815
+                if(11800 <= $total_pv){
3816
+                 
3817
+                   Db::name("user")->where("uid", $user_id)->update(['user_group',3]);
3818
+                }
3819
+                
3820
+            }
3821
+        }
3822
+
3823
+    }
3824
+
3825
+
3826
+ /**
3827
+     * 获取当前用户业绩
3828
+     */
3777 3829
     public function getPerformance22($user_id) {
3778 3830
         $team_amount = 0;
3779 3831
         $person_amount = 0;