|
|
|
@ -454,19 +454,67 @@ class PlatformController extends ThinkController
|
|
|
|
|
$data = M('promote', 'tab_')->alias('tp1')
|
|
|
|
|
->field('tp1.account as promote_account,tp1.id,
|
|
|
|
|
date_format(FROM_UNIXTIME(register_time),"% ") AS time,
|
|
|
|
|
count(u.id) as count,
|
|
|
|
|
count(u.id) as count')
|
|
|
|
|
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
|
|
|
|
|
->join("tab_user as u on tp2.id = u.promote_id", 'left')
|
|
|
|
|
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('tp1.id')
|
|
|
|
|
->order('count desc, register_time')
|
|
|
|
|
->select();
|
|
|
|
|
//今日/本周/本月不变
|
|
|
|
|
$tmap = $map;
|
|
|
|
|
if(isset($tmap['register_time'])){
|
|
|
|
|
//获取最大最小
|
|
|
|
|
$tweek = total(2,false);
|
|
|
|
|
$tmonth = total(3,false);
|
|
|
|
|
//获取最小
|
|
|
|
|
$tmin = 0;
|
|
|
|
|
if($tweek[1][0] < $tmonth[1][0]){
|
|
|
|
|
$tmin = $tweek[1][0];
|
|
|
|
|
}else{
|
|
|
|
|
$tmin = $tmonth[1][0];
|
|
|
|
|
}
|
|
|
|
|
$tmap['register_time'] = ['between', array($tmin,$tmonth[1][1])];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$tdata = M('promote', 'tab_')->alias('tp1')
|
|
|
|
|
->field('tp1.account as promote_account,tp1.id,
|
|
|
|
|
date_format(FROM_UNIXTIME(register_time),"% ") AS time,
|
|
|
|
|
count(IF(register_time ' . $today . ',1,null)) as today,
|
|
|
|
|
count(IF(register_time ' . $week . ',1,null)) as week,
|
|
|
|
|
count(IF(register_time ' . $mounth . ',1,null)) as mounth')
|
|
|
|
|
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
|
|
|
|
|
->join("tab_user as u on tp2.id = u.promote_id", 'left')
|
|
|
|
|
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
|
|
|
|
|
->where($map)
|
|
|
|
|
->where($tmap)
|
|
|
|
|
->group('tp1.id')
|
|
|
|
|
->order('count desc, register_time')
|
|
|
|
|
->order('register_time')
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
$tmdata = [];
|
|
|
|
|
foreach($data as $k=>$v){
|
|
|
|
|
$v['today'] = 0;
|
|
|
|
|
$v['week'] = 0;
|
|
|
|
|
$v['mounth'] = 0;
|
|
|
|
|
$tmdata[$v['id']] = $v;
|
|
|
|
|
}
|
|
|
|
|
foreach ($tdata as $k => $v) {
|
|
|
|
|
|
|
|
|
|
$tmdata[$v['id']]['today'] = $v['today'];
|
|
|
|
|
$tmdata[$v['id']]['week'] = $v['week'];
|
|
|
|
|
$tmdata[$v['id']]['mounth'] = $v['mounth'];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
$data = [];
|
|
|
|
|
foreach($tmdata as $k => $v){
|
|
|
|
|
$data[] = $v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unset($map['tp1.id']);
|
|
|
|
|
unset($map['tp1.chain']);
|
|
|
|
|
unset($tmap['tp1.chain']);
|
|
|
|
|
unset($tmap['tp1.chain']);
|
|
|
|
|
$map['promote_id'] = 0;
|
|
|
|
|
$authorityData['count'] = 0;
|
|
|
|
|
|
|
|
|
@ -475,13 +523,19 @@ class PlatformController extends ThinkController
|
|
|
|
|
if ($user_auth_promote_ids == 'all' || in_array('0', explode(",", $user_auth_promote_ids))) {
|
|
|
|
|
//官方渠道数据添加
|
|
|
|
|
$authorityData = M('user', 'tab_')->alias('u')
|
|
|
|
|
->field('date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time,
|
|
|
|
|
count(id) as count,
|
|
|
|
|
count(IF(register_time ' . $today . ',1,null)) as today,
|
|
|
|
|
count(IF(register_time ' . $week . ',1,null)) as week,
|
|
|
|
|
count(IF(register_time ' . $mounth . ',1,null)) as mounth')
|
|
|
|
|
->field('date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time,count(id) as count')
|
|
|
|
|
->where($map)
|
|
|
|
|
->find();
|
|
|
|
|
$tauthorityData = M('user', 'tab_')->alias('u')
|
|
|
|
|
->field('date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time,
|
|
|
|
|
count(IF(register_time ' . $today . ',1,null)) as today,
|
|
|
|
|
count(IF(register_time ' . $week . ',1,null)) as week,
|
|
|
|
|
count(IF(register_time ' . $mounth . ',1,null)) as mounth')
|
|
|
|
|
->where($tmap)
|
|
|
|
|
->find();
|
|
|
|
|
$authorityData['today'] = $tauthorityData['today'];
|
|
|
|
|
$authorityData['week'] = $tauthorityData['week'];
|
|
|
|
|
$authorityData['mounth'] = $tauthorityData['mounth'];
|
|
|
|
|
}
|
|
|
|
|
$authorityData['promote_account'] = "官方渠道";
|
|
|
|
|
$authorityData['id'] = "1";
|
|
|
|
|