|
|
|
@ -4,6 +4,7 @@ namespace Admin\Controller;
|
|
|
|
|
use Think\Controller;
|
|
|
|
|
use GuzzleHttp\Client;
|
|
|
|
|
use Admin\Model\PromoteModel;
|
|
|
|
|
use Base\Tool\AggregateClient;
|
|
|
|
|
|
|
|
|
|
class ExportController extends Controller
|
|
|
|
|
{
|
|
|
|
@ -1174,6 +1175,16 @@ class ExportController extends Controller
|
|
|
|
|
$order = ' pay_time desc ';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (I('platform_type', 0) != 0) {
|
|
|
|
|
$sy = I('platform_type', 0) == 1 ? '=' : '<>';
|
|
|
|
|
$platformWhere = 'exists (select 1 from tab_game where id = tab_spend.game_id and unique_code ' . $sy . ' "")';
|
|
|
|
|
if (isset($map['_string']) && $map['_string']) {
|
|
|
|
|
$map['_string'] = $map['_string'] . ' and ' . $platformWhere;
|
|
|
|
|
} else {
|
|
|
|
|
$map['_string'] = $platformWhere;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) {
|
|
|
|
|
// $map1 = $map;
|
|
|
|
|
// $map1['pay_status'] = 1;
|
|
|
|
@ -8149,6 +8160,7 @@ class ExportController extends Controller
|
|
|
|
|
array('balance_coin_count','平台币直充支出'),
|
|
|
|
|
array('inside_cash_count','内充支出'),
|
|
|
|
|
array('all_cash_count','游戏内充值合计'),
|
|
|
|
|
array('agg_amount','聚合平台数据'),
|
|
|
|
|
array('notice_fail_count','通知失败合计'),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
@ -8181,7 +8193,38 @@ class ExportController extends Controller
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$xlsData = D("spend")->gameStatistics($map);
|
|
|
|
|
|
|
|
|
|
$uniqueCodes = array_column($xlsData, 'unique_code');
|
|
|
|
|
$uniqueCodes = array_filter($uniqueCodes, function($value) {
|
|
|
|
|
if ($value) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$client = new AggregateClient();
|
|
|
|
|
$result = $client->api('game-data', ['unique_codes' => $uniqueCodes, 'started_at' => I('timestart', ''), 'ended_at' => I('timeend', '')]);
|
|
|
|
|
$aggData = [];
|
|
|
|
|
$aggTotal = '0.00';
|
|
|
|
|
if ($result['code'] == '0000') {
|
|
|
|
|
$aggData = $result['data']['records'];
|
|
|
|
|
$aggTotal = $result['data']['total'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$exceptIds = [];
|
|
|
|
|
foreach ($xlsData as $key => $value) {
|
|
|
|
|
$aggAmount = '0.00';
|
|
|
|
|
$deviceType = $value['sdk_version'] == 1 ? 'android' : 'ios';
|
|
|
|
|
if ($value['unique_code'] && isset($aggData[$value['unique_code']]) && isset($aggData[$value['unique_code']][$deviceType])) {
|
|
|
|
|
$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'];
|
|
|
|
|
}
|
|
|
|
|
// $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'];
|
|
|
|
|
if ($value['sdk_version'] == 1) {
|
|
|
|
@ -8190,6 +8233,14 @@ class ExportController extends Controller
|
|
|
|
|
$xlsData[$key]['sdk_version'] = '苹果';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (count($exceptIds) > 0) {
|
|
|
|
|
if (isset($map['_string'])) {
|
|
|
|
|
$map['_string'] .= " and s.game_id not in (" . implode(',', $exceptIds) . ")";
|
|
|
|
|
} else {
|
|
|
|
|
$map['_string'] = " s.game_id not in (" . implode(',', $exceptIds) . ")";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$totalData = D("spend")->totalGameStatistics($map);
|
|
|
|
|
|
|
|
|
|
$sumCash = $totalData['cash_count'];
|
|
|
|
@ -8203,6 +8254,7 @@ class ExportController extends Controller
|
|
|
|
|
'balance_coin_count'=>$sumBalance,
|
|
|
|
|
'inside_cash_count'=>$sumInside,
|
|
|
|
|
'all_cash_count'=>$sumAll,
|
|
|
|
|
'agg_amount' => $aggTotal,
|
|
|
|
|
'notice_fail_count'=>$sumNoticeFail]];
|
|
|
|
|
$xlsData = array_merge($xlsData,$sumData);
|
|
|
|
|
$this->exportAddOperationLog("Finance/gameStatistics","充值-财务管理-游戏统计-导出");
|
|
|
|
|