Merge branch 'dev' of 47.111.118.107:wmtx/platform into dev

master
chenxiaojun 5 years ago
commit 3faf5db4f7

@ -424,15 +424,16 @@ class PlatformController extends ThinkController
$map['register_time'] = ['elt', strtotime($_REQUEST['timeend']) + 86399];
unset($_REQUEST['timeend']);
}
$play_info_map = '';
//TODO:应需求取消玩家表只要user表的fgame有就算注册无需在play表存在
$play_map = false;
if (isset($_REQUEST['game_name'])) {
$map['fgame_name'] = $_REQUEST['game_name'];
$play_info_map .= " and upi.game_name = '{$_REQUEST['game_name']}' ";
unset($_REQUEST['game_name']);
// $play_map = " and up.game_name = '{$_REQUEST['game_name']}' ";
}
$play_info_map = false;
if (isset($_REQUEST['server_id'])) {
$play_info_map .= " and upi.server_id = '{$_REQUEST['server_id']}' ";
$play_map = false; //有区服就不检索玩家表,有区服一定已经选择游戏了
$play_info_map = " and upi.server_id = '{$_REQUEST['server_id']}' and upi.game_name = '{$_REQUEST['game_name']}'";
}
$today = total(1);
@ -455,11 +456,13 @@ class PlatformController extends ThinkController
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_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
->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();
// echo $data;die();
//今日/本周/本月不变
$tmap = $map;
if(isset($tmap['register_time'])){
@ -484,6 +487,7 @@ class PlatformController extends ThinkController
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_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
->where($tmap)
->group('tp1.id')
@ -529,6 +533,7 @@ class PlatformController extends ThinkController
//官方渠道数据添加
$authorityData = M('user', 'tab_')->alias('u')
->field('date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time,count(u.id) as count')
->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
->where($map)
->find();
@ -538,6 +543,7 @@ class PlatformController extends ThinkController
count(IF(register_time ' . $week . ',1,null)) as week,
count(IF(register_time ' . $mounth . ',1,null)) as mounth')
->where($tmap)
->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
->find();
$authorityData['today'] = $tauthorityData['today'];
@ -693,6 +699,44 @@ class PlatformController extends ThinkController
$data[] = $v;
}
// dd($data);
unset($map['tp1.id']);
unset($map['tp1.chain']);
unset($tmap['tp1.chain']);
unset($tmap['tp1.chain']);
$map['s.promote_id'] = 0;
$tmap['s.promote_id'] = 0;
$authorityData['count'] = 0;
//如果有官方渠道权限
$user_auth_promote_ids = session('user_auth_promote_ids');
if ($user_auth_promote_ids == 'all' || in_array('0', explode(",", $user_auth_promote_ids))) {
//官方渠道数据添加
$authorityData = M('spend', 'tab_')->alias('s')
->field('floor(sum(pay_amount)*100) as count')
->where($map)
->find();
$tauthorityData = M('spend', 'tab_')->alias('s')
->field('
floor(sum(IF(s.pay_time ' . $today . ',pay_amount,0))*100) as today,
floor(sum(IF(s.pay_time ' . $week . ',pay_amount,0))*100) as week,
floor(sum(IF(s.pay_time ' . $mounth . ',pay_amount,0))*100) as mounth')
->where($tmap)
->find();
$authorityData['today'] = $tauthorityData['today'];
$authorityData['week'] = $tauthorityData['week'];
$authorityData['mounth'] = $tauthorityData['mounth'];
}
$authorityData['promote_account'] = "官方渠道";
$authorityData['id'] = "1";
if (isset($_REQUEST['promote_id'])||$authorityData['count']==0) {
$authorityData = [];
} else {
array_push($data, $authorityData);
}
//数据排序
$last_names = array_column($data,'count');
array_multisort($last_names,SORT_DESC,$data);
$count = count($data);
foreach ($data as $key => $value) {

Loading…
Cancel
Save