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

master
zhengyongxing 5 years ago
commit d6b50146ae

@ -105,7 +105,7 @@ class RechargeSumController extends ThinkController
} }
$count = count($data); $count = count($data);
$export_data = $data;
$page = set_pagination($count, $row); $page = set_pagination($count, $row);
if ($page) { if ($page) {
$this->assign('_page', $page); $this->assign('_page', $page);
@ -122,7 +122,7 @@ class RechargeSumController extends ThinkController
//判断是否执行导出 //判断是否执行导出
if (I('export') == 1) { if (I('export') == 1) {
$this->exportSum($data); $this->exportSum($export_data);
} }
$this->assign('meta_title', "充值汇总"); $this->assign('meta_title', "充值汇总");
$this->assign('list_data', $data); $this->assign('list_data', $data);

@ -1289,25 +1289,12 @@ class DownloadController extends BaseController {
$levelPromote = $this->getLevelPromote(); $levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote); $queryPromote = $this->getQueryPromote($levelPromote);
$map2[] = [ $map2['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%'];
'_logic' => 'or',
'id' => $queryPromote['id'],
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
];
$ids = M('promote', 'tab_')->where($map2)->getField('id', true); $ids = M('promote', 'tab_')->where($map2)->getField('id', true);
if(empty($ids)) { $ids[] = $queryPromote['id'];
$ids = array();
}
if(empty($levelPromote)) {
array_push($ids,PID);
}
// array_push($ids,$queryPromote['id']);
if (!empty($ids)) {
$map['promote_id'] = ['in',$ids];
}else { $map = ['promote_id' => ['in', $ids]];
$map['_string'] = '1<>1'; $subMap = ['promote_id' => ['in', $ids]];
}
if ($gameId != 0) { if ($gameId != 0) {
$gameMap['relation_game_id'] = $gameId; $gameMap['relation_game_id'] = $gameId;
@ -1315,7 +1302,9 @@ class DownloadController extends BaseController {
$gameMap['sdk_version'] = $sdkVersion; $gameMap['sdk_version'] = $sdkVersion;
} }
$gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true); $gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true);
$map['game_id'] = ['in', $gameId1]; $map['game_id'] = ['in', $gameId1];
$subMap['game_id'] = ['in', $gameId1];
} }
if ($serverId != 0) { if ($serverId != 0) {
$map['server_id'] = $serverId; $map['server_id'] = $serverId;
@ -2816,21 +2805,33 @@ class DownloadController extends BaseController {
$subMap = []; $subMap = [];
if(!empty($map['game_id'])) { if(!empty($map['game_id'])) {
$subMap['game_id'] = $map['game_id']; $subMap['game_id'] = $map['game_id'];
$map['uc.game_id'] = $map['game_id'];
unset($map['game_id']);
} }
if(!empty($map['server_id'])) { if(!empty($map['server_id'])) {
$subMap['server_id'] = $map['server_id']; $subMap['server_id'] = $map['server_id'];
$map['ui.server_id'] = $map['server_id'];
unset($map['server_id']);
}
if(!empty($map['role_name'])) {
$map['ui.role_name'] = $map['role_name'];
unset($map['role_name']);
}
if(!empty($map['user_account'])) {
$map['ui.user_account'] = $map['user_account'];
unset($map['user_account']);
}
if(!empty($map['promote_id'])) {
$map['uc.promote_id'] = $map['promote_id'];
unset($map['promote_id']);
} }
$costBegin = $map['costbegin']; $costBegin = $map['costbegin'];
$costEnd = $map['costend']; $costEnd = $map['costend'];
unset($map['costbegin']); unset($map['costbegin']);
unset($map['costend']); unset($map['costend']);
$nowTime = strtotime(date('Y-m-d 00:00:00', time()));
$subMap['create_time'] = ['between', [$map['begintime'], $map['endtime'] - 1]]; $subMap['create_time'] = ['between', [$map['begintime'], $map['endtime'] - 1]];
$roleIdMap = $subMap;
$roleIds = M('user_play_data_count', 'tab_')->where($roleIdMap)->group('role_id')->getField('role_id', true);
if (count($roleIds) > 0) {
$map['role_id'] = ['in', $roleIds];
}
if ($costBegin != '' || $costEnd != '') { if ($costBegin != '' || $costEnd != '') {
$having = ''; $having = '';
if ($costBegin != '' && $costEnd != '') { if ($costBegin != '' && $costEnd != '') {
@ -2845,39 +2846,23 @@ class DownloadController extends BaseController {
->group('game_id,server_id,role_id') ->group('game_id,server_id,role_id')
->having($having) ->having($having)
->buildSql(); ->buildSql();
$map['_string'] = 'role_id in (' . $subQuery . ')'; $map['_string'] = 'ui.role_id in (' . $subQuery . ')';
} }
$spendMap['uc.create_time'] = ['between', [$map['begintime'], $map['endtime'] - 1]]; $map['uc.create_time'] = ['between', [$map['begintime'], $map['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';
// $map['create_time'] = ['between', [strtotime(date('Y-m-d 00:00:00')) - 6*24*3600, strtotime(date('Y-m-d 23:59:59'))]];
$sqlCost = M('user_play_data_count', 'tab_')->alias('uc')
->field('sum(uc.recharge_cost) cost')
->where($spendMap)
->buildSql();
$sqlCount = M('user_play_data_count', 'tab_')->alias('uc')
->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'))]];
$sqlTodayCost = M('user_play_data_count', 'tab_')->alias('uc')
->field('sum(uc.recharge_count) count')
->where($spendMap)
->buildSql();
unset($map['begintime']); unset($map['begintime']);
unset($map['endtime']); unset($map['endtime']);
$subQuery = M('user_play_info', 'tab_') //$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';
->field("*,$sqlCost as recharge_cost,$sqlCount as recharge_count,$sqlTodayCost 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";
$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";
$field = $fieldUC . ',' . $fieldUI;
$subQuery = M('user_play_data_count', 'tab_')->alias('uc')
->field($field)
->join('tab_user_play_info as ui on ui.promote_id = uc.promote_id and ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->where($map) ->where($map)
->having('recharge_cost > 0') ->group('uc.role_id,uc.server_id,uc.game_id')
->order('play_time desc')
->buildSql(); ->buildSql();
$roles = M()->field(' * ') $roles = M()->alias('record')
->table($subQuery) ->table($subQuery)
->alias('a')
->order('play_time desc')
->select(); ->select();
foreach ($roles as $role) { foreach ($roles as $role) {
$records[] = [ $records[] = [

Loading…
Cancel
Save