@ -2502,6 +2502,14 @@ class DownloadController extends BaseController {
->where($map)
->order('id desc')
->select();
$total = [];
$total = $model->field('sum(pay_amount) as pay_amount,sum(if(pay_way > -1,pay_amount,0)) as direct_pay_amount,sum(if(pay_way = -1,pay_amount,0)) as inner_pay_amount,sum(if(selle_ratio >= 0,selle_ratio * pay_amount,0)) as income')
->where($map)
->find();
$total['direct_pay_amount'] = empty($total['direct_pay_amount']) ? '0.00' : $total['direct_pay_amount'];
$total['inner_pay_amount'] = empty($total['inner_pay_amount']) ? '0.00' : $total['inner_pay_amount'];
$total['income'] = empty($total['income']) ? 0 : $total['income'];
$total['income'] = bcdiv($total['income'], 100, 2);
//提现状态
$withdrawIds = [];
foreach ($data as $key => $value) {
@ -2548,6 +2556,19 @@ class DownloadController extends BaseController {
}
}
$allData['pay_order_number'] = '合计';
$allData['game_name'] = '--';
$allData['user_account'] = '--';
$allData['promote_account'] = '--';
$allData['pay_amount'] = $total['pay_amount'];
$allData['pay_amount_zhi'] = $total['direct_pay_amount'];
$allData['pay_amount_nei'] = $total['inner_pay_amount'];
$allData['selle_ratio'] = '--';
$allData['selle_ratio'] = '--';
$allData['income'] = $total['income'];
$allData['pay_time'] = '--';
$allData['selle_status'] = '--';
$data[] = $allData;
$xlsData = $data;
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
@ -2895,6 +2916,12 @@ class DownloadController extends BaseController {
$roles = M()->alias('record')
->table($subQuery)
->select();
$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')
->where($map)
->find();
foreach ($roles as $role) {
$records[] = [
'user_account' => encryption($role['user_account']),
@ -2915,7 +2942,22 @@ class DownloadController extends BaseController {
'unlogin_day' => intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $role['play_time']))) / (24 * 3600))
];
}
$allData['user_account'] = '合计';
$allData['game_name'] = '--';
$allData['role_name'] = '--';
$allData['role_id'] = '--';
$allData['role_level'] = '--';
$allData['server_id'] = '--';
$allData['server_name'] = '--';
$allData['recharge_cost'] = $total['recharge_cost'];
$allData['recharge_count'] = $total['recharge_count'];
$allData['recharge_cost_today'] = $total['recharge_cost_today'];
$allData['play_time'] = '--';
$allData['play_ip'] = '--';
$allData['promote_id'] = '--';
$allData['promote_account'] = '--';
$allData['sdk_version'] = '--';
$allData['unlogin_day'] = '--';
$xlsData = [];
foreach ($records as $key1 => $value1) {
$value1['user_account'] = $this->encryption($value1['user_account']);
@ -2927,6 +2969,7 @@ class DownloadController extends BaseController {
}
$xlsData[] = $value1;
}
$xlsData[] = $allData;
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
}
@ -3027,6 +3070,28 @@ class DownloadController extends BaseController {
ob_flush();
flush();
}
$income = '0.00';
$income = M('Spend', 'tab_')
->field('sum(tab_spend.pay_amount) as income')
->join('tab_game on tab_spend.game_id = tab_game.id')
->join('left join tab_promote on tab_spend.promote_id = tab_promote.id')
->where($map)
->order('tab_spend.id desc')
->find()['income'];
$csvData1["user_account"] = "合计";
$csvData1["order_number"] = "--";
$csvData1["pay_amount"] = $income;
$csvData1["pay_way"] = "--";
$csvData1["game_name"] = "--";
$csvData1["server_name"] = "--";
$csvData1["game_player_name"] = "--";
$csvData1["p_p_proinfo"] = "--";
$csvData1["p_proinfo"] = "--";
$csvData1["proinfo"] = "--";
$csvData1["pay_time"] = "--";
mb_convert_variables('GBK', 'UTF-8', $csvData1);
fputcsv($fp, $csvData1);
$xlsData[] = $csvData1;
fclose($fp);
$this->backSuccessExport($id);
}