|
|
@@ -6286,6 +6286,212 @@ class User extends BaseController
|
|
6286
|
6286
|
|
|
6287
|
6287
|
}
|
|
6288
|
6288
|
|
|
|
6289
|
+ /**
|
|
|
6290
|
+ * 一壶茶-团队列表
|
|
|
6291
|
+ */
|
|
|
6292
|
+ public function team_list_old()
|
|
|
6293
|
+ {
|
|
|
6294
|
+ $teamid = $this->request->uid();
|
|
|
6295
|
+
|
|
|
6296
|
+ //return app("json")->fail("未做任何修改");
|
|
|
6297
|
+ //$teamid = $this->request->param('teamid');//测试ID
|
|
|
6298
|
+ //$teamid = 17;
|
|
|
6299
|
+
|
|
|
6300
|
+ if($teamid == 592){
|
|
|
6301
|
+ $teamid = 17;//593
|
|
|
6302
|
+
|
|
|
6303
|
+// // $ss= $this->userupdates($teamid);
|
|
|
6304
|
+// // var_dump($ss);
|
|
|
6305
|
+
|
|
|
6306
|
+ //$team_userinfo_old_jbp22 = $this->getPerformance22(17);
|
|
|
6307
|
+//var_dump($team_userinfo_old_jbp22);
|
|
|
6308
|
+ $datas_jbp = Db::name('user')->where("status",1)->select();
|
|
|
6309
|
+
|
|
|
6310
|
+ //var_dump( $team_userinfo_old_jbp22['person_nums_pv']);
|
|
|
6311
|
+
|
|
|
6312
|
+ foreach($datas_jbp as $k=>$v){
|
|
|
6313
|
+ $team_userinfo_old_jbp22 = $this->getPerformance22($v['uid']);
|
|
|
6314
|
+ var_dump("id:" . $v['uid'] . " 用户:" . $v['nickname'] . " 小部门贡献值 :" . $team_userinfo_old_jbp22['person_nums_pv'] . " 大部门: " . $team_userinfo_old_jbp22['common_nums_pv']);
|
|
|
6315
|
+ }
|
|
|
6316
|
+
|
|
|
6317
|
+ return;
|
|
|
6318
|
+// $team_userinfo_old_jbp1 = $this->getPerformance($teamid);
|
|
|
6319
|
+
|
|
|
6320
|
+// //return;
|
|
|
6321
|
+// var_dump($team_userinfo_old_jbp1);return;
|
|
|
6322
|
+ }
|
|
|
6323
|
+
|
|
|
6324
|
+
|
|
|
6325
|
+ //根据用户找jbp1.0的节点人数组 end
|
|
|
6326
|
+
|
|
|
6327
|
+ $datas_jbp = Db::name('old_user_jbp')->where("id",$teamid)->find();//查询旧系统是否有当前会员
|
|
|
6328
|
+ $type = $this->request->param('type',0);//1:大部门,0:小部门,2:直推
|
|
|
6329
|
+ // 初始化最终返回的数据
|
|
|
6330
|
+ $data = [
|
|
|
6331
|
+ 'team_list' => [],
|
|
|
6332
|
+ 'fans_num' => 0, // 粉丝数
|
|
|
6333
|
+ 'new_performance' => 0, // 新增业绩
|
|
|
6334
|
+ 'total_performance' => 0, // 总业绩
|
|
|
6335
|
+ 'person_nums' => 0, // 个人联盟人数
|
|
|
6336
|
+ 'common_nums' => 0, // 公共联盟人数
|
|
|
6337
|
+ 'common_nums_pv' => 0, // 公共联盟PV
|
|
|
6338
|
+ 'person_nums_pv' => 0, // 个人联盟PV
|
|
|
6339
|
+ ];
|
|
|
6340
|
+
|
|
|
6341
|
+ // 如果在旧系统中有数据
|
|
|
6342
|
+
|
|
|
6343
|
+ $team_userinfo_old_jbp1 = $this->getPerformance($teamid);
|
|
|
6344
|
+ $tes = $this->teamPeople($teamid, $type); // 1:团队, 2:个人
|
|
|
6345
|
+
|
|
|
6346
|
+ $data1 = [
|
|
|
6347
|
+ "total" => 100,
|
|
|
6348
|
+ "per_page" => 10,
|
|
|
6349
|
+ "current_page" => 1,
|
|
|
6350
|
+ "last_page" => 1,
|
|
|
6351
|
+ "data" => []
|
|
|
6352
|
+ ];
|
|
|
6353
|
+
|
|
|
6354
|
+ if ($type != 2) {
|
|
|
6355
|
+ foreach ($tes as $k => $v) {
|
|
|
6356
|
+ $curr_pv = '';
|
|
|
6357
|
+ if ($v['curr_type'] == 0) {
|
|
|
6358
|
+ $curr_pv = $team_userinfo_old_jbp1['person_nums_pv'];
|
|
|
6359
|
+ } elseif ($v['curr_type'] == 1) {
|
|
|
6360
|
+ $curr_pv = $team_userinfo_old_jbp1['common_nums_pv'];
|
|
|
6361
|
+ } else {
|
|
|
6362
|
+ $curr_pv = 0;
|
|
|
6363
|
+ }
|
|
|
6364
|
+
|
|
|
6365
|
+ $data1['data'][$k] = [
|
|
|
6366
|
+ "uid" => $v["id"],
|
|
|
6367
|
+ "nickname" => $v['user_name'] . $curr_pv,
|
|
|
6368
|
+ "phone" => "137****3315",
|
|
|
6369
|
+ "avatar" => "https://cdn.bjtdba.com/vod/image/2025-01-20/20250120125206881.png",
|
|
|
6370
|
+ "create_time" => "2025-01-25 11:00:18",
|
|
|
6371
|
+ "identity" => "11",
|
|
|
6372
|
+ "level" => "40002",
|
|
|
6373
|
+ "partnership" => "22",
|
|
|
6374
|
+ "total_performance" => $curr_pv,
|
|
|
6375
|
+ "new_performance" => 0,
|
|
|
6376
|
+ "team_count" => $v["performance"]['common_nums'] + $v["performance"]['person_nums'] + 1,
|
|
|
6377
|
+ ];
|
|
|
6378
|
+ }
|
|
|
6379
|
+ } else {
|
|
|
6380
|
+ foreach ($tes as $k => $v) {
|
|
|
6381
|
+ $data1['data'][$k] = [
|
|
|
6382
|
+ "uid" => $v["uid"],
|
|
|
6383
|
+ "nickname" => $v['nickname'],
|
|
|
6384
|
+ "avatar" => $v['avatar'],
|
|
|
6385
|
+ "create_time" => "2025-01-25 11:00:18",
|
|
|
6386
|
+ ];
|
|
|
6387
|
+ }
|
|
|
6388
|
+ }
|
|
|
6389
|
+
|
|
|
6390
|
+ // 旧系统中的公共部分数据
|
|
|
6391
|
+ $data['team_list'] = $data1;
|
|
|
6392
|
+ $data['fans_num'] = $team_userinfo_old_jbp1['person_nums'] + $team_userinfo_old_jbp1['common_nums'];
|
|
|
6393
|
+ $data['new_performance'] = 0;
|
|
|
6394
|
+ $data['total_performance'] = $team_userinfo_old_jbp1['sum_nums_pv'];
|
|
|
6395
|
+ $data['person_nums'] = $team_userinfo_old_jbp1['common_nums'];
|
|
|
6396
|
+ $data['common_nums'] = $team_userinfo_old_jbp1['person_nums'];
|
|
|
6397
|
+ $data['common_nums_pv'] = max($team_userinfo_old_jbp1['common_nums_pv'], $team_userinfo_old_jbp1['person_nums_pv']);
|
|
|
6398
|
+ $data['person_nums_pv'] = min($team_userinfo_old_jbp1['common_nums_pv'], $team_userinfo_old_jbp1['person_nums_pv']);
|
|
|
6399
|
+
|
|
|
6400
|
+ return app("json")->success($data);
|
|
|
6401
|
+// // 查询当前会员旗下的会员数据(分页)
|
|
|
6402
|
+// [$page, $limit] = $this->getPage();
|
|
|
6403
|
+// $subordinate_members = Db::name('user')
|
|
|
6404
|
+// // ->alias('u')
|
|
|
6405
|
+// // ->join('store_order so', 'u.uid = so.uid', 'LEFT')
|
|
|
6406
|
+// ->where("spread_uid", $teamid)
|
|
|
6407
|
+// // ->where("so.mer_id", 496)
|
|
|
6408
|
+// // ->group('u.uid')
|
|
|
6409
|
+// ->page($page, $limit)
|
|
|
6410
|
+// ->select();
|
|
|
6411
|
+
|
|
|
6412
|
+// $total_members = Db::name('user')
|
|
|
6413
|
+// // ->alias('u')
|
|
|
6414
|
+// // ->join('store_order so', 'u.uid = so.uid', 'LEFT')
|
|
|
6415
|
+// ->where("spread_uid", $teamid)
|
|
|
6416
|
+// // ->where("so.mer_id", 496)
|
|
|
6417
|
+// // ->group('u.uid')
|
|
|
6418
|
+// ->count();
|
|
|
6419
|
+
|
|
|
6420
|
+// $data1 = [
|
|
|
6421
|
+// "total" => $total_members,
|
|
|
6422
|
+// "per_page" => $limit,
|
|
|
6423
|
+// "current_page" => $page,
|
|
|
6424
|
+// "last_page" => ceil($total_members / $limit),
|
|
|
6425
|
+// "data" => []
|
|
|
6426
|
+// ];
|
|
|
6427
|
+
|
|
|
6428
|
+// $total_amount_pv_team = 0;
|
|
|
6429
|
+// $team_count_total = 0;
|
|
|
6430
|
+
|
|
|
6431
|
+// foreach ($subordinate_members as $k => $v) {
|
|
|
6432
|
+// $t_teams_pv = $this->calculatePerformance($v['uid']);
|
|
|
6433
|
+// $total_amount_pv_team += $t_teams_pv['total_performance'];
|
|
|
6434
|
+// $team_count_total += $t_teams_pv['team_count'];
|
|
|
6435
|
+
|
|
|
6436
|
+// $data1['data'][$k] = [
|
|
|
6437
|
+// "uid" => $v["uid"],
|
|
|
6438
|
+// "nickname" => $v['nickname'],
|
|
|
6439
|
+// "phone" => substr_replace($v['phone'], '****', 3, 4),
|
|
|
6440
|
+// "avatar" => $v['avatar'],
|
|
|
6441
|
+// "create_time" => $v['create_time'],
|
|
|
6442
|
+// "total_performance" => $t_teams_pv['total_performance'],
|
|
|
6443
|
+// "new_performance" => $t_teams_pv['total_performance'],
|
|
|
6444
|
+// "team_count" => $t_teams_pv['team_count'],
|
|
|
6445
|
+// ];
|
|
|
6446
|
+// }
|
|
|
6447
|
+
|
|
|
6448
|
+// // 获取大小部门数据
|
|
|
6449
|
+// $get_big_small_datas = $this->getbig_samll_datas($subordinate_members);
|
|
|
6450
|
+
|
|
|
6451
|
+// // 判断大小部门的人数
|
|
|
6452
|
+// $big_team_count = $get_big_small_datas[0]['team_count'];
|
|
|
6453
|
+// $small_team_count = $get_big_small_datas[1]['team_count'];
|
|
|
6454
|
+
|
|
|
6455
|
+// // 根据 type 参数处理数据
|
|
|
6456
|
+// if ($type == 1) {
|
|
|
6457
|
+// usort($data1['data'], function ($a, $b) {
|
|
|
6458
|
+// return $b['total_performance'] <=> $a['total_performance'];
|
|
|
6459
|
+// });
|
|
|
6460
|
+// $data1['data'] = array_slice($data1['data'], 0, 1);
|
|
|
6461
|
+// } elseif ($type == 0) {
|
|
|
6462
|
+// usort($data1['data'], function ($a, $b) {
|
|
|
6463
|
+// return $b['total_performance'] <=> $a['total_performance'];
|
|
|
6464
|
+// });
|
|
|
6465
|
+// $data1['data'] = array_slice($data1['data'], 1);
|
|
|
6466
|
+// }
|
|
|
6467
|
+
|
|
|
6468
|
+// // 合并数据
|
|
|
6469
|
+// if (!empty($datas_jbp)) {
|
|
|
6470
|
+// // 如果旧系统中有数据,合并新旧数据
|
|
|
6471
|
+// $data['team_list']['data'] = array_merge($data['team_list']['data'], $data1['data']);
|
|
|
6472
|
+// $data['fans_num'] += $team_count_total;
|
|
|
6473
|
+// $data['new_performance'] += $total_amount_pv_team;
|
|
|
6474
|
+// $data['total_performance'] += $total_amount_pv_team;
|
|
|
6475
|
+// $data['person_nums'] += $big_team_count;
|
|
|
6476
|
+// $data['common_nums'] += $small_team_count;
|
|
|
6477
|
+// $data['common_nums_pv'] += $get_big_small_datas[0]['total_performance'];
|
|
|
6478
|
+// $data['person_nums_pv'] += $get_big_small_datas[1]['total_performance'];
|
|
|
6479
|
+// } else {
|
|
|
6480
|
+// // 如果旧系统中没有数据,直接使用新数据
|
|
|
6481
|
+// $data['team_list'] = $data1;
|
|
|
6482
|
+// $data['fans_num'] = $team_count_total;
|
|
|
6483
|
+// $data['new_performance'] = $total_amount_pv_team;
|
|
|
6484
|
+// $data['total_performance'] = $total_amount_pv_team;
|
|
|
6485
|
+// $data['person_nums'] = $big_team_count;
|
|
|
6486
|
+// $data['common_nums'] = $small_team_count;
|
|
|
6487
|
+// $data['common_nums_pv'] = $get_big_small_datas[0]['total_performance'];
|
|
|
6488
|
+// $data['person_nums_pv'] = $get_big_small_datas[1]['total_performance'];
|
|
|
6489
|
+// }
|
|
|
6490
|
+
|
|
|
6491
|
+// return app("json")->success($data);
|
|
|
6492
|
+
|
|
|
6493
|
+ }
|
|
|
6494
|
+
|
|
6289
|
6495
|
|
|
6290
|
6496
|
|
|
6291
|
6497
|
|