@ -1182,13 +1182,20 @@ class DownloadController extends BaseController {
}
if (!empty(I('begtime')) & & empty(I('endtime'))) {
$map['tab_spend.pay_time'] = ['egt', strtotime(I('begtime'))];
} elseif (empty(I('begtime')) & & !empty(I('endtime'))) {
$map['tab_spend.pay_time'] = ['elt', strtotime(I('endtime')) + 86399];
} elseif (!empty(I('begtime')) & & !empty(I('endtime'))) {
$map['tab_spend.pay_time'] = ['between', [strtotime(I('begtime')), strtotime(I('endtime')) + 86399]];
}else {
$nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initEndTime = date('Y-m-d');
$initBegTime = strtotime($initBegTime);
$initEndTime = strtotime($initEndTime);
$map['tab_spend.pay_time'] = ['between',[$initBegTime,$initEndTime]];
}
empty(I('relation_game_id')) || $map['tab_game.relation_game_id'] = I('relation_game_id');
@ -1196,7 +1203,7 @@ class DownloadController extends BaseController {
empty(I('server_id')) || $map['tab_spend.server_id'] = I('server_id');
empty(I('game_player_name')) || $map['tab_spend.game_player_name'] = ['like', '%' . I('game_player_name') . '%'];
empty(I('user_account')) || $map['tab_spend.user_account'] = ['like', '%' . I('user_account') . '%'];
empty(I('order_number')) || $map['tab_spend.order_number'] = I('order_number');
empty(I('pay_ order_number')) || $map['tab_spend.pay_ order_number'] = I('pay_ order_number');
$map['tab_spend.pay_status'] = 1;
$map['tab_spend.is_check'] = ['neq', 2];
@ -1233,8 +1240,8 @@ class DownloadController extends BaseController {
$costBegin = I('cost_begin', ''); //充值总额范围
$costEnd = I('cost_end', '');
$nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
$initBegTime = date('Y-m-d', strtotime('-7 day', strtotime($nowTime)));
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
$initEndTime = $nowTime;
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
$begTime = strtotime($initBegTime);
@ -2900,7 +2907,8 @@ class DownloadController extends BaseController {
->buildSql();
$map['_string'] = 'ui.role_id in (' . $subQuery . ')';
}
$map['uc.create_time'] = ['between', [$map['begintime'], $map['endtime'] - 1]];
$secondDay = 24*3600 + 1;
$map['uc.create_time'] = ['between', [$map['begintime'], $map['endtime'] - $secondDay]];
unset($map['begintime']);
unset($map['endtime']);
//$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';
@ -2909,7 +2917,7 @@ class DownloadController extends BaseController {
$field = $fieldUC . ',' . $fieldUI;
$subQuery = M('user_play_data_count', 'tab_')->alias('uc')
->field($field)
->join('tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->join('left join tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->where($map)
->group('uc.role_id,uc.server_id,uc.game_id')
->buildSql();
@ -2919,7 +2927,7 @@ class DownloadController extends BaseController {
$total = [];
$total = M('user_play_data_count', 'tab_')->alias('uc')
->field($fieldUC)
->join('tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->join('left join tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->where($map)
->find();
foreach ($roles as $role) {
@ -3030,7 +3038,7 @@ class DownloadController extends BaseController {
$value1['proinfo'] = $value1['pro_account'].'('.$value1['pro_real_name'].')';
// $value1['user_account'] = substr_replace($value1['user_account'],'************',3,12);
$value1['user_account'] = $this->encryption($value1['user_account']);
$value1['order_number'] = $this->encryption($value1['order_number']);
$value1['pay_ order_number'] = $this->encryption($value1['pay_ order_number']);
if(!empty($value1['chain'])) {
$chain = trim($value1['chain'],'/');
$chainArr = explode('/', $chain);
@ -3052,7 +3060,7 @@ class DownloadController extends BaseController {
}
$csvData["user_account"] = $value1["user_account"];
$csvData["order_number"] = $value1["order_number"];
$csvData["pay_ order_number"] = $value1["pay_ order_number"];
$csvData["pay_amount"] = $value1["pay_amount"];
$csvData["pay_way"] = $value1["pay_way"];
$csvData["game_name"] = $value1["game_name"];
@ -3079,7 +3087,7 @@ class DownloadController extends BaseController {
->order('tab_spend.id desc')
->find()['income'];
$csvData1["user_account"] = "合计";
$csvData1["order_number"] = "--";
$csvData1["pay_ order_number"] = "--";
$csvData1["pay_amount"] = $income;
$csvData1["pay_way"] = "--";
$csvData1["game_name"] = "--";