diff --git a/Application/Admin/Controller/AjaxController.class.php b/Application/Admin/Controller/AjaxController.class.php index 44cb0b5c3..4604dce71 100644 --- a/Application/Admin/Controller/AjaxController.class.php +++ b/Application/Admin/Controller/AjaxController.class.php @@ -82,6 +82,8 @@ class AjaxController extends ThinkController{ } if ($sdk_version) { $map['server_version'] = $game_map['sdk_version'] = $sdk_version; + }else { + $this->AjaxReturn([]); } $game = M("Game", 'tab_')->where($game_map)->getField('id', true); diff --git a/Application/Admin/Controller/BehaviorLogController.class.php b/Application/Admin/Controller/BehaviorLogController.class.php index fbc566287..3a754e5a0 100644 --- a/Application/Admin/Controller/BehaviorLogController.class.php +++ b/Application/Admin/Controller/BehaviorLogController.class.php @@ -11,23 +11,25 @@ class BehaviorLogController extends ThinkController $map = []; if (isset($params['user_account'])) { - $map['user_account'] = $params['user_account']; + $map['tab_pay_info.user_account'] = $params['user_account']; } if (isset($params['extend'])) { - $map['extend'] = $params['extend']; + $map['tab_pay_info.extend'] = $params['extend']; } if (isset($params['game_name'])) { - $game_id = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')]; - $map['game_id'] = $game_id; + $game_id = ['in', array_column(getGameByName($params['game_name'], $params['sdk_version']), 'id')]; + $map['tab_pay_info.game_id'] = $game_id; } if (isset($params['server_name'])) { - $map['server_name'] = $params['server_name']; + $game_id = M('game', 'tab_')->where(['relation_game_name' => $params['game_name'],'sdk_version' => $params['sdk_version']])->getField('id'); + $server_id = M('server', 'tab_')->where(['server_name' => $params['server_name'], 'game_id' => $game_id])->getField('server_num'); + $map['tab_pay_info.server_id'] = $server_id; } - if (isset($params['user_nickname'])) { - $map['user_nickname'] = $params['user_nickname']; + if (isset($params['game_player_name'])) { + $map['tab_pay_info.game_player_name'] = $params['game_player_name']; } if (isset($params['game_player_id'])) { - $map['game_player_id'] = $params['game_player_id']; + $map['tab_pay_info.game_player_id'] = $params['game_player_id']; } @@ -38,7 +40,7 @@ class BehaviorLogController extends ThinkController $endDate = empty($params['timeend']) ? date('Y-m-d') : $params['timeend']; $startTime = strtotime($startDate); $endTime = strtotime($endDate) + 86399; - $map['create_time'] = array('BETWEEN', [$startTime, $endTime]); + $map['tab_pay_info.create_time'] = array('BETWEEN', [$startTime, $endTime]); if (isset($params['promote_id'])) { $promoteId = $params['promote_id']; if ($promoteId == 0) { @@ -50,14 +52,13 @@ class BehaviorLogController extends ThinkController $map['promote_id'] = ['in', $promoteIds]; } } - $data = M('pay_info', 'tab_')->where($map)->order('id DESC')->page($p, $row)->select(); - + $data = M('pay_info', 'tab_')->field('tab_pay_info.id,tab_pay_info.user_account,extend,tab_pay_info.create_time,tab_pay_info.game_name,tab_pay_info.server_name,tab_pay_info.promote_account,tab_pay_info.order_id,tab_pay_info.game_player_id,tab_pay_info.game_player_name,price,tab_server.server_name')->join('tab_server on tab_pay_info.server_id = tab_server.server_num AND tab_pay_info.game_id = tab_server.game_id')->where($map)->order('tab_pay_info.id DESC')->page($p, $row)->select(); foreach($data as $k => $v) { if(empty($v['extend'])) { $data[$k]['extend'] = $v['order_id']; } } - $count = M('pay_info', 'tab_')->where($map)->count(); + $count = M('pay_info', 'tab_')->join('tab_server on tab_pay_info.server_id = tab_server.server_num AND tab_pay_info.game_id = tab_server.game_id')->where($map)->count(); $page = set_pagination($count, $row); if ($page) { $this->assign('_page', $page); diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 2e6b1472d..332414b6b 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -1818,31 +1818,34 @@ class ExportController extends Controller $map = []; if (isset($params['user_account'])) { - $map['user_account'] = $params['user_account']; + $map['tab_pay_info.user_account'] = $params['user_account']; } if (isset($params['extend'])) { - $map['extend'] = $params['extend']; + $map['tab_pay_info.extend'] = $params['extend']; } if (isset($params['game_name'])) { - $game_id = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')]; - $map['game_id'] = $game_id; + $game_id = ['in', array_column(getGameByName($params['game_name'], $params['sdk_version']), 'id')]; + $map['tab_pay_info.game_id'] = $game_id; } if (isset($params['server_name'])) { - $map['server_name'] = $params['server_name']; + $game_id = M('game', 'tab_')->where(['relation_game_name' => $params['game_name'],'sdk_version' => $params['sdk_version']])->getField('id'); + $server_id = M('server', 'tab_')->where(['server_name' => $params['server_name'], 'game_id' => $game_id])->getField('server_num'); + $map['tab_pay_info.server_id'] = $server_id; } - if (isset($params['user_nickname'])) { - $map['user_nickname'] = $params['user_nickname']; + if (isset($params['game_player_name'])) { + $map['tab_pay_info.game_player_name'] = $params['game_player_name']; } if (isset($params['game_player_id'])) { - $map['game_player_id'] = $params['game_player_id']; + $map['tab_pay_info.game_player_id'] = $params['game_player_id']; } $startDate = empty($params['timestart']) ? date('Y-m-d', strtotime('-6 day', time())) : $params['timestart']; $endDate = empty($params['timeend']) ? date('Y-m-d') : $params['timeend']; $startTime = strtotime($startDate); $endTime = strtotime($endDate) + 86399; - $map['create_time'] = array('BETWEEN', [$startTime, $endTime]); - if ($promoteId = I('promote_id')) { + $map['tab_pay_info.create_time'] = array('BETWEEN', [$startTime, $endTime]); + if (isset($params['promote_id'])) { + $promoteId = $params['promote_id']; if ($promoteId == 0) { $map['promote_id'] = 0; } else { @@ -1852,10 +1855,14 @@ class ExportController extends Controller $map['promote_id'] = ['in', $promoteIds]; } } - $xlsData = M('pay_info', 'tab_')->where($map)->order('id DESC')->select(); - foreach($xlsData as $k => $v) { - $xlsData[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + $data = M('pay_info', 'tab_')->field('tab_pay_info.id,tab_pay_info.user_account,extend,tab_pay_info.create_time,tab_pay_info.game_name,tab_pay_info.server_name,tab_pay_info.promote_account,tab_pay_info.order_id,tab_pay_info.game_player_id,tab_pay_info.game_player_name,price,tab_server.server_name')->join('tab_server on tab_pay_info.server_id = tab_server.server_num AND tab_pay_info.game_id = tab_server.game_id')->where($map)->order('tab_pay_info.id DESC')->select(); + foreach($data as $k => $v) { + $data[$k]['create_time'] = date('Y-m-d H:i:s',$v['create_time']); + if(empty($v['extend'])) { + $data[$k]['extend'] = $v['order_id']; + } } + $xlsData = $data; break; default: diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 066e1fbbd..468fbd5f1 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -1203,6 +1203,7 @@ class DownloadController extends BaseController { $map['tab_pay_info.create_time'] = ['EGT',strtotime($begTime) + 24*3600]; } + $conditions = json_encode($map,TRUE); $addtime = time(); $data = [ diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 142ae8d38..9af3fa9a9 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1858,7 +1858,7 @@ class QueryController extends BaseController } $map['uc.create_time'] = ['between', [$begTime, $endTime - 1]]; - $fieldUC = "sum(uc.recharge_cost) recharge_cost,sum(uc.recharge_count) recharge_count,sum(if(uc.create_time = {$nowTime},uc.recharge_cost,0)) as recharge_cost_today"; + $fieldUC = "sum(uc.recharge_cost) recharge_cost,sum(uc.recharge_count) recharge_count,sum(if(uc.create_time = {$nowTime},uc.recharge_cost,0)) as recharge_cost_today,uc.user_id"; $fieldUI = "ui.user_account,ui.game_name,ui.role_name,ui.role_level,ui.server_name,ui.play_time,ui.play_ip,ui.promote_account,ui.sdk_version,ui.create_time"; $loginRecordMap['lr.create_time'] = $map['uc.create_time']; @@ -1877,14 +1877,25 @@ class QueryController extends BaseController $query = M()->alias('record') ->table($subQuery) ->order($orderBy); - $total = M('user_play_data_count', 'tab_')->alias('uc') + + list($records, $pagination, $count) = $this->paginate($query); + + $totalQuery = M('user_play_data_count', 'tab_')->alias('uc') ->field($fieldUC) + ->join('left join tab_user_play_info as ui on ui.user_id = uc.user_id and ui.game_id = uc.game_id and uc.server_id = ui.server_id and ui.role_id = uc.role_id') + ->group('uc.role_id,uc.game_id,uc.server_id,uc.user_id,uc.id') ->where($map) + ->buildSql(); + $total = M()->alias('totals') + ->table($totalQuery) + ->field('sum(recharge_cost) recharge_cost,sum(recharge_count) recharge_count,sum(recharge_cost_today) as recharge_cost_today') ->find(); - list($records, $pagination, $count) = $this->paginate($query); - foreach ($records as &$list) { + if (empty($list['user_account']) ) { + $list['user_account'] = M('user', 'tab_')->where("id = {$list['user_id']}")->getField('account'); + $list['user_account'] = empty($list['user_account']) ? '--' : encryption($list['user_account']); + } $list['user_account'] = empty($list['user_account']) ? '--' : encryption($list['user_account']); $list['game_name'] = empty($list['game_name']) ? '--' : $list['game_name']; $list['sdk_version'] = empty($list['sdk_version']) ? '--' : getSDKTypeName($list['sdk_version']);