数据汇总 每日概况

master
chenxiaojun 5 years ago
parent c678968253
commit a5bd8c25c4

@ -927,7 +927,6 @@ class QueryController extends BaseController
$userPlayInfoModel = M('UserPlayInfo', 'tab_'); $userPlayInfoModel = M('UserPlayInfo', 'tab_');
$newWhere = '';
$begTime = strtotime($initBegTime); $begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime); $endTime = strtotime($initEndTime);
$spendWhere['tab_spend.pay_status'] = 1; $spendWhere['tab_spend.pay_status'] = 1;
@ -935,7 +934,6 @@ class QueryController extends BaseController
$userPlayInfoWhere['tab_user_play_info.server_id'] = I('server_id'); $userPlayInfoWhere['tab_user_play_info.server_id'] = I('server_id');
$userGameLoginWhere['tab_user_game_login_record.server_id'] = I('server_id'); $userGameLoginWhere['tab_user_game_login_record.server_id'] = I('server_id');
$spendWhere['tab_spend.server_id'] = I('server_id'); $spendWhere['tab_spend.server_id'] = I('server_id');
$newWhere = ' and ti.server_id = ' . I('server_id');
} }
$summaryData = []; $summaryData = [];
@ -958,6 +956,7 @@ class QueryController extends BaseController
$allData['spend_voucher'] = 0; $allData['spend_voucher'] = 0;
foreach ($data as &$list) { foreach ($data as &$list) {
$thisDateTime = strtotime($list['day']); $thisDateTime = strtotime($list['day']);
$userPlayInfoWhere2 = $userPlayInfoWhere;
$userPlayInfoWhere['tab_user_play_info.create_time'] = ['between', [$thisDateTime, $thisDateTime + 86399]]; $userPlayInfoWhere['tab_user_play_info.create_time'] = ['between', [$thisDateTime, $thisDateTime + 86399]];
$userGameLoginWhere['tab_user_game_login_record.login_time'] = ['between', [$thisDateTime, $thisDateTime + 86399]]; $userGameLoginWhere['tab_user_game_login_record.login_time'] = ['between', [$thisDateTime, $thisDateTime + 86399]];
$spendWhere['tab_spend.pay_time'] = ['between', [$thisDateTime, $thisDateTime + 86399]]; $spendWhere['tab_spend.pay_time'] = ['between', [$thisDateTime, $thisDateTime + 86399]];
@ -968,58 +967,47 @@ class QueryController extends BaseController
->where($map) ->where($map)
->order('play_time desc') ->order('play_time desc')
->count();//创角数 ->count();//创角数
$list['user_num'] = count($userPlayInfoModel $list['user_num'] = $userPlayInfoModel
->field('tab_user_play_info.id')
->join($join) ->join($join)
->where($userPlayInfoWhere) ->where($userPlayInfoWhere)
->where($map) ->where($map)
->group('tab_user_play_info.user_id') ->count('distinct tab_user_play_info.user_id');//创角用户
->select());//创角用户
$newUserSql = '(select count(ti.id) from tab_user_play_info as ti where ti.user_id = tab_user_play_info.user_id and ti.game_id = tab_user_play_info.game_id and ti.create_time < ' . $thisDateTime . $newWhere . ') as old_num'; $newUserNumData = $userPlayInfoModel
$list['new_user_num'] = count($userPlayInfoModel ->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.user_id) as num')
->field($newUserSql) ->where($userPlayInfoWhere2)
->join($join) ->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
->where($userPlayInfoWhere) ->order('tab_user_play_info.id')
->where($map) ->find();
->group('tab_user_play_info.user_id') $list['new_user_num'] = empty($newUserNumData['num']) ? 0 : $newUserNumData['num'];//新创角用户
->having('old_num = 0')
->select());//新创角用户
$newDeviceSql = '(select count(ti.id) from tab_user_play_info as ti where ti.create_device_number = tab_user_play_info.create_device_number and ti.game_id = tab_user_play_info.game_id and ti.create_time < ' . $thisDateTime . $newWhere . ') as old_num'; $newDeviceData = $userPlayInfoModel
$list['new_device_num'] = count($userPlayInfoModel ->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.create_device_number) as num')
->field($newDeviceSql) ->where($userPlayInfoWhere2)
->join($join) ->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
->where($userPlayInfoWhere) ->order('tab_user_play_info.id')
->where($map) ->find();
->group('tab_user_play_info.create_device_number') $list['new_device_num'] = empty($newDeviceData['num']) ? 0 : $newDeviceData['num'];//新创角设备
->having('old_num = 0')
->select());//新创角设备
$newIpSql = '(select count(ti.id) from tab_user_play_info as ti where ti.create_ip = tab_user_play_info.create_ip and ti.game_id = tab_user_play_info.game_id and ti.create_time < ' . $thisDateTime . $newWhere . ') as old_num'; $newIpNumData = $userPlayInfoModel
$list['new_ip_num'] = count($userPlayInfoModel ->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.create_ip) as num')
->field($newIpSql) ->where($userPlayInfoWhere2)
->join($join) ->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
->where($userPlayInfoWhere) ->order('tab_user_play_info.id')
->where($map) ->find();
->group('tab_user_play_info.create_ip') $list['new_ip_num'] = empty($newIpNumData['num']) ? 0 : $newIpNumData['num'];//新增创角IP
->having('old_num = 0')
->fetchSql(true) $list['login_user_num'] = M('UserGameLoginRecord', 'tab_')
->select());//新增创角IP
$list['login_user_num'] = count(M('UserGameLoginRecord', 'tab_')
->field('tab_user_game_login_record.id')
->join($join) ->join($join)
->where($userGameLoginWhere) ->where($userGameLoginWhere)
->where($map) ->where($map)
->group('user_id') ->count('distinct tab_user_game_login_record.user_id');//登录用户数
->select());//登录用户数 $list['spend_user_num'] = M('Spend', 'tab_')
$list['spend_user_num'] = count(M('Spend', 'tab_')
->field('tab_spend.id') ->field('tab_spend.id')
->join($join) ->join($join)
->where($spendWhere) ->where($spendWhere)
->where($map) ->where($map)
->group('tab_spend.user_id') ->count('distinct tab_spend.user_id');//充值人数
->select());//充值人数
$list['spend_num'] = M('Spend', 'tab_') $list['spend_num'] = M('Spend', 'tab_')
->join($join) ->join($join)
->where($spendWhere) ->where($spendWhere)
@ -1302,16 +1290,16 @@ class QueryController extends BaseController
$allData = []; $allData = [];
if (!empty($data)) { if (!empty($data)) {
foreach ($data as $key => $list) { foreach ($data as &$list) {
$userPlayInfoMap2['tab_user_play_info.game_id'] = $list['game_id']; $userPlayInfoMap2['tab_user_play_info.game_id'] = $list['game_id'];
$newUserNumData = $userPlayInfoModel $newUserNumData = $userPlayInfoModel
->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.id) as num') ->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.user_id) as num')
->where($userPlayInfoMap2) ->where($userPlayInfoMap2)
->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399)) ->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
->order('tab_user_play_info.id') ->order('tab_user_play_info.id')
->find(); ->find();
$data[$key]['new_user_num'] = empty($newUserNumData['num']) ? 0 : $newUserNumData['num'];//新创角用户 $list['new_user_num'] = empty($newUserNumData['num']) ? 0 : $newUserNumData['num'];//新创角用户
$newDeviceData = $userPlayInfoModel $newDeviceData = $userPlayInfoModel
->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.create_device_number) as num') ->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.create_device_number) as num')
@ -1319,15 +1307,15 @@ class QueryController extends BaseController
->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399)) ->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
->order('tab_user_play_info.id') ->order('tab_user_play_info.id')
->find(); ->find();
$data[$key]['new_device_num'] = empty($newDeviceData['num']) ? 0 : $newDeviceData['num'];//新创角设备 $list['new_device_num'] = empty($newDeviceData['num']) ? 0 : $newDeviceData['num'];//新创角设备
$newIpData = $userPlayInfoModel $newIpData = $userPlayInfoModel
->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.create_ip) as num') ->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.create_ip) as num')
->where($userPlayInfoMap2) ->where($userPlayInfoMap2)
->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399)) ->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
->order('tab_user_play_info.id') ->order('tab_user_play_info.id')
->select(); ->find();
$data[$key]['new_ip_num'] = empty($newIpData['num']) ? 0 : $newIpData['num'];//新增创角IP $list['new_ip_num'] = empty($newIpData['num']) ? 0 : $newIpData['num'];//新增创角IP
} }
$allData['spend_num'] = M('Spend', 'tab_') $allData['spend_num'] = M('Spend', 'tab_')
@ -1514,7 +1502,7 @@ class QueryController extends BaseController
$where['show_status'] = 1; $where['show_status'] = 1;
$serverData = M('Server', 'tab_') $serverData = M('Server', 'tab_')
->field('id,server_name') ->field('server_id,server_name')
->where($where) ->where($where)
->select(); ->select();
$result['status'] = 1; $result['status'] = 1;

@ -118,7 +118,7 @@
<select id="server_id" name="server_id" class=" reselect select_gallery"> <select id="server_id" name="server_id" class=" reselect select_gallery">
<option value="">请选择区服</option> <option value="">请选择区服</option>
<volist name="serverData" id="vo"> <volist name="serverData" id="vo">
<option value="{$vo.id}">{$vo.server_name}</option> <option value="{$vo.server_id}">{$vo.server_name}</option>
</volist> </volist>
</select> </select>
</div> </div>

@ -108,7 +108,7 @@
<select id="server_id" name="server_id" class=" reselect select_gallery"> <select id="server_id" name="server_id" class=" reselect select_gallery">
<option value="">请选择区服</option> <option value="">请选择区服</option>
<volist name="serverData" id="vo"> <volist name="serverData" id="vo">
<option value="{$vo.id}">{$vo.server_name}</option> <option value="{$vo.server_id}">{$vo.server_name}</option>
</volist> </volist>
</select> </select>
</div> </div>

Loading…
Cancel
Save