2 커밋 07a45fb318 ... c4047ba2ae

작성자 SHA1 메시지 날짜
  WakooHome c4047ba2ae Merge branch 'master' of https://git.bjtdba.com/shop/php 1 년 전
  WakooHome ef75ce982c 贡献值修改 1 년 전
1개의 변경된 파일50개의 추가작업 그리고 0개의 파일을 삭제
  1. 50 0
      app/controller/api/Notify.php

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

@@ -675,6 +675,7 @@ class Notify
675 675
                                         Db::name("test_log")->insert( $log_data);
676 676
                                     }
677 677
 
678
+                                    //$this->userupdates(userupdates);
678 679
                                     
679 680
                                 }
680 681
 
@@ -914,6 +915,55 @@ class Notify
914 915
     }
915 916
 
916 917
     /**
918
+     * 获取当前用户业绩
919
+     */
920
+    public function userupdates($user_id) {
921
+      
922
+
923
+        $children = Db::name("user")
924
+        ->where("spread_uid", $user_id)
925
+        ->select(); // 获取子级的 uid 列表
926
+
927
+        $total_pv = 0;
928
+        
929
+        foreach($children as $k=>$v){
930
+            //$children_pv = Db::name("store_order")->where("uid", $v['uid'])->whereIn("status",[0,1,2,3])->select();
931
+            $children_pv = Db::name("user_sign_gongxian")->where("uid", $v['uid'])->where("status",1)->select();
932
+            foreach($children_pv as $k1=>$v1){
933
+                $total_pv += $v1['number'];
934
+            }
935
+           
936
+        }  
937
+        
938
+        $userdatas = Db::name("user")->where("uid", $user_id)->find();
939
+       // var_dump($userdatas['user_group']);
940
+        //如果当前用户是普通消费者的情况下
941
+        if($userdatas['user_group'] == 1){
942
+            if($total_pv != 0){
943
+             
944
+                if($total_pv >= 1180 && $total_pv < 11800){
945
+                
946
+                    Db::name("user")->where("uid", $user_id)->update(['user_group',2]);
947
+                }
948
+                
949
+            }
950
+        }
951
+
952
+        //如果当前用户是业务员消费者的情况下
953
+        if($userdatas['user_group'] <= 2){
954
+            if($total_pv != 0){
955
+             
956
+                if(11800 <= $total_pv){
957
+                 
958
+                   Db::name("user")->where("uid", $user_id)->update(['user_group',3]);
959
+                }
960
+                
961
+            }
962
+        }
963
+
964
+    }
965
+
966
+    /**
917 967
      * 会员升级
918 968
      */
919 969
     public function member_update($orderInfo,$goods_of_info,$user_id)