Browse Source

Merge branch 'master' of https://git.bjtdba.com/shop/php

hefei 1 year ago
parent
commit
0e801d2894
1 changed files with 190 additions and 189 deletions
  1. 190 189
      app/common/repositories/user/UserRepository.php

+ 190 - 189
app/common/repositories/user/UserRepository.php

@@ -148,9 +148,9 @@ class UserRepository extends BaseRepository
148 148
         }
149 149
 
150 150
 
151
-//        $area_manage=Db::name('area_manage')->where('uid',$id)->find();
151
+        //        $area_manage=Db::name('area_manage')->where('uid',$id)->find();
152 152
         $area_manage=null;
153
-//        $area_manage_type=Db::name('area_manage')->where('uid',$id)->value('type');
153
+        //        $area_manage_type=Db::name('area_manage')->where('uid',$id)->value('type');
154 154
         //类型 district-区/县代 city-市代',
155 155
         $user['area_manage_type'] ='0';
156 156
 
@@ -278,25 +278,25 @@ class UserRepository extends BaseRepository
278 278
 
279 279
 
280 280
         ];
281
-//        1 镇代 2 县代 3 市代 4 商户 5 推广员
282
-//        $title="用户";
283
-//        if ($user['identity']==1){
284
-//            $title="镇代";
285
-//        }
286
-//        if ($user['identity']==2){
287
-//            $title="县代";
288
-//        }
289
-//        if ($user['identity']==3){
290
-//            $title="市代";
291
-//        }
292
-//        if ($user['identity']==4){
293
-//            $title="商户";
294
-//        }
295
-//        if ($user['identity']==5){
296
-//            $title="推广员";
297
-//        }
298
-//
299
-//        $where[] = Elm::text('identity', $title );
281
+        //        1 镇代 2 县代 3 市代 4 商户 5 推广员
282
+        //        $title="用户";
283
+        //        if ($user['identity']==1){
284
+        //            $title="镇代";
285
+        //        }
286
+        //        if ($user['identity']==2){
287
+        //            $title="县代";
288
+        //        }
289
+        //        if ($user['identity']==3){
290
+        //            $title="市代";
291
+        //        }
292
+        //        if ($user['identity']==4){
293
+        //            $title="商户";
294
+        //        }
295
+        //        if ($user['identity']==5){
296
+        //            $title="推广员";
297
+        //        }
298
+        //
299
+        //        $where[] = Elm::text('identity', $title );
300 300
         if ($user['identity']!=0){
301 301
             $where[] =Elm::input('mer_rebate', "推荐商户返利");
302 302
             $where[] =Elm::input('promoter_rebate', "推荐代理返利");
@@ -308,9 +308,9 @@ class UserRepository extends BaseRepository
308 308
         }
309 309
         if ($user['identity']==1){
310 310
             $where[] =Elm::input('agent_rebate', "推荐推广员返利");
311
-//            $title="镇代返利";
312
-//            $where[] =Elm::input('jurisdiction', "辖区内收入");
313
-//            $where[] =Elm::input('adv_fee', "广告费");
311
+            //            $title="镇代返利";
312
+            //            $where[] =Elm::input('jurisdiction', "辖区内收入");
313
+            //            $where[] =Elm::input('adv_fee', "广告费");
314 314
             $where[] =Elm::input('xqxiaofei', "自己辖区消费返利");
315 315
         }
316 316
         if ($user['identity']==2){
@@ -374,7 +374,7 @@ class UserRepository extends BaseRepository
374 374
         $count = Db::name("user_agent")
375 375
             ->where($where)
376 376
             ->count();
377
-//        $count =$query->where($where)->count();
377
+        //        $count =$query->where($where)->count();
378 378
         foreach($list as $k=>$value){
379 379
             $city['province']  = Db::name("user_province")->where(['province_id'=>$value['province_id']])->value("province_name");
380 380
             $city['city']  = Db::name("user_city")->where(['city_id'=>$value['city_id']])->value("city_name");
@@ -440,7 +440,7 @@ class UserRepository extends BaseRepository
440 440
         $count5 =  Db::name("user")->where($wheres2)->where("identity", 5 )->count();
441 441
         $sart=[
442 442
             ['className'=> 'el-icon-s-goods', 'count'=>$count1, 'field'=>'人', 'name'=> '镇级服务商' ], [ 'className'=> 'el-icon-s-goods', 'count'=>$count2, 'field'=> '人', 'name'=>'县级服务商'], [ 'className'=> 'el-icon-s-order', 'count'=> $count3, 'field'=> '人', 'name'=> '市级服务商' ], [ 'className'=> 'el-icon-s-order', 'count'=> $count5, 'field'=> '人', 'name'=> '推广员' ]];
443
-//        [{ 'className': 'el-icon-s-goods', 'count': '21.00', 'field': '元', 'name': '总支付金额' }, { 'className': 'el-icon-s-goods', 'count': '0.00', 'field': '元', 'name': '服务商返利' }, { 'className': 'el-icon-s-order', 'count': '3.24', 'field': '元', 'name': '养老金' }]
443
+        //        [{ 'className': 'el-icon-s-goods', 'count': '21.00', 'field': '元', 'name': '总支付金额' }, { 'className': 'el-icon-s-goods', 'count': '0.00', 'field': '元', 'name': '服务商返利' }, { 'className': 'el-icon-s-order', 'count': '3.24', 'field': '元', 'name': '养老金' }]
444 444
 
445 445
 
446 446
         return compact('count', 'list','sart','wheres');
@@ -486,17 +486,17 @@ class UserRepository extends BaseRepository
486 486
                 if(empty($item['lx'])){
487 487
                     $item['lx'] = '普通用户';
488 488
                 }
489
-//                try {
490
-//                    $certification = Db::name('user_certification')
491
-//                        ->where('uid', $item->uid)
492
-//                        ->find();
493
-//                    if ($certification) {
494
-//                        $response = $this->checkAmount($certification);
495
-//                        $item->gzcAmount = $response['amount'];
496
-//                    }
497
-//                } catch (\Throwable $w) {
498
-//                    $item->gzcAmount = 0;
499
-//                }
489
+                //                try {
490
+                //                    $certification = Db::name('user_certification')
491
+                //                        ->where('uid', $item->uid)
492
+                //                        ->find();
493
+                //                    if ($certification) {
494
+                //                        $response = $this->checkAmount($certification);
495
+                //                        $item->gzcAmount = $response['amount'];
496
+                //                    }
497
+                //                } catch (\Throwable $w) {
498
+                //                    $item->gzcAmount = 0;
499
+                //                }
500 500
                 $item->label = count($item['label_id']) ? $make->labels($item['label_id']) : [];
501 501
 
502 502
                 $user_rich=Db::name('user_rich')->where('uid', $item['uid'])->find();
@@ -504,7 +504,7 @@ class UserRepository extends BaseRepository
504 504
                 $item->is_huitian = (isset($user_rich) && $user_rich['is_huitian']==1)?true:false;
505 505
                 $item->user_rich_type= (isset($user_rich) )?$user_rich['type']:0;
506 506
                 $item->stockholder= (isset($user_rich) )?$user_rich['stockholder']:0;
507
-//                $area_manage_type=Db::name('area_manage')->where('uid', $item['uid'])->value('type');
507
+                //                $area_manage_type=Db::name('area_manage')->where('uid', $item['uid'])->value('type');
508 508
                 //类型 district-区/县代 city-市代',
509 509
                 $item->area_manage_type=$item['user_group'];
510 510
                 $item->user_rich=$user_rich;
@@ -625,10 +625,10 @@ class UserRepository extends BaseRepository
625 625
         }
626 626
 
627 627
 
628
-//        if ($where['status']==2){
629
-//            unset($data['is_promoter'],$data['promoter_time']);
630
-//            Db::name("user_agent")->where("user_id",$id)->update(["status"=>2,"update_time"=>time()]);
631
-//        }
628
+        //        if ($where['status']==2){
629
+        //            unset($data['is_promoter'],$data['promoter_time']);
630
+        //            Db::name("user_agent")->where("user_id",$id)->update(["status"=>2,"update_time"=>time()]);
631
+        //        }
632 632
         return true;
633 633
     }
634 634
     /**
@@ -703,11 +703,11 @@ class UserRepository extends BaseRepository
703 703
      * @param $order_sn
704 704
      */
705 705
     public function add_bill($title,$number,$uid,$mark,$commission_type,$order_sn,$order_id=0){
706
-//        $old_number=Db::name("user")->where("uid",$uid)->value("brokerage_price");
706
+        //        $old_number=Db::name("user")->where("uid",$uid)->value("brokerage_price");
707 707
         $data=[
708 708
             'link_id' => $order_id,
709 709
             "uid"=>$uid,
710
-//            "pm"=>1,
710
+            //            "pm"=>1,
711 711
             "title"=>$title,
712 712
             "category"=>"now_money",
713 713
             "type"=>"commission",
@@ -720,7 +720,7 @@ class UserRepository extends BaseRepository
720 720
             "order_sn"=>$order_sn,
721 721
         ];
722 722
         Db::name("user_bill")->insert($data);
723
-//        Db::name("user")->where("uid",$uid)->inc('brokerage_price', $number) ->update();
723
+        //        Db::name("user")->where("uid",$uid)->inc('brokerage_price', $number) ->update();
724 724
     }
725 725
 
726 726
     public function merList(string $keyword, $page, $limit)
@@ -832,8 +832,8 @@ class UserRepository extends BaseRepository
832 832
             return Elm::createForm(Route::buildUrl('systemUserChangePro', compact('id'))->build(), [
833 833
                 Elm::input('spread_account', '业绩归属人账号')->required()->placeholder("请填写业绩归属人手机号")->info('修改业绩归属人后,用户业绩归属至所填写账号下,但邀请关系及其他邀请相关的奖励不变!'),
834 834
                 Elm::hidden('type', '1')
835
-        ])->setTitle('修改业绩归属人');
836
-    }
835
+            ])->setTitle('修改业绩归属人');
836
+        }
837 837
         return Elm::createForm(Route::buildUrl('systemUserChangePro', compact('id'))->build(), [
838 838
             Elm::input('spread_account', '推荐人')->required()->placeholder("请填写推荐人手机号")
839 839
         ])->setTitle('修改用户推荐人');
@@ -916,19 +916,19 @@ class UserRepository extends BaseRepository
916 916
                 'last_ip' => $request->ip(),
917 917
             ]);
918 918
         }
919
-//        else
920
-//            $user = $this->create($userType, [
921
-//                'account' => 'wx' . $wechatUser->wechat_user_id . time(),
922
-//                'wechat_user_id' => $wechatUser->wechat_user_id,
923
-//                'pwd' => $this->encodePassword(123456),
924
-//                'nickname' => $wechatUser['nickname'] ?: '',
925
-//                'avatar' => $wechatUser['headimgurl'] ?: '',
926
-//                'sex' => $wechatUser['sex'] ?: 0,
927
-//                'spread_uid' => 0,
928
-//                'is_promoter' => 0,
929
-//                'last_time' => date('Y-m-d H:i:s'),
930
-//                'last_ip' => $request->ip()
931
-//            ]);
919
+        //        else
920
+        //            $user = $this->create($userType, [
921
+        //                'account' => 'wx' . $wechatUser->wechat_user_id . time(),
922
+        //                'wechat_user_id' => $wechatUser->wechat_user_id,
923
+        //                'pwd' => $this->encodePassword(123456),
924
+        //                'nickname' => $wechatUser['nickname'] ?: '',
925
+        //                'avatar' => $wechatUser['headimgurl'] ?: '',
926
+        //                'sex' => $wechatUser['sex'] ?: 0,
927
+        //                'spread_uid' => 0,
928
+        //                'is_promoter' => 0,
929
+        //                'last_time' => date('Y-m-d H:i:s'),
930
+        //                'last_ip' => $request->ip()
931
+        //            ]);
932 932
 
933 933
         return $user;
934 934
     }
@@ -951,16 +951,16 @@ class UserRepository extends BaseRepository
951 951
             $user = $this->dao->create($userInfo); //创建用户
952 952
             $this -> insterUser($user->uid, $spread_uid);
953 953
             //唯品会pid
954
-//            $vip = app()->make(Vip::class);
955
-//            $vip->create_pid($user->uid);
956
-//            //拼多多pid
957
-//            $taoke = app()->make(TaoKe::class);
958
-//            $taoke->generateAd($user->uid);
959
-//            //京东pid(改成京京推推就)
960
-//            $jd = app()->make(Jd::class);
961
-//            $jd->create_pid($user->uid);
962
-//
963
-//            Queue::push(SendNewPeopleCouponJob::class, $user->uid);
954
+            //            $vip = app()->make(Vip::class);
955
+            //            $vip->create_pid($user->uid);
956
+            //            //拼多多pid
957
+            //            $taoke = app()->make(TaoKe::class);
958
+            //            $taoke->generateAd($user->uid);
959
+            //            //京东pid(改成京京推推就)
960
+            //            $jd = app()->make(Jd::class);
961
+            //            $jd->create_pid($user->uid);
962
+            //
963
+            //            Queue::push(SendNewPeopleCouponJob::class, $user->uid);
964 964
 
965 965
             //赠送积分 注册送30积分
966 966
             $this->sign_add($user['uid'], 30,1,'注册送30积分','','', '', 1, '', 1);
@@ -988,41 +988,41 @@ class UserRepository extends BaseRepository
988 988
         /**
989 989
          * 查询上级人数  select * from rrx_user_count LIMIT 0,1
990 990
          */
991
-//        $spread_uid = Db::name('user') -> where('uid', $uid) -> value('spread_uid');
992
-//        Db::name('log')->insert(['data'=>'公排注册:'.$uid.'======'.$spread_uid]);
993
-//        $userCount = false;
994
-//        if ($spread_uid > 0){
995
-//            //找直推上级网络里面不足5人的排进去
996
-//
997
-//            $userCount = Db::name('user_count') -> where('level_number >= 0') -> where ('uid', $spread_uid) -> find();
998
-//            if (!$userCount){
999
-//                $userCount = $this -> getCountUId($spread_uid);
1000
-//            }
1001
-//
1002
-//
1003
-//        }
991
+        //        $spread_uid = Db::name('user') -> where('uid', $uid) -> value('spread_uid');
992
+        //        Db::name('log')->insert(['data'=>'公排注册:'.$uid.'======'.$spread_uid]);
993
+        //        $userCount = false;
994
+        //        if ($spread_uid > 0){
995
+        //            //找直推上级网络里面不足5人的排进去
996
+        //
997
+        //            $userCount = Db::name('user_count') -> where('level_number >= 0') -> where ('uid', $spread_uid) -> find();
998
+        //            if (!$userCount){
999
+        //                $userCount = $this -> getCountUId($spread_uid);
1000
+        //            }
1001
+        //
1002
+        //
1003
+        //        }
1004 1004
         // Log::info("userCount:::");
1005 1005
         // Log::info($userCount);
1006 1006
         // Log::info($spread_uid);
1007 1007
 
1008
-//        Db::name('log')->insert(['data'=>'uid:'.$uid.'公排注册:'.json_encode($userCount)]);
1009
-//        if (!$userCount){
1010
-//            //没有直推上级 大公排
1011
-//            $userCount = Db::name('user_count') -> where('level_number >= 0') -> find();
1012
-//            //增加一个只查询新账户大公排下的用户
1013
-//            // $userCount = Db::name('user_count') -> where('level_number >= 0')->whereIn('uid',$this->getUserLevelId(11112)) -> find();
1014
-//        }
1015
-//        if ($userCount) {
1016
-//            if ($userCount['level_number'] + 1 == systemConfig( 'max_level_number')) {  //(33制或者55制)下级最大人数systemConfig( 'max_level_number')
1017
-//                Db::name('user_count') -> where('uid',$userCount['uid'])->delete();
1018
-//            } else {
1019
-//                $level_number = $userCount['level_number'] + 1;
1020
-//                Db::name('user_count') -> where('uid',$userCount['uid']) -> update(['level_number'=>$level_number]);
1021
-//            }
1022
-//        }
1008
+        //        Db::name('log')->insert(['data'=>'uid:'.$uid.'公排注册:'.json_encode($userCount)]);
1009
+        //        if (!$userCount){
1010
+        //            //没有直推上级 大公排
1011
+        //            $userCount = Db::name('user_count') -> where('level_number >= 0') -> find();
1012
+        //            //增加一个只查询新账户大公排下的用户
1013
+        //            // $userCount = Db::name('user_count') -> where('level_number >= 0')->whereIn('uid',$this->getUserLevelId(11112)) -> find();
1014
+        //        }
1015
+        //        if ($userCount) {
1016
+        //            if ($userCount['level_number'] + 1 == systemConfig( 'max_level_number')) {  //(33制或者55制)下级最大人数systemConfig( 'max_level_number')
1017
+        //                Db::name('user_count') -> where('uid',$userCount['uid'])->delete();
1018
+        //            } else {
1019
+        //                $level_number = $userCount['level_number'] + 1;
1020
+        //                Db::name('user_count') -> where('uid',$userCount['uid']) -> update(['level_number'=>$level_number]);
1021
+        //            }
1022
+        //        }
1023 1023
         // dd($spread_uid);
1024
-//        Db::name('user') -> where('uid',$uid)->update(['level_id'=>$userCount['uid'],'level'=>$this->level()]);
1025
-//        Db::name('user_count') -> insert(['uid'=>$uid]);
1024
+        //        Db::name('user') -> where('uid',$uid)->update(['level_id'=>$userCount['uid'],'level'=>$this->level()]);
1025
+        //        Db::name('user_count') -> insert(['uid'=>$uid]);
1026 1026
     }
1027 1027
 
1028 1028
     public function getCountUId($spread_uid){
@@ -1075,10 +1075,10 @@ class UserRepository extends BaseRepository
1075 1075
         if($user -> user_number == ''){
1076 1076
             $this -> createUserNumber($user->uid);
1077 1077
         }
1078
-//        if($user -> im == 0 && env('im',false)){
1079
-//            $im = new Im();
1080
-//            $im -> createIm($user -> account,$user -> user_number);
1081
-//        }
1078
+        //        if($user -> im == 0 && env('im',false)){
1079
+        //            $im = new Im();
1080
+        //            $im -> createIm($user -> account,$user -> user_number);
1081
+        //        }
1082 1082
         return $token;
1083 1083
     }
1084 1084
 
@@ -1210,7 +1210,7 @@ class UserRepository extends BaseRepository
1210 1210
     }
1211 1211
     public function addregistr($data)
1212 1212
     {
1213
-//        string $phone, ?string $pwd, $user_type = 'h5',$url,
1213
+        //        string $phone, ?string $pwd, $user_type = 'h5',$url,
1214 1214
         $phone=$data['phone'];
1215 1215
         $pwd=empty($data['password'])?time():$data['password'];
1216 1216
 
@@ -1437,15 +1437,15 @@ class UserRepository extends BaseRepository
1437 1437
                         'fontColor' => '0,0,0',       //字体颜色
1438 1438
                         'angle' => 0,
1439 1439
                     ),
1440
-//                    array(
1441
-//                        'text' => '邀请您加入' . $siteName,
1442
-//                        'left' => 290,
1443
-//                        'top' => 750,
1444
-//                        'fontPath' => $filelink['Normal'],     //字体文件
1445
-//                        'fontSize' => 16,             //字号
1446
-//                        'fontColor' => '40,40,40',       //字体颜色
1447
-//                        'angle' => 0,
1448
-//                    )
1440
+                    //                    array(
1441
+                    //                        'text' => '邀请您加入' . $siteName,
1442
+                    //                        'left' => 290,
1443
+                    //                        'top' => 750,
1444
+                    //                        'fontPath' => $filelink['Normal'],     //字体文件
1445
+                    //                        'fontSize' => 16,             //字号
1446
+                    //                        'fontColor' => '40,40,40',       //字体颜色
1447
+                    //                        'angle' => 0,
1448
+                    //                    )
1449 1449
                 ),
1450 1450
                 'background' => $item['pic']
1451 1451
             );
@@ -1558,7 +1558,7 @@ class UserRepository extends BaseRepository
1558 1558
         }
1559 1559
 
1560 1560
         //绑定上下级关系 加入推广群
1561
-//        $this -> hximTg($user -> uid,$spreadUid);
1561
+        //        $this -> hximTg($user -> uid,$spreadUid);
1562 1562
     }
1563 1563
 
1564 1564
     /**
@@ -1702,7 +1702,7 @@ class UserRepository extends BaseRepository
1702 1702
     public function getLevelList($uid, array $where, $page, $limit)
1703 1703
     {
1704 1704
         if (!$where['level']) {
1705
-//            $ids = $this->dao->getSubIds($uid);
1705
+            //            $ids = $this->dao->getSubIds($uid);
1706 1706
             $ids[] = $uid;
1707 1707
             $where['spread_uids'] = $ids;
1708 1708
         } else if ($where['level'] == 2) {
@@ -1915,7 +1915,7 @@ class UserRepository extends BaseRepository
1915 1915
                 'balance' =>$now_score
1916 1916
             ]);
1917 1917
             Db::name('user')->where( array('uid' => $member_id) )->update(['now_score'=>$now_score]);
1918
-//            Db::name('log')->insert(['data'=>Db::name('user')->getLastSql(),'time'=>date('Y-m-d H:i:s',time())]);
1918
+            //            Db::name('log')->insert(['data'=>Db::name('user')->getLastSql(),'time'=>date('Y-m-d H:i:s',time())]);
1919 1919
             return  array('code' =>0, 'now_score' => $score, 'continuity_day' => $has_qian,'reward_socre' => $get_score );
1920 1920
         }
1921 1921
     }
@@ -2028,14 +2028,14 @@ class UserRepository extends BaseRepository
2028 2028
             }
2029 2029
         }
2030 2030
         //判断是不是商户
2031
-//        if($user['identity']==4){
2032
-//            return  ['code'=>'400','msg'=>"不符合申请代理的条件"];
2033
-//        }
2031
+        //        if($user['identity']==4){
2032
+        //            return  ['code'=>'400','msg'=>"不符合申请代理的条件"];
2033
+        //        }
2034 2034
 
2035 2035
         //判断用户是否是其他代理身份
2036
-//        if(in_array($user['identity'],[1,2,3,5])){
2037
-//            return  ['code'=>'400','msg'=>"用户已是推广身份"];
2038
-//        }
2036
+        //        if(in_array($user['identity'],[1,2,3,5])){
2037
+        //            return  ['code'=>'400','msg'=>"用户已是推广身份"];
2038
+        //        }
2039 2039
         if($user['identity']==$data['identity']){
2040 2040
             return  ['code'=>'400','msg'=>"用户已是该身份,无需申请"];
2041 2041
         }
@@ -2166,11 +2166,11 @@ class UserRepository extends BaseRepository
2166 2166
     public function get_profit_info($member_id,$where){
2167 2167
 
2168 2168
 
2169
-//        $data["count_yj"]=Db::name("user")->where(["type"=>"commission"])->sum("number");
2170
-//        $data["dlfee"]=Db::name("user")->where(["type"=>"commission","commission_type"=>1])->sum("number");
2171
-//        $data["xiaofee"]=Db::name("user")->where(["type"=>"commission","commission_type"=>2])->sum("number");;
2172
-//        $data["county"] =Db::name("user")->where(["type"=>"commission","commission_type"=>1])->sum("number");;
2173
-//        $data["town"]==Db::name("user")->where(["type"=>"commission","commission_type"=>1])->sum("number");;
2169
+        //        $data["count_yj"]=Db::name("user")->where(["type"=>"commission"])->sum("number");
2170
+        //        $data["dlfee"]=Db::name("user")->where(["type"=>"commission","commission_type"=>1])->sum("number");
2171
+        //        $data["xiaofee"]=Db::name("user")->where(["type"=>"commission","commission_type"=>2])->sum("number");;
2172
+        //        $data["county"] =Db::name("user")->where(["type"=>"commission","commission_type"=>1])->sum("number");;
2173
+        //        $data["town"]==Db::name("user")->where(["type"=>"commission","commission_type"=>1])->sum("number");;
2174 2174
         $query = Db::name("user_bill")->where(["type"=>"commission",'uid'=>$member_id])
2175 2175
             ->field("type,number,status,commission_type,create_time,uid,title,order_sn");
2176 2176
 
@@ -2198,7 +2198,7 @@ class UserRepository extends BaseRepository
2198 2198
         $weijiesuan=0;
2199 2199
         $qudao=0;
2200 2200
         foreach ($list as &$v){
2201
-//            $count_yj=$v["number"]+$count_yj;
2201
+            //            $count_yj=$v["number"]+$count_yj;
2202 2202
 
2203 2203
             if ($v["status"]==0){
2204 2204
                 $v["title"]="【预估】".$v["title"].",单号:".$v["order_sn"];
@@ -2269,7 +2269,7 @@ class UserRepository extends BaseRepository
2269 2269
         $ptjl=0;
2270 2270
         $qudao=0;
2271 2271
         foreach ($list as &$v){
2272
-//            $count_yj=$v["number"]+$count_yj;
2272
+            //            $count_yj=$v["number"]+$count_yj;
2273 2273
 
2274 2274
             if ($v["commission_type"]==1){
2275 2275
                 $dlfee+=$v["number"];
@@ -2300,10 +2300,10 @@ class UserRepository extends BaseRepository
2300 2300
                 $tuiguang+=$v["number"];
2301 2301
                 $v['title'] = '推荐商户奖励佣金';
2302 2302
             }
2303
-//            if ($v['type_shop'] >0){
2304
-//                $qudao+=$v['number'];
2305
-//                $v['title'] = '第三方订单获取佣金';
2306
-//            }
2303
+            //            if ($v['type_shop'] >0){
2304
+            //                $qudao+=$v['number'];
2305
+            //                $v['title'] = '第三方订单获取佣金';
2306
+            //            }
2307 2307
 
2308 2308
         }
2309 2309
         $data["count_yj"]=round($dangqian_yj,2);//当前佣金
@@ -2371,7 +2371,7 @@ class UserRepository extends BaseRepository
2371 2371
 
2372 2372
         $list= $query->order("create_time desc")->page($page,$limit)->select()->toArray();
2373 2373
         foreach ($list as &$v){
2374
-//            $v["create_time"]=date("Y-m-d", $v["create_time"]);
2374
+            //            $v["create_time"]=date("Y-m-d", $v["create_time"]);
2375 2375
             //0平台1多多进宝2唯品会3苏宁易购4网易考拉5淘宝客6京东联盟7饿了么
2376 2376
             if($v['type_shop'] == 0){
2377 2377
 
@@ -2399,8 +2399,8 @@ class UserRepository extends BaseRepository
2399 2399
                 $this -> getContent('order_su',$v['order_sn'],'苏宁易购',$v['status'],$v['commission_type'],$v);
2400 2400
             }
2401 2401
             elseif ($v['type_shop'] == '4'){
2402
-//                $uid = Db::name('order_jd')->where("order_sn",$v["order_sn"])->value("uid");
2403
-//                $v["nickname"]=$this -> getUserNickname($uid);
2402
+                //                $uid = Db::name('order_jd')->where("order_sn",$v["order_sn"])->value("uid");
2403
+                //                $v["nickname"]=$this -> getUserNickname($uid);
2404 2404
                 $v["nickname"]='';
2405 2405
                 $v['content'] = $v['nickname'].'在网易考拉消费,帮您攒金';
2406 2406
                 $v['xiadan'] = '';
@@ -2455,14 +2455,14 @@ class UserRepository extends BaseRepository
2455 2455
                 $v["nickname"]=$this -> getUserNickname($res['uid']);
2456 2456
                 $v['content'] = $yugu.$v['nickname'].'在'.$title.'消费,帮您攒金';
2457 2457
         }
2458
-//        $v['xiadan'] = $res['create_time'] ?? $create_time;
2458
+        //        $v['xiadan'] = $res['create_time'] ?? $create_time;
2459 2459
         $v['xiadan'] = isset($res['pay_time'])?$res['pay_time']:$create_time;
2460 2460
         $v['jiesuan'] = $v['xiadan'];
2461
-//        if (empty($res['bill_end_time']) && empty($res['create_time'])){
2462
-//            $v['jiesuan'] = $create_time;
2463
-//        }else{
2464
-//            $v['jiesuan'] = date('Y-m-d H:i:s',$res['bill_end_time']??strtotime("+10 day", strtotime($res['create_time'])));
2465
-//        }
2461
+        //        if (empty($res['bill_end_time']) && empty($res['create_time'])){
2462
+        //            $v['jiesuan'] = $create_time;
2463
+        //        }else{
2464
+        //            $v['jiesuan'] = date('Y-m-d H:i:s',$res['bill_end_time']??strtotime("+10 day", strtotime($res['create_time'])));
2465
+        //        }
2466 2466
     }
2467 2467
 
2468 2468
 
@@ -2473,7 +2473,7 @@ class UserRepository extends BaseRepository
2473 2473
         $where=["ul.type"=>"commission","ul.status"=>1,'ul.uid'=>$member_id];
2474 2474
         $list=Db::name("user_bill")
2475 2475
             ->alias("ul")
2476
-//            ->join("user u","u.uid=ul.uid")
2476
+            //            ->join("user u","u.uid=ul.uid")
2477 2477
             ->where("commission_type","<>",5)
2478 2478
             ->where($where)
2479 2479
             ->field("ul.mark,ul.bill_id,ul.type,ul.number,ul.status,ul.create_time,ul.uid,ul.order_sn,ul.create_time,ul.link_id")
@@ -2483,7 +2483,7 @@ class UserRepository extends BaseRepository
2483 2483
         foreach ($list as &$v){
2484 2484
 
2485 2485
             $num++;
2486
-//            $v["create_time"]=date("Y-m-d", $v["create_time"]);
2486
+            //            $v["create_time"]=date("Y-m-d", $v["create_time"]);
2487 2487
             $uid=Db::name("store_order")->where("order_sn",$v["order_sn"])->value("uid");
2488 2488
             $v["nickname"]=Db::name("user")->where("uid", $uid)->value("nickname");
2489 2489
             $count+=$v["number"];
@@ -2497,40 +2497,40 @@ class UserRepository extends BaseRepository
2497 2497
             ->where("uid",$member_id)
2498 2498
             ->field("wechat_user_id,card_id,ali_user_id,annuity_frozen,annuity_num,annuity,create_time,birthday,birthday60,card_number,annuity_yiqu,pay_price")
2499 2499
             ->find();
2500
-//        $data['annuity'] = 0;
2500
+        //        $data['annuity'] = 0;
2501 2501
         $certification = Db::name("user_certification")->where("uid",$member_id)->find();
2502 2502
         $data['can_withdraw'] = 0;
2503 2503
         if (!$certification || $certification["status"] !=1 || !$certification["user_card"]){
2504 2504
             $data["birthday60"] = "未实名认证";
2505 2505
             $data['is_certification'] = 0;
2506 2506
         } else {
2507
-//            try {
2508
-//                $checkAmount = $this->checkAmount($certification);
2509
-//                if ($checkAmount['code'] == 0) {
2510
-//                    $data['annuity'] = $checkAmount['extendData']['amount'];
2511
-//                }
2512
-//            } catch (\Throwable $e) {
2513
-//               Log::info('getyanglaojin' . $e->getMessage());
2514
-//            }
2507
+            //            try {
2508
+            //                $checkAmount = $this->checkAmount($certification);
2509
+            //                if ($checkAmount['code'] == 0) {
2510
+            //                    $data['annuity'] = $checkAmount['extendData']['amount'];
2511
+            //                }
2512
+            //            } catch (\Throwable $e) {
2513
+            //               Log::info('getyanglaojin' . $e->getMessage());
2514
+            //            }
2515 2515
             $data['is_certification'] = 1;
2516 2516
             $birth_data = substr($certification["user_card"], 6, 8);
2517
-//            $birth = strtotime(substr($certification["user_card"], 6, 8));
2517
+            //            $birth = strtotime(substr($certification["user_card"], 6, 8));
2518 2518
             $old_age = $this->getSex($certification["user_card"])?60:55;
2519
-//            $age = $this->howOld($birth);
2519
+            //            $age = $this->howOld($birth);
2520 2520
             $age=$this->calculateAge($birth_data);
2521 2521
 
2522 2522
             if ($age < $old_age) {
2523
-//                $yes = $old_age - $age;
2524
-//                $data["birthday60"] = date("Y-" . substr($birth_data, 4, 2) . '-' . substr($birth_data, 6, 2), strtotime("+" . $yes . " year"));
2523
+                //                $yes = $old_age - $age;
2524
+                //                $data["birthday60"] = date("Y-" . substr($birth_data, 4, 2) . '-' . substr($birth_data, 6, 2), strtotime("+" . $yes . " year"));
2525 2525
             }
2526 2526
             if ($age == $old_age) {
2527 2527
                 $data['can_withdraw'] = 1;
2528
-//                $data["birthday60"] = date("Y-m-d", $birth);
2528
+                //                $data["birthday60"] = date("Y-m-d", $birth);
2529 2529
             }
2530 2530
             if ($age > $old_age) {
2531 2531
                 $data['can_withdraw'] = 1;
2532
-//                $yes = $age - $old_age;
2533
-//                $data["birthday60"] = date("Y-" . substr($birth_data, 4, 2) . '-' . substr($birth_data, 6, 2), strtotime("-" . $yes . " year"));
2532
+                //                $yes = $age - $old_age;
2533
+                //                $data["birthday60"] = date("Y-" . substr($birth_data, 4, 2) . '-' . substr($birth_data, 6, 2), strtotime("-" . $yes . " year"));
2534 2534
             }
2535 2535
             //收益余额
2536 2536
             $data['annuity_num'] = 123;
@@ -2550,7 +2550,7 @@ class UserRepository extends BaseRepository
2550 2550
         //加上线下消费的
2551 2551
         $data['pay_price'] = bcadd($data['pay_price'],$order_merchant_price,2);
2552 2552
         $data["yinghang"] = "中信公证处消费养老金账户";
2553
-//        $data["yinghang"]='https://app.bjtdba.com/uploads/def/20201021/8cb66944101287b8ac9c9b9fb1b13a79.png';
2553
+        //        $data["yinghang"]='https://app.bjtdba.com/uploads/def/20201021/8cb66944101287b8ac9c9b9fb1b13a79.png';
2554 2554
         $data["add_up"] = 0.00;
2555 2555
 
2556 2556
 
@@ -2654,7 +2654,7 @@ class UserRepository extends BaseRepository
2654 2654
         foreach ($data as $k=>&$v){
2655 2655
 
2656 2656
             if($v['withdrawal_type']==2){
2657
-//                $name=Db::name('merchant')->where('mer_id',$v['mer_id'])->value('mer_name');
2657
+                //                $name=Db::name('merchant')->where('mer_id',$v['mer_id'])->value('mer_name');
2658 2658
                 $v['title']='佣金提现';
2659 2659
             }else if($v['withdrawal_type']==3){
2660 2660
                 if($v['extract_type']==1){
@@ -2690,7 +2690,7 @@ class UserRepository extends BaseRepository
2690 2690
         foreach ($data as $k=>&$v){
2691 2691
 
2692 2692
             if($v['withdrawal_type']==2){
2693
-//                $name=Db::name('merchant')->where('mer_id',$v['mer_id'])->value('mer_name');
2693
+                //                $name=Db::name('merchant')->where('mer_id',$v['mer_id'])->value('mer_name');
2694 2694
                 $v['title']='佣金提现';
2695 2695
             }else if($v['withdrawal_type']==3){
2696 2696
                 if($v['extract_type']==1){
@@ -2977,7 +2977,7 @@ class UserRepository extends BaseRepository
2977 2977
             $data['wechat_user_id'] = $third_user_id;
2978 2978
         }elseif($type ==2){
2979 2979
             if(isset($user->ali_user_id) && $user->ali_user_id){return true;}
2980
-//            if($user->ali_user_id){return true;}
2980
+            //            if($user->ali_user_id){return true;}
2981 2981
             $data['ali_user_id'] = $third_user_id;
2982 2982
         }
2983 2983
         if(!$user){
@@ -3162,26 +3162,26 @@ class UserRepository extends BaseRepository
3162 3162
         }
3163 3163
 
3164 3164
         return false;
3165
-//            $phone_data=Db::name('system_role')->whereIn('role_id',$roles_str)->where("phone !=''")->group("phone")->column('phone');
3166
-//            if($phone_data){
3167
-//                $uid_data = Db::name('user')->whereIn('phone', $phone_data)->column('uid');
3168
-//                if($uid_data){
3169
-//                    $uids=$this->level_list($uid_data,0);
3170
-//                }
3171
-//            }
3172
-//        }
3173
-//        return isset($uids)?$uids:[];
3174
-    }
3175
-//    function level_list($uid_data,$i){
3176
-//        $i++;
3177
-//        $uid = Db::name('user')->whereIn('level_id', $uid_data)->column('uid');
3178
-//        if($uid && $i<9){
3179
-//            $uid_data=array_merge($uid_data,$uid);
3180
-//            return $this->level_list($uid_data,$i);
3181
-//        }else{
3182
-//            return $uid_data;
3183
-//        }
3184
-//    }
3165
+        //            $phone_data=Db::name('system_role')->whereIn('role_id',$roles_str)->where("phone !=''")->group("phone")->column('phone');
3166
+        //            if($phone_data){
3167
+        //                $uid_data = Db::name('user')->whereIn('phone', $phone_data)->column('uid');
3168
+        //                if($uid_data){
3169
+        //                    $uids=$this->level_list($uid_data,0);
3170
+        //                }
3171
+        //            }
3172
+        //        }
3173
+        //        return isset($uids)?$uids:[];
3174
+    }
3175
+    //    function level_list($uid_data,$i){
3176
+    //        $i++;
3177
+    //        $uid = Db::name('user')->whereIn('level_id', $uid_data)->column('uid');
3178
+    //        if($uid && $i<9){
3179
+    //            $uid_data=array_merge($uid_data,$uid);
3180
+    //            return $this->level_list($uid_data,$i);
3181
+    //        }else{
3182
+    //            return $uid_data;
3183
+    //        }
3184
+    //    }
3185 3185
 
3186 3186
     public function sign_yhc_add($uid,$mer_id,$score,$mark,$order_id=0,$pm=1,$use_uid=0){
3187 3187
         $ins_data['uid'] = $uid;
@@ -3676,7 +3676,7 @@ class UserRepository extends BaseRepository
3676 3676
                 foreach ($contributeInfoList as $value) {
3677 3677
                     // 跳过时间范围外的 贡献值
3678 3678
                     if (!empty($startTime) && strtotime($value['settlementTime']) < strtotime($startTime)) {
3679
-                        break;
3679
+                        continue;
3680 3680
                     }
3681 3681
                     if (!empty($endTime) && strtotime($value['settlementTime']) > strtotime($endTime)) {
3682 3682
                         break;
@@ -3721,20 +3721,21 @@ class UserRepository extends BaseRepository
3721 3721
             foreach ($uidContributeList as $uidContribute) {
3722 3722
                 $goOnDepth = $depth;
3723 3723
                 // 获取用户规定时间内 所产生的贡献值 第一级
3724
-                $userContributionSumMap[$uidContribute['uid']][0] = $subordinatesOfCurrentLevelUidList[$uidContribute['uid']] ?? 0;
3724
+                $userContributionSumMap[$uidContribute['uid']]['0'] = $subordinatesOfCurrentLevelUidList[$uidContribute['uid']] ?? 0;
3725 3725
                 if ($depth == 1) {
3726
-                    break;
3726
+                    continue;
3727 3727
                 } else if ($depth > 1){
3728 3728
                     $goOnDepth = $depth - 1;
3729 3729
                 }
3730 3730
                 // 获取每个下级(部门)的个人贡献值 $goOnDepth = 0 时表示无限递归
3731
-                $userContributionSumMap[$uidContribute['uid']] = $this->getContributionSumByLevel(
3731
+                $contributionSumByLevel = $this->getContributionSumByLevel(
3732 3732
                     [$uidContribute['uid']],
3733 3733
                     $goOnDepth,
3734 3734
                     0,
3735 3735
                     $startTime,
3736 3736
                     $endTime
3737 3737
                 );
3738
+                $userContributionSumMap[$uidContribute['uid']] = array_merge($userContributionSumMap[$uidContribute['uid']], $contributionSumByLevel);
3738 3739
 
3739 3740
                 if (!empty($userContributionSumMap[$uidContribute['uid']])) {
3740 3741
                     ksort($userContributionSumMap[$uidContribute['uid']]);