Merge branch 'dev' of 47.111.118.107:/srv/git/platform into dev

master
ELF 5 years ago
commit 580a531bc4

@ -1015,7 +1015,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;
@ -1023,7 +1022,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 = [];
@ -1046,6 +1044,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]];
@ -1056,58 +1055,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)
@ -1276,116 +1264,29 @@ class QueryController extends BaseController
$begTime = strtotime($initBegTime); $begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime); $endTime = strtotime($initEndTime);
$userPlayInfoWhere['_string'] = 'tab_user_play_info.game_id = tab_apply.game_id';
$userPlayInfoMap['_complex'] = $userPlayInfoWhere;
$userPlayInfoMap2 = $userPlayInfoMap; $userPlayInfoMap2 = $userPlayInfoMap;
$userPlayInfoMap['tab_user_play_info.create_time'] = ['between', [$begTime, $endTime + 86399]]; $userPlayInfoMap['tab_user_play_info.create_time'] = ['between', [$begTime, $endTime + 86399]];
// $userPlayInfoWhere['_string'] = 'tab_user_play_info.game_id = tab_apply.game_id';
// $userPlayInfoMap['_complex'] = $userPlayInfoWhere;
$userGameLoginWhere['_string'] = 'tab_user_game_login_record.game_id = tab_apply.game_id'; // $userGameLoginWhere['_string'] = 'tab_user_game_login_record.game_id = tab_apply.game_id';
$userGameLoginMap['_complex'] = $userGameLoginWhere; // $userGameLoginMap['_complex'] = $userGameLoginWhere;
$userGameLoginMap['tab_user_game_login_record.login_time'] = ['between', [$begTime, $endTime + 86399]]; $userGameLoginMap['tab_user_game_login_record.login_time'] = ['between', [$begTime, $endTime + 86399]];
$spendMap['tab_spend.pay_time'] = ['between', [$begTime, $endTime + 86399]]; $spendMap['tab_spend.pay_time'] = ['between', [$begTime, $endTime + 86399]];
$spendMap2 = $spendMap; $spendMap2 = $spendMap;
$spendWhere['_string'] = 'tab_spend.game_id = tab_apply.game_id'; // $spendWhere['_string'] = 'tab_spend.game_id = tab_apply.game_id';
$spendMap['_complex'] = $spendWhere; // $spendMap['_complex'] = $spendWhere;
$userPlayInfoModel = M('UserPlayInfo', 'tab_'); $userPlayInfoModel = M('UserPlayInfo', 'tab_');
$userGameLoginModel = M('UserGameLoginRecord', 'tab_'); $userGameLoginModel = M('UserGameLoginRecord', 'tab_');
$spendModel = M('Spend', 'tab_'); $spendModel = M('Spend', 'tab_');
$roleNumSql = $userPlayInfoModel // var_dump($newUserNumSql);
->where($userPlayInfoMap)
->fetchSql(true)
->count();
$roleNumSql = ',(' . $roleNumSql . ') as role_num';//创角数
$userNumSql = $userPlayInfoModel
->where($userPlayInfoMap)
->fetchSql(true)
->count('distinct tab_user_play_info.user_id');
$userNumSql = ',(' . $userNumSql . ') as user_num';//创角用户
$newUserNumSql = $userPlayInfoModel
->field('tab_user_play_info.create_time')
->where($userPlayInfoMap2)
->group('tab_user_play_info.user_id')
->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
->order('tab_user_play_info.id')
->fetchSql(true)
->select();
$newUserNumSql = ',count((' . $newUserNumSql . ')) as new_user_num';//新创角用户
$newDeviceSql = $userPlayInfoModel
->field('tab_user_play_info.create_time')
->where($userPlayInfoMap2)
->group('tab_user_play_info.create_device_number')
->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
->order('tab_user_play_info.id')
->fetchSql(true)
->select();
$newDeviceSql = ',count((' . $newDeviceSql . ')) as new_device_num';//新创角设备
$newIpSql = $userPlayInfoModel
->field('tab_user_play_info.create_time')
->where($userPlayInfoMap2)
->group('tab_user_play_info.create_ip')
->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
->order('tab_user_play_info.id')
->fetchSql(true)
->select();
$newIpSql = ',count((' . $newIpSql . ')) as new_ip_num';//新增创角IP
$loginUserNumSql = $userGameLoginModel
->where($userGameLoginMap)
->fetchSql(true)
->count('distinct tab_user_game_login_record.user_id');
$loginUserNumSql = ',(' . $loginUserNumSql . ') as login_user_num';//登录用户数
$spendUserNumSql = $spendModel
->where($spendMap)
->fetchSql(true)
->count('distinct tab_spend.user_id');
$spendUserNumSql = ',(' . $spendUserNumSql . ') as spend_user_num';//充值人数
$spendNumSql = $spendModel
->where($spendMap)
->fetchSql(true)
->count();
$spendNumSql = ',(' . $spendNumSql . ') as spend_num';//充值次数
$spendAllAmountSql = $spendModel
->where($spendMap)
->fetchSql(true)
->sum('tab_spend.pay_amount');
$spendAllAmountSql = ',(' . $spendAllAmountSql . ') as spend_all_amount';//充值总额
$spendCashSql = $spendModel
->where($spendMap)
->where(array('tab_spend.pay_way' => ['in', '1,2,3,4,5,6']))
->fetchSql(true)
->sum('tab_spend.pay_amount');
$spendCashSql = ',(' . $spendCashSql . ') as spend_cash';//现金充值
$spendGenericSql = $spendModel
->where($spendMap)
->where(array('tab_spend.pay_way' => 0))
->fetchSql(true)
->sum('tab_spend.pay_amount');
$spendGenericSql = ',(' . $spendGenericSql . ') as spend_generic';//通用币
$spendBindingSql = $spendModel
->where($spendMap)
->where(array('tab_spend.pay_way' => -1))
->fetchSql(true)
->sum('tab_spend.pay_amount');
$spendBindingSql = ',(' . $spendBindingSql . ') as spend_binding';//绑定币
// var_dump($spendCashSql);
// die; // die;
$field = 'tab_apply.game_id,tab_game.game_name,tab_game.sdk_version'; $field = 'tab_apply.game_id,tab_game.game_name,tab_game.sdk_version';
$field .= $serverField . $roleNumSql . $userNumSql . $newUserNumSql . $newDeviceSql . $newIpSql . $loginUserNumSql . $spendUserNumSql . $spendNumSql . $spendAllAmountSql . $spendCashSql . $spendGenericSql . $spendBindingSql; $field .= $serverField;
$data = M('Apply', 'tab_') $data = M('Apply', 'tab_')
->field($field) ->field($field)
->join('tab_game on tab_apply.game_id = tab_game.id') ->join('tab_game on tab_apply.game_id = tab_game.id')
@ -1393,9 +1294,13 @@ class QueryController extends BaseController
->where($map) ->where($map)
->group('tab_apply.game_id') ->group('tab_apply.game_id')
->order('tab_game.sort desc,tab_game.id desc') ->order('tab_game.sort desc,tab_game.id desc')
// ->fetchSql(true)
->page($page, $row) ->page($page, $row)
->select(); ->select();
// var_dump($data);
// die;
$count = M('Apply', 'tab_') $count = M('Apply', 'tab_')
->join('tab_game on tab_apply.game_id = tab_game.id') ->join('tab_game on tab_apply.game_id = tab_game.id')
->join($serverJoin)//关联区服表 ->join($serverJoin)//关联区服表
@ -1416,6 +1321,76 @@ class QueryController extends BaseController
$allData = []; $allData = [];
if (!empty($data)) { if (!empty($data)) {
foreach ($data as &$list) {
$userPlayInfoMap['tab_user_play_info.game_id'] = $list['game_id'];
$userPlayInfoMap2['tab_user_play_info.game_id'] = $list['game_id'];
$userGameLoginMap['tab_user_game_login_record.game_id'] = $list['game_id'];
$spendMap['tab_spend.game_id'] = $list['game_id'];
$list['role_num'] = $userPlayInfoModel
->where($userPlayInfoMap)
->count();//创角数
$list['user_num'] = $userPlayInfoModel
->where($userPlayInfoMap)
->count('distinct tab_user_play_info.user_id');//创角用户
$newUserNumData = $userPlayInfoModel
->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.user_id) as num')
->where($userPlayInfoMap2)
->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
->order('tab_user_play_info.id')
->find();
$list['new_user_num'] = empty($newUserNumData['num']) ? 0 : $newUserNumData['num'];//新创角用户
$newDeviceData = $userPlayInfoModel
->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.create_device_number) as num')
->where($userPlayInfoMap2)
->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
->order('tab_user_play_info.id')
->find();
$list['new_device_num'] = empty($newDeviceData['num']) ? 0 : $newDeviceData['num'];//新创角设备
$newIpData = $userPlayInfoModel
->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.create_ip) as num')
->where($userPlayInfoMap2)
->having('tab_user_play_info.create_time between ' . $begTime . ' and ' . ($endTime + 86399))
->order('tab_user_play_info.id')
->find();
$list['new_ip_num'] = empty($newIpData['num']) ? 0 : $newIpData['num'];//新增创角IP
$list['login_user_num'] = $userGameLoginModel
->where($userGameLoginMap)
->count('distinct tab_user_game_login_record.user_id');//登录用户数
$list['spend_user_num'] = $spendModel
->where($spendMap)
->count('distinct tab_spend.user_id');//充值人数
$list['spend_num'] = $spendModel
->where($spendMap)
->count();//充值次数
$list['spend_all_amount'] = $spendModel
->where($spendMap)
->sum('tab_spend.pay_amount');//充值总额
$list['spend_cash'] = $spendModel
->where($spendMap)
->where(array('tab_spend.pay_way' => ['in', '1,2,3,4,5,6']))
->sum('tab_spend.pay_amount');//现金充值
$list['spend_generic'] = $spendModel
->where($spendMap)
->where(array('tab_spend.pay_way' => 0))
->sum('tab_spend.pay_amount');//通用币
$list['spend_binding'] = $spendModel
->where($spendMap)
->where(array('tab_spend.pay_way' => -1))
->sum('tab_spend.pay_amount');//绑定币
}
$allData['spend_num'] = M('Spend', 'tab_') $allData['spend_num'] = M('Spend', 'tab_')
->where($spendMap2) ->where($spendMap2)
->count();//充值次数 ->count();//充值次数
@ -1600,7 +1575,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