|
|
|
@ -47,15 +47,15 @@ class QueryController extends BaseController
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$map1['chain'] = ['like','%'.PID.'/'.'%'];
|
|
|
|
|
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
|
|
|
|
|
$map1['chain'] = ['like', '%' . PID . '/' . '%'];
|
|
|
|
|
$rs = M('promote', 'tab_')->where($map1)->field('id,account,nickname')->select();
|
|
|
|
|
$childPromoteIds = '';
|
|
|
|
|
if(empty($rs)) {
|
|
|
|
|
if (empty($rs)) {
|
|
|
|
|
$map['tab_spend.promote_id'] = PID;
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
foreach ($rs as $rsKey => $rsValue) {
|
|
|
|
|
$id = $rsValue['id'];
|
|
|
|
|
$childPromoteIds .= $id.',';
|
|
|
|
|
$childPromoteIds .= $id . ',';
|
|
|
|
|
}
|
|
|
|
|
$childPromoteIds = rtrim($childPromoteIds, ',');
|
|
|
|
|
$childPromoteIds .= ',' . PID;
|
|
|
|
@ -70,18 +70,18 @@ class QueryController extends BaseController
|
|
|
|
|
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
|
|
|
|
|
];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map2)->getField('id', true);
|
|
|
|
|
if(empty($ids)) {
|
|
|
|
|
if (empty($ids)) {
|
|
|
|
|
$ids = array();
|
|
|
|
|
}
|
|
|
|
|
if(empty($levelPromote)) {
|
|
|
|
|
array_push($ids,PID);
|
|
|
|
|
if (empty($levelPromote)) {
|
|
|
|
|
array_push($ids, PID);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
array_push($ids,$queryPromote['id']);
|
|
|
|
|
array_push($ids, $queryPromote['id']);
|
|
|
|
|
if (!empty($ids)) {
|
|
|
|
|
$map['tab_spend.promote_id'] = ['in',$ids];
|
|
|
|
|
$map['tab_spend.promote_id'] = ['in', $ids];
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
$map['_string'] = '1<>1';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -209,15 +209,15 @@ class QueryController extends BaseController
|
|
|
|
|
// $map['tab_user.promote_id'] = ['in', $childPromoteIds];
|
|
|
|
|
// }
|
|
|
|
|
// $map['tab_user.promote_id'] = ['like','%'.PID.'/'.'%'];
|
|
|
|
|
$map1['chain'] = ['like','%'.PID.'/'.'%'];
|
|
|
|
|
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
|
|
|
|
|
$map1['chain'] = ['like', '%' . PID . '/' . '%'];
|
|
|
|
|
$rs = M('promote', 'tab_')->where($map1)->field('id,account,nickname')->select();
|
|
|
|
|
$childPromoteIds = '';
|
|
|
|
|
if(empty($rs)) {
|
|
|
|
|
if (empty($rs)) {
|
|
|
|
|
$map['tab_user.promote_id'] = PID;
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
foreach ($rs as $rsKey => $rsValue) {
|
|
|
|
|
$id = $rsValue['id'];
|
|
|
|
|
$childPromoteIds .= $id.',';
|
|
|
|
|
$childPromoteIds .= $id . ',';
|
|
|
|
|
}
|
|
|
|
|
$childPromoteIds = rtrim($childPromoteIds, ',');
|
|
|
|
|
$childPromoteIds .= ',' . PID;
|
|
|
|
@ -233,18 +233,18 @@ class QueryController extends BaseController
|
|
|
|
|
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
|
|
|
|
|
];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map2)->getField('id', true);
|
|
|
|
|
if(empty($ids)) {
|
|
|
|
|
if (empty($ids)) {
|
|
|
|
|
$ids = array();
|
|
|
|
|
}
|
|
|
|
|
if(empty($levelPromote)) {
|
|
|
|
|
array_push($ids,PID);
|
|
|
|
|
if (empty($levelPromote)) {
|
|
|
|
|
array_push($ids, PID);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
array_push($ids,$queryPromote['id']);
|
|
|
|
|
array_push($ids, $queryPromote['id']);
|
|
|
|
|
if (!empty($ids)) {
|
|
|
|
|
$map['tab_user.promote_id'] = ['in',$ids];
|
|
|
|
|
$map['tab_user.promote_id'] = ['in', $ids];
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
} else {
|
|
|
|
|
$map['_string'] = '1<>1';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1080,56 +1080,58 @@ class QueryController extends BaseController
|
|
|
|
|
|
|
|
|
|
$loginPromote = $this->getLoginPromote();
|
|
|
|
|
|
|
|
|
|
$map = [];
|
|
|
|
|
$ownId = intval(I('own_id'), 0);//本账号
|
|
|
|
|
if ($ownId) {
|
|
|
|
|
$userPlayInfoWhere['tab_user_play_info.promote_id'] = $queryPromote['id'];
|
|
|
|
|
$userPlayInfoWhere2['ti.promote_id'] = $queryPromote['id'];
|
|
|
|
|
$userGameLoginWhere['tab_user_game_login_record.promote_id'] = $queryPromote['id'];
|
|
|
|
|
$spendWhere['tab_spend.promote_id'] = $queryPromote['id'];
|
|
|
|
|
$params['promote_id'] = $queryPromote['id'];
|
|
|
|
|
} else {
|
|
|
|
|
$map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%'];
|
|
|
|
|
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
|
|
|
|
|
$ids[] = $queryPromote['id'];
|
|
|
|
|
$ids = implode(',', $ids);
|
|
|
|
|
|
|
|
|
|
$userPlayInfoWhere['tab_user_play_info.promote_id'] = ['in', $ids];
|
|
|
|
|
$userPlayInfoWhere2['ti.promote_id'] = ['in', $ids];
|
|
|
|
|
$userGameLoginWhere['tab_user_game_login_record.promote_id'] = ['in', $ids];
|
|
|
|
|
$spendWhere['tab_spend.promote_id'] = ['in', $ids];
|
|
|
|
|
$params['promote_id'] = $ids;
|
|
|
|
|
}
|
|
|
|
|
if ($relationGameId > 0 || $serverId > 0) {
|
|
|
|
|
if ($sdkVersion > 0) {
|
|
|
|
|
$map['sdk_version'] = $sdkVersion;
|
|
|
|
|
}
|
|
|
|
|
$map = [];
|
|
|
|
|
$map['_string'] = '1 = 1';
|
|
|
|
|
$join = '';
|
|
|
|
|
if ($relationGameId > 0) {
|
|
|
|
|
$map['tab_game.relation_game_id'] = I('relation_game_id');
|
|
|
|
|
$join = 'tab_game on game_id = tab_game.id';
|
|
|
|
|
$map = ['relation_game_id' => $relationGameId];
|
|
|
|
|
}
|
|
|
|
|
if ($sdkVersion > 0) {
|
|
|
|
|
$userPlayInfoWhere['tab_user_play_info.sdk_version'] = $sdkVersion;
|
|
|
|
|
$userPlayInfoWhere2['ti.sdk_version'] = $sdkVersion;
|
|
|
|
|
$userGameLoginWhere['tab_user_game_login_record.sdk_version'] = $sdkVersion;
|
|
|
|
|
$spendWhere['tab_spend.sdk_version'] = $sdkVersion;
|
|
|
|
|
$gameIds = M('Game', 'tab_')->where($map)->getField('id', true);
|
|
|
|
|
if (empty($gameIds)) {
|
|
|
|
|
$params['_string'] = '1=2';
|
|
|
|
|
} else {
|
|
|
|
|
$gameIds = implode(',', $gameIds);
|
|
|
|
|
$params['game_id'] = ['in', $gameIds];
|
|
|
|
|
}
|
|
|
|
|
$spendWhere['tab_spend.pay_status'] = 1;
|
|
|
|
|
if ($serverId > 0) {
|
|
|
|
|
$userPlayInfoWhere['tab_user_play_info.server_id'] = $serverId;
|
|
|
|
|
$userPlayInfoWhere2['ti.server_id'] = $serverId;
|
|
|
|
|
$userGameLoginWhere['tab_user_game_login_record.server_id'] = $serverId;
|
|
|
|
|
$spendWhere['tab_spend.server_id'] = $serverId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$userPlayInfoModel = M('UserPlayInfo', 'tab_');
|
|
|
|
|
$params['begin_time'] = $begTime;
|
|
|
|
|
$params['end_time'] = $endTime;
|
|
|
|
|
|
|
|
|
|
$summaryData = [];
|
|
|
|
|
$data = [];
|
|
|
|
|
$dataNum = ($endTime - $begTime) / 86400 + 1;
|
|
|
|
|
$dateTime = $endTime;
|
|
|
|
|
for ($index = 0; $index < $dataNum; $index++) {
|
|
|
|
|
$thisDateTime = date('Ymd', $dateTime);
|
|
|
|
|
$summaryData['date'][] = $thisDateTime;
|
|
|
|
|
$data[]['day'] = $thisDateTime;
|
|
|
|
|
$dateTime = strtotime('-1 day', $dateTime);
|
|
|
|
|
}
|
|
|
|
|
$dayList = $this->getDayList($begTime, $endTime);
|
|
|
|
|
$params['dayList'] = $dayList;
|
|
|
|
|
|
|
|
|
|
$records = [];
|
|
|
|
|
if (intval($endTime - $begTime) / (24 * 3600) <= 30) {
|
|
|
|
|
$userRepository = new UserRepository();
|
|
|
|
|
$spendRepository = new SpendRepository();
|
|
|
|
|
$roleNumList = $userRepository->getCreateRoleCountByDay($params);//创角数
|
|
|
|
|
$userNumList = $userRepository->getCreateRoleUserCountByDay($params);//创角用户
|
|
|
|
|
$newUserNumList = $userRepository->getNewCreateRoleUserCountByDay($params);//新创角用户
|
|
|
|
|
$newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByDay($params);//新创角设备
|
|
|
|
|
$newIpNumList = $userRepository->getNewCreateRoleIpCountByDay($params);//新创角IP
|
|
|
|
|
$loginUserNumList = $userRepository->getLoginCountGroupByDay($params);//登录用户数
|
|
|
|
|
$spendUserNumList = $spendRepository->getPayUserCountGroupByDay($params);//充值人数
|
|
|
|
|
$spendNumList = $spendRepository->getPayCountGroupByDay($params);//充值次数
|
|
|
|
|
$spendAllAmountList = $spendRepository->getPayAmountGroupByDayAndType($params);//充值总额
|
|
|
|
|
$params['pay_way'] = ['in', '1,2,3,4,5,6'];
|
|
|
|
|
$spendCashList = $spendRepository->getPayAmountGroupByDayAndType($params);//现金充值
|
|
|
|
|
$params['pay_way'] = 0;
|
|
|
|
|
$spendGenericList = $spendRepository->getPayAmountGroupByDayAndType($params);//通用币充值
|
|
|
|
|
$params['pay_way'] = -1;
|
|
|
|
|
$spendBindingList = $spendRepository->getPayAmountGroupByDayAndType($params);//绑定币充值
|
|
|
|
|
|
|
|
|
|
$allData['role_num'] = 0;
|
|
|
|
|
$allData['user_num'] = 0;
|
|
|
|
@ -1142,152 +1144,52 @@ class QueryController extends BaseController
|
|
|
|
|
$allData['spend_all_amount'] = 0;
|
|
|
|
|
$allData['spend_cash'] = 0;
|
|
|
|
|
$allData['spend_generic'] = 0;
|
|
|
|
|
$allData['pay_amount'] = 0;
|
|
|
|
|
$allData['spend_binding'] = 0;
|
|
|
|
|
$allData['spend_discount'] = 0;
|
|
|
|
|
$allData['spend_voucher'] = 0;
|
|
|
|
|
foreach ($data as &$list) {
|
|
|
|
|
$thisDateTime = strtotime($list['day']);
|
|
|
|
|
$userPlayInfoWhere['tab_user_play_info.create_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]];
|
|
|
|
|
|
|
|
|
|
$list['role_num'] = $userPlayInfoModel
|
|
|
|
|
->join($join)
|
|
|
|
|
->where($userPlayInfoWhere)
|
|
|
|
|
->where($map)
|
|
|
|
|
->order('play_time desc')
|
|
|
|
|
->count();//创角数
|
|
|
|
|
$list['user_num'] = count($userPlayInfoModel
|
|
|
|
|
->join($join)
|
|
|
|
|
->where($userPlayInfoWhere)
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('tab_user_play_info.game_id,tab_user_play_info.user_id')
|
|
|
|
|
->select());//创角用户
|
|
|
|
|
|
|
|
|
|
$newUserNumSql = $userPlayInfoModel
|
|
|
|
|
->table('tab_user_play_info as ti')
|
|
|
|
|
->where($userPlayInfoWhere2)
|
|
|
|
|
->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)
|
|
|
|
|
->fetchSql(true)
|
|
|
|
|
->count();
|
|
|
|
|
$newUserNumData = $userPlayInfoModel
|
|
|
|
|
->field('tab_user_play_info.create_time,(' . $newUserNumSql . ') as num')
|
|
|
|
|
->join($join)
|
|
|
|
|
->where($userPlayInfoWhere)
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('tab_user_play_info.user_id')
|
|
|
|
|
->having('num = 0')
|
|
|
|
|
->order('tab_user_play_info.id')
|
|
|
|
|
->select();
|
|
|
|
|
$list['new_user_num'] = count($newUserNumData);//新创角用户
|
|
|
|
|
|
|
|
|
|
$newDeviceSql = $userPlayInfoModel
|
|
|
|
|
->table('tab_user_play_info as ti')
|
|
|
|
|
->where($userPlayInfoWhere2)
|
|
|
|
|
->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)
|
|
|
|
|
->fetchSql(true)
|
|
|
|
|
->count();
|
|
|
|
|
$newDeviceData = $userPlayInfoModel
|
|
|
|
|
->field('tab_user_play_info.create_time,(' . $newDeviceSql . ') as num')
|
|
|
|
|
->join($join)
|
|
|
|
|
->where($userPlayInfoWhere)
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('tab_user_play_info.create_device_number')
|
|
|
|
|
->having('num = 0')
|
|
|
|
|
->order('tab_user_play_info.id')
|
|
|
|
|
->select();
|
|
|
|
|
$list['new_device_num'] = count($newDeviceData);//新创角设备
|
|
|
|
|
|
|
|
|
|
$newIpNumSql = $userPlayInfoModel
|
|
|
|
|
->table('tab_user_play_info as ti')
|
|
|
|
|
->where($userPlayInfoWhere2)
|
|
|
|
|
->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)
|
|
|
|
|
->fetchSql(true)
|
|
|
|
|
->count();
|
|
|
|
|
$newIpNumData = $userPlayInfoModel
|
|
|
|
|
->field('tab_user_play_info.create_time,(' . $newIpNumSql . ') as num')
|
|
|
|
|
->join($join)
|
|
|
|
|
->where($userPlayInfoWhere)
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('tab_user_play_info.create_ip')
|
|
|
|
|
->having('num = 0')
|
|
|
|
|
->order('tab_user_play_info.id')
|
|
|
|
|
->select();
|
|
|
|
|
$list['new_ip_num'] = count($newIpNumData);//新增创角IP
|
|
|
|
|
|
|
|
|
|
$list['login_user_num'] = count(M('UserGameLoginRecord', 'tab_')
|
|
|
|
|
->join($join)
|
|
|
|
|
->where($userGameLoginWhere)
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('tab_user_game_login_record.game_id,tab_user_game_login_record.user_id')
|
|
|
|
|
->select());//登录用户数
|
|
|
|
|
|
|
|
|
|
$list['spend_user_num'] = count(M('Spend', 'tab_')
|
|
|
|
|
->join($join)
|
|
|
|
|
->where($spendWhere)
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('tab_spend.game_id,tab_spend.user_id')
|
|
|
|
|
->select());//充值人数
|
|
|
|
|
$list['spend_num'] = M('Spend', 'tab_')
|
|
|
|
|
->join($join)
|
|
|
|
|
->where($spendWhere)
|
|
|
|
|
->where($map)
|
|
|
|
|
->count();//充值次数
|
|
|
|
|
$list['spend_all_amount'] = M('Spend', 'tab_')
|
|
|
|
|
->join($join)
|
|
|
|
|
->where($spendWhere)
|
|
|
|
|
->where($map)
|
|
|
|
|
->sum('tab_spend.pay_amount');//充值总额
|
|
|
|
|
$list['spend_all_amount'] = empty($list['spend_all_amount']) ? 0 : $list['spend_all_amount'];
|
|
|
|
|
|
|
|
|
|
$list['spend_cash'] = M('Spend', 'tab_')
|
|
|
|
|
->join($join)
|
|
|
|
|
->where($spendWhere)
|
|
|
|
|
->where($map)
|
|
|
|
|
->where(array('tab_spend.pay_way' => ['in', '1,2,3,4,5,6']))
|
|
|
|
|
->sum('tab_spend.pay_amount');//现金充值
|
|
|
|
|
$list['spend_cash'] = empty($list['spend_cash']) ? 0 : $list['spend_cash'];
|
|
|
|
|
|
|
|
|
|
$list['spend_generic'] = M('Spend', 'tab_')
|
|
|
|
|
->join($join)
|
|
|
|
|
->where($spendWhere)
|
|
|
|
|
->where($map)
|
|
|
|
|
->where(array('tab_spend.pay_way' => 0))
|
|
|
|
|
->sum('tab_spend.pay_amount');//通用币
|
|
|
|
|
$list['spend_generic'] = empty($list['spend_generic']) ? 0 : $list['spend_generic'];
|
|
|
|
|
|
|
|
|
|
$list['spend_binding'] = M('Spend', 'tab_')
|
|
|
|
|
->join($join)
|
|
|
|
|
->where($spendWhere)
|
|
|
|
|
->where($map)
|
|
|
|
|
->where(array('tab_spend.pay_way' => -1))
|
|
|
|
|
->sum('tab_spend.pay_amount');//绑定币
|
|
|
|
|
$list['spend_binding'] = empty($list['spend_binding']) ? 0 : $list['spend_binding'];
|
|
|
|
|
|
|
|
|
|
$list['spend_discount'] = 0;//折扣币
|
|
|
|
|
$list['spend_voucher'] = 0;//代金券
|
|
|
|
|
|
|
|
|
|
$allData['role_num'] += $list['role_num'];
|
|
|
|
|
$allData['user_num'] += $list['user_num'];
|
|
|
|
|
$allData['new_user_num'] += $list['new_user_num'];
|
|
|
|
|
$allData['new_device_num'] += $list['new_device_num'];
|
|
|
|
|
$allData['new_ip_num'] += $list['new_ip_num'];
|
|
|
|
|
$allData['login_user_num'] += $list['login_user_num'];
|
|
|
|
|
$allData['spend_user_num'] += $list['spend_user_num'];
|
|
|
|
|
$allData['spend_num'] += $list['spend_num'];
|
|
|
|
|
$allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $list['spend_all_amount'], 2);
|
|
|
|
|
$allData['spend_cash'] = bcadd($allData['spend_cash'], $list['spend_cash'], 2);
|
|
|
|
|
$allData['spend_generic'] = bcadd($allData['spend_generic'], $list['spend_generic'], 2);
|
|
|
|
|
$allData['spend_binding'] = bcadd($allData['spend_binding'], $list['spend_binding'], 2);
|
|
|
|
|
$allData['spend_discount'] = bcadd($allData['spend_discount'], $list['spend_discount'], 2);
|
|
|
|
|
$allData['spend_voucher'] = bcadd($allData['spend_voucher'], $list['spend_voucher'], 2);
|
|
|
|
|
foreach ($dayList as $day) {
|
|
|
|
|
$date = date('Ymd', strtotime($day));
|
|
|
|
|
$records[] = [
|
|
|
|
|
'day' => $date,
|
|
|
|
|
'role_num' => $roleNumList[$day],
|
|
|
|
|
'user_num' => $userNumList[$day],
|
|
|
|
|
'new_user_num' => $newUserNumList[$day],
|
|
|
|
|
'new_device_num' => $newDeviceNumList[$day],
|
|
|
|
|
'new_ip_num' => $newIpNumList[$day],
|
|
|
|
|
'login_user_num' => $loginUserNumList[$day],
|
|
|
|
|
'spend_user_num' => $spendUserNumList[$day],
|
|
|
|
|
'spend_num' => $spendNumList[$day],
|
|
|
|
|
'spend_all_amount' => $spendAllAmountList[$day],
|
|
|
|
|
'spend_cash' => $spendCashList[$day],
|
|
|
|
|
'spend_generic' => $spendGenericList[$day],
|
|
|
|
|
'spend_binding' => $spendBindingList[$day],
|
|
|
|
|
'spend_discount' => 0,
|
|
|
|
|
'spend_voucher' => 0,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$summaryData['role_num'][] = $list['role_num'];
|
|
|
|
|
$summaryData['user_num'][] = $list['user_num'];
|
|
|
|
|
$summaryData['new_user_num'][] = $list['new_user_num'];
|
|
|
|
|
$summaryData['new_device_num'][] = $list['new_device_num'];
|
|
|
|
|
$summaryData['spend_user_num'][] = $list['spend_user_num'];
|
|
|
|
|
$summaryData['spend_all_amount'][] = $list['spend_all_amount'];
|
|
|
|
|
$allData['role_num'] += $roleNumList[$day];
|
|
|
|
|
$allData['user_num'] += $userNumList[$day];
|
|
|
|
|
$allData['new_user_num'] += $newUserNumList[$day];
|
|
|
|
|
$allData['new_device_num'] += $newDeviceNumList[$day];
|
|
|
|
|
$allData['new_ip_num'] += $newIpNumList[$day];
|
|
|
|
|
$allData['login_user_num'] += $loginUserNumList[$day];
|
|
|
|
|
$allData['spend_user_num'] += $spendUserNumList[$day];
|
|
|
|
|
$allData['spend_num'] += $spendNumList[$day];
|
|
|
|
|
$allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $spendAllAmountList[$day], 2);
|
|
|
|
|
$allData['spend_cash'] = bcadd($allData['spend_cash'], $spendCashList[$day], 2);
|
|
|
|
|
$allData['spend_generic'] = bcadd($allData['spend_generic'], $spendGenericList[$day], 2);
|
|
|
|
|
$allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$day], 2);
|
|
|
|
|
$allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2);
|
|
|
|
|
$allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2);
|
|
|
|
|
|
|
|
|
|
$summaryData['date'][] = $date;
|
|
|
|
|
$summaryData['role_num'][] = $roleNumList[$day];
|
|
|
|
|
$summaryData['user_num'][] = $userNumList[$day];
|
|
|
|
|
$summaryData['new_user_num'][] = $newUserNumList[$day];
|
|
|
|
|
$summaryData['new_device_num'][] = $newDeviceNumList[$day];
|
|
|
|
|
$summaryData['spend_user_num'][] = $spendUserNumList[$day];
|
|
|
|
|
$summaryData['spend_all_amount'][] = $spendAllAmountList[$day];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$summaryData['date'] = array_reverse($summaryData['date']);
|
|
|
|
@ -1303,7 +1205,7 @@ class QueryController extends BaseController
|
|
|
|
|
$this->assign('meta_title', '每日概况');
|
|
|
|
|
$this->assign('loginPromote', $loginPromote);
|
|
|
|
|
$this->assign('ownId', $ownId);
|
|
|
|
|
$this->assign('listData', $data);
|
|
|
|
|
$this->assign('listData', $records);
|
|
|
|
|
$this->assign('allData', $allData);
|
|
|
|
|
$this->assign('summaryData', $summaryData);
|
|
|
|
|
$this->assign('setdate', date("Y-m-d"));
|
|
|
|
@ -1422,72 +1324,44 @@ class QueryController extends BaseController
|
|
|
|
|
$userGameLoginMap['tab_user_game_login_record.game_id'] = $list['game_id'];
|
|
|
|
|
$spendMap['tab_spend.game_id'] = $list['game_id'];
|
|
|
|
|
|
|
|
|
|
$list['role_num'] = $userPlayInfoModel
|
|
|
|
|
$thisData = $userPlayInfoModel
|
|
|
|
|
->field('count(*) as role_num,count(distinct tab_user_play_info.user_id) as user_num')
|
|
|
|
|
->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')
|
|
|
|
|
->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')
|
|
|
|
|
->select();
|
|
|
|
|
$list['new_user_num'] = count($newUserNumData);//新创角用户
|
|
|
|
|
|
|
|
|
|
$newDeviceData = $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')
|
|
|
|
|
->select();
|
|
|
|
|
$list['new_device_num'] = count($newDeviceData);//新创角设备
|
|
|
|
|
->find();
|
|
|
|
|
$list['role_num'] = $thisData['role_num'];//创角数
|
|
|
|
|
$list['user_num'] = $thisData['user_num'];//创角用户
|
|
|
|
|
|
|
|
|
|
$newIpData = $userPlayInfoModel
|
|
|
|
|
->field('tab_user_play_info.create_time')
|
|
|
|
|
$thisData = $userPlayInfoModel
|
|
|
|
|
->field('tab_user_play_info.create_time,count(distinct tab_user_play_info.user_id) as new_user_num,
|
|
|
|
|
count(distinct tab_user_play_info.create_device_number) as new_device_num,
|
|
|
|
|
count(distinct tab_user_play_info.create_ip) as new_ip_num')
|
|
|
|
|
->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')
|
|
|
|
|
->select();
|
|
|
|
|
$list['new_ip_num'] = count($newIpData);//新增创角IP
|
|
|
|
|
->find();
|
|
|
|
|
$list['new_user_num'] = empty($thisData['new_user_num']) ? 0 : $thisData['new_user_num'];//新创角用户
|
|
|
|
|
$list['new_device_num'] = empty($thisData['new_device_num']) ? 0 : $thisData['new_device_num'];//新创角设备
|
|
|
|
|
$list['new_ip_num'] = empty($thisData['new_ip_num']) ? 0 : $thisData['new_ip_num'];//新增创角IP
|
|
|
|
|
|
|
|
|
|
$list['login_user_num'] = count($userGameLoginModel
|
|
|
|
|
->where($userGameLoginMap)
|
|
|
|
|
->group('tab_user_game_login_record.game_id,tab_user_game_login_record.user_id')
|
|
|
|
|
->select());//登录用户数
|
|
|
|
|
|
|
|
|
|
$list['spend_user_num'] = $spendModel
|
|
|
|
|
->where($spendMap)
|
|
|
|
|
->count('distinct tab_spend.user_id');//充值人数
|
|
|
|
|
|
|
|
|
|
$list['spend_num'] = $spendModel
|
|
|
|
|
$thisData = $spendModel
|
|
|
|
|
->field('count(distinct tab_spend.user_id) as spend_user_num,count(*) as spend_num,
|
|
|
|
|
sum(tab_spend.pay_amount) as spend_all_amount,
|
|
|
|
|
sum(if(tab_spend.pay_way > 0,tab_spend.pay_amount,0)) as spend_cash,
|
|
|
|
|
sum(if(tab_spend.pay_way = 0,tab_spend.pay_amount,0)) as spend_generic,
|
|
|
|
|
sum(if(tab_spend.pay_way = -1,tab_spend.pay_amount,0)) as spend_binding')
|
|
|
|
|
->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');//绑定币
|
|
|
|
|
->find();
|
|
|
|
|
$list['spend_user_num'] = $thisData['spend_user_num'];//充值人数
|
|
|
|
|
$list['spend_num'] = $thisData['spend_num'];//充值次数
|
|
|
|
|
$list['spend_all_amount'] = $thisData['spend_all_amount'];//充值总额
|
|
|
|
|
$list['spend_cash'] = $thisData['spend_cash'];//现金充值
|
|
|
|
|
$list['spend_generic'] = $thisData['spend_generic'];//通用币
|
|
|
|
|
$list['spend_binding'] = $thisData['spend_binding'];//绑定币
|
|
|
|
|
|
|
|
|
|
$list['spend_discount'] = 0;//折扣币
|
|
|
|
|
$list['spend_voucher'] = 0;//代金券
|
|
|
|
|