diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 10497e702..13c824f22 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1769,6 +1769,8 @@ class QueryController extends BaseController $map['promote_id'] = $queryPromote['id']; } + $roleIds = M('user_play_data_count', 'tab_')->group('role_id')->getField('role_id', true); + $map['role_id'] = ['in', $roleIds]; $subMap['create_time'] = ['between', [$begTime, $endTime - 1]]; if ($costBegin != '' || $costEnd != '') { $having = ''; @@ -1784,7 +1786,7 @@ class QueryController extends BaseController ->group('game_id,server_id,role_id') ->having($having) ->buildSql(); - $map['_string'] = 'role_id in (' . $subQuery . ')'; + $map['_string'] = 'role_id in(' . $subQuery . ')'; } $orderBy = 'play_time desc'; @@ -1810,19 +1812,19 @@ class QueryController extends BaseController } } - $spendMap['uc.create_time'] = ['between', [$begTime, $endTime - 1]]; - $spendMap['_string'] = 'uc.game_id = tab_user_play_info.game_id and uc.server_id = tab_user_play_info.server_id and uc.role_id = tab_user_play_info.role_id'; + $spendMap['uc . create_time'] = ['between', [$begTime, $endTime - 1]]; + $spendMap['_string'] = 'uc . game_id = tab_user_play_info . game_id and uc . server_id = tab_user_play_info . server_id and uc . role_id = tab_user_play_info . role_id'; $sqlCost = M('user_play_data_count', 'tab_')->alias('uc') - ->field('sum(uc.recharge_cost) cost') + ->field('sum(uc . recharge_cost) cost') ->where($spendMap) ->buildSql(); $sqlCount = M('user_play_data_count', 'tab_')->alias('uc') - ->field('sum(uc.recharge_count) count') + ->field('sum(uc . recharge_count) count') ->where($spendMap) ->buildSql(); - $spendMap['uc.create_time'] = ['between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]]; + $spendMap['uc . create_time'] = ['between', [strtotime(date('Y - m - d 00:00:00')), strtotime(date('Y - m - d 23:59:59'))]]; $sqlTodayCost = M('user_play_data_count', 'tab_')->alias('uc') - ->field('sum(uc.recharge_count) count') + ->field('sum(uc . recharge_count) count') ->where($spendMap) ->buildSql(); $subQuery = M('user_play_info', 'tab_') @@ -1830,7 +1832,7 @@ class QueryController extends BaseController ->where($map) ->order('play_time desc') ->buildSql(); - $query = M()->field('*') + $query = M()->field(' * ') ->table($subQuery) ->alias('a') ->order($orderBy); @@ -1854,7 +1856,7 @@ class QueryController extends BaseController 'promote_id' => $role['promote_id'], 'promote_account' => $role['promote_account'], 'sdk_version' => $role['sdk_version'], - 'unlogin_day' => intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $role['play_time']))) / (24 * 3600)) + 'unlogin_day' => intval((strtotime(date('Y - m - d 00:00:00')) - strtotime(date('Y - m - d 00:00:00', $role['play_time']))) / (24 * 3600)) ]; } } @@ -1952,11 +1954,11 @@ class QueryController extends BaseController public function achievement() { - $time = I('time', date('Y-m-d')); + $time = I('time', date('Y - m - d')); if (!empty($time)) { $defaultTime = $time; } else { - $defaultTime = date('Y-m-d', time()); + $defaultTime = date('Y - m - d', time()); } $sdkVersion = I('sdk_version', 0); $gameId = I('game_id', 0); @@ -2001,14 +2003,14 @@ class QueryController extends BaseController if (count($ids) > 0) { $rows = M('promote', 'tab_') ->field(['id', 'chain']) - ->where(['chain' => ['like', [$parent['chain'] . $parent['id'] . '/%']], 'level' => ['gt', $parent['level'] + 1]]) + ->where(['chain' => ['like', [$parent['chain'] . $parent['id'] . ' /%']], 'level' => ['gt', $parent['level'] + 1]]) ->select(); } $basicPromotes = []; foreach ($ids as $id) { foreach ($rows as $row) { - $needChain = $parent['chain'] . $parent['id'] . '/' . $id . '/'; + $needChain = $parent['chain'] . $parent['id'] . ' / ' . $id . ' / '; if (strpos($row['chain'], $needChain) !== false) { $basicPromotes[$row['id']] = $id; } @@ -2122,7 +2124,7 @@ class QueryController extends BaseController public function getChildPromoteList() { - $promoteId = intval(I('post.promote_id', 0)); + $promoteId = intval(I('post . promote_id', 0)); $promoteId = empty($promoteId) ? PID : $promoteId; $promoteList = getAllPromoteListByType(3, false, $promoteId); $data['status'] = 1; @@ -2133,13 +2135,13 @@ class QueryController extends BaseController public function userPlayDataCount() { - $time = strtotime(date('Y-m-d 00:00:00', time() - (3600 * 24))); + $time = strtotime(date('Y - m - d 00:00:00', time() - (3600 * 24))); $spendMap['pay_status'] = 1; $spendMap['pay_game_status'] = 1; $spendMap['game_player_id'] = ['gt', 0]; - $spendMap['pay_time'] = ['between', [$time, strtotime(date('Y-m-d 23:59:59', $time))]]; + $spendMap['pay_time'] = ['between', [$time, strtotime(date('Y - m - d 23:59:59', $time))]]; - $field = 'FROM_UNIXTIME(pay_time,"%Y-%m-%d") as day,game_id,server_id,game_player_id,sum(pay_amount) as recharge_cost,count(id) as recharge_count'; + $field = 'FROM_UNIXTIME(pay_time, "%Y-%m-%d") as day,game_id,server_id,game_player_id,sum(pay_amount) as recharge_cost,count(id) as recharge_count'; $spendCostData = M('spend', 'tab_')->field($field) ->where($spendMap) ->group('day,game_player_id,server_id,game_id')