|
|
|
@ -8279,18 +8279,23 @@ class ExportController extends Controller
|
|
|
|
|
|
|
|
|
|
$map = [];
|
|
|
|
|
|
|
|
|
|
$searchGameIds = null;
|
|
|
|
|
$game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id');
|
|
|
|
|
$gameWhere = [];
|
|
|
|
|
if ($game_ids) {
|
|
|
|
|
$map['s.game_id'] = ['in', $game_ids];
|
|
|
|
|
$gameWhere['id'] = ['in', $game_ids];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty(I('partner_id'))) {
|
|
|
|
|
$map['g.partner_id'] = I('partner_id');
|
|
|
|
|
$gameWhere['partner_id'] = I('partner_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I('timestart'))) {
|
|
|
|
|
$timestart = strtotime(I('timestart'));
|
|
|
|
|
$map['_string'] = "s.pay_time >= {$timestart}";
|
|
|
|
|
$map['_string'] = "s.payed_time >= {$timestart}";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I('timeend'))) {
|
|
|
|
@ -8303,20 +8308,39 @@ class ExportController extends Controller
|
|
|
|
|
|
|
|
|
|
if (!empty(I('game_type_id'))) {
|
|
|
|
|
$map['g.game_type_id'] = I('game_type_id');
|
|
|
|
|
$gameWhere['game_type_id'] = I('game_type_id', 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$searchGameIds = M('game', 'tab_')->where($gameWhere)->getField('id', true);
|
|
|
|
|
|
|
|
|
|
$xlsData = D("spend")->gameStatistics($map);
|
|
|
|
|
|
|
|
|
|
$uniqueCodes = array_column($xlsData, 'unique_code');
|
|
|
|
|
$gameIds = array_column($xlsData, 'game_id');
|
|
|
|
|
$uniqueCodes = array_filter($uniqueCodes, function($value) {
|
|
|
|
|
if ($value) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$gameSets = M('game_set', 'tab_')->field(['game_id', 'pay_notify_url'])->where(['game_id' => ['in', $gameIds]])->select();
|
|
|
|
|
$gameSets = index_by_column('game_id', $gameSets);
|
|
|
|
|
|
|
|
|
|
$searchGameCodes = [];
|
|
|
|
|
if (count($searchGameIds) > 0) {
|
|
|
|
|
$searchGameCodes = M('game', 'tab_')->where(['id' => ['in', $searchGameIds], 'unique_code' => ['neq', '']])->getField('unique_code', true);
|
|
|
|
|
$searchGameCodes = array_unique($searchGameCodes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$client = new AggregateClient();
|
|
|
|
|
$result = $client->api('game-data', ['unique_codes' => $uniqueCodes, 'started_at' => I('timestart', ''), 'ended_at' => I('timeend', '')]);
|
|
|
|
|
$result = $client->api('game-data', [
|
|
|
|
|
'unique_codes' => $uniqueCodes,
|
|
|
|
|
'started_at' => I('timestart', ''),
|
|
|
|
|
'ended_at' => I('timeend', ''),
|
|
|
|
|
'search_games' => $searchGameCodes,
|
|
|
|
|
'device_type' => I("sdk_type", 0),
|
|
|
|
|
]);
|
|
|
|
|
$aggData = [];
|
|
|
|
|
$aggTotal = '0.00';
|
|
|
|
|
if ($result['code'] == '0000') {
|
|
|
|
@ -8324,7 +8348,7 @@ class ExportController extends Controller
|
|
|
|
|
$aggTotal = $result['data']['total'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$exceptIds = [];
|
|
|
|
|
$exceptIds = getAggExceptIds($gameSets);
|
|
|
|
|
foreach ($xlsData as $key => $value) {
|
|
|
|
|
$aggAmount = '0.00';
|
|
|
|
|
$deviceType = $value['sdk_version'] == 1 ? 'android' : 'ios';
|
|
|
|
@ -8332,11 +8356,10 @@ class ExportController extends Controller
|
|
|
|
|
$aggAmount = number_format($aggData[$value['unique_code']][$deviceType], 2, '.', '');
|
|
|
|
|
}
|
|
|
|
|
$xlsData[$key]['agg_amount'] = $aggAmount;
|
|
|
|
|
if ($aggAmount != '0.00') {
|
|
|
|
|
$value['cash_count'] = 0;
|
|
|
|
|
$value['balance_coin_count'] = 0;
|
|
|
|
|
$value['inside_cash_count'] = 0;
|
|
|
|
|
$exceptIds[] = $value['game_id'];
|
|
|
|
|
if (isset($gameSets[$value['game_id']]) && isAggGame($gameSets[$value['game_id']]['pay_notify_url'])) {
|
|
|
|
|
$xlsData[$key]['cash_count'] = $value['cash_count'] = 0;
|
|
|
|
|
$xlsData[$key]['balance_coin_count'] =$value['balance_coin_count'] = 0;
|
|
|
|
|
$xlsData[$key]['inside_cash_count'] =$value['inside_cash_count'] = 0;
|
|
|
|
|
}
|
|
|
|
|
// $xlsData[$key]['game_name'] = substr($value["game_name"],0,strrpos($value["game_name"],'('));
|
|
|
|
|
$xlsData[$key]['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count'];
|
|
|
|
|