WakooHome 1 год назад
Родитель
Сommit
ef75ce982c
1 измененных файлов с 50 добавлено и 0 удалено
  1. 50 0
      app/controller/api/Notify.php

+ 50 - 0
app/controller/api/Notify.php

@@ -672,6 +672,7 @@ class Notify
672 672
                                         Db::name("test_log")->insert( $log_data);
673 673
                                     }
674 674
 
675
+                                    //$this->userupdates(userupdates);
675 676
                                     
676 677
                                 }
677 678
 
@@ -886,6 +887,55 @@ class Notify
886 887
     }
887 888
 
888 889
     /**
890
+     * 获取当前用户业绩
891
+     */
892
+    public function userupdates($user_id) {
893
+      
894
+
895
+        $children = Db::name("user")
896
+        ->where("spread_uid", $user_id)
897
+        ->select(); // 获取子级的 uid 列表
898
+
899
+        $total_pv = 0;
900
+        
901
+        foreach($children as $k=>$v){
902
+            //$children_pv = Db::name("store_order")->where("uid", $v['uid'])->whereIn("status",[0,1,2,3])->select();
903
+            $children_pv = Db::name("user_sign_gongxian")->where("uid", $v['uid'])->where("status",1)->select();
904
+            foreach($children_pv as $k1=>$v1){
905
+                $total_pv += $v1['number'];
906
+            }
907
+           
908
+        }  
909
+        
910
+        $userdatas = Db::name("user")->where("uid", $user_id)->find();
911
+       // var_dump($userdatas['user_group']);
912
+        //如果当前用户是普通消费者的情况下
913
+        if($userdatas['user_group'] == 1){
914
+            if($total_pv != 0){
915
+             
916
+                if($total_pv >= 1180 && $total_pv < 11800){
917
+                
918
+                    Db::name("user")->where("uid", $user_id)->update(['user_group',2]);
919
+                }
920
+                
921
+            }
922
+        }
923
+
924
+        //如果当前用户是业务员消费者的情况下
925
+        if($userdatas['user_group'] <= 2){
926
+            if($total_pv != 0){
927
+             
928
+                if(11800 <= $total_pv){
929
+                 
930
+                   Db::name("user")->where("uid", $user_id)->update(['user_group',3]);
931
+                }
932
+                
933
+            }
934
+        }
935
+
936
+    }
937
+
938
+    /**
889 939
      * 会员升级
890 940
      */
891 941
     public function member_update($orderInfo,$goods_of_info,$user_id)