@ -1127,6 +1127,12 @@ class ExportController extends Controller
}
unset($_REQUEST['pay_way']);
}
if ($_REQUEST['merchant_id']) {
$map['merchant_id'] = $_REQUEST['merchant_id'];
unset($_REQUEST['merchant_id']);
}
if (isset($_REQUEST['pay_game_status'])) {
$map['pay_game_status'] = $_REQUEST['pay_game_status'];
unset($_REQUEST['pay_game_status']);
@ -1200,7 +1206,7 @@ class ExportController extends Controller
$xlsCell = array(
"支付订单号","CP订单号", "充值时间","支付时间", "玩家账号", "游戏名称", L('Subordinate_channel'), "所属推广公司", "所属市场专员", "充值ip","区服ID", "游戏区服",
"支付订单号","CP订单号", "充值时间","支付时间", "玩家账号", "游戏名称", L('Subordinate_channel'), "所属推广公司", "所属市场专员","所属商户", "充值ip","区服ID", "游戏区服",
"角色ID","角色名称", "订单金额", "实付金额", "充值方式", L('Order_status'), "游戏通知状态", "消费"."{$total}"
);
@ -1232,7 +1238,7 @@ class ExportController extends Controller
// ->join($tab_promote_join)
// ->order('pay_time DESC')
// ->select();
->field('pay_order_number,extend,pay_time,payed_time,user_account,game_name,promote_account, 0 as company_name,market_admin_id,spend_ip,server_id,server_name,game_player_id,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status, promote_id')
->field('pay_order_number,extend,pay_time,payed_time,user_account,game_name,promote_account, 0 as company_name,market_admin_id,merchant_id, spend_ip,server_id,server_name,game_player_id,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status, promote_id')
// ->join('tab_promote on tab_promote.id = tab_spend.promote_id', 'left')
// ->join('tab_promote_company on tab_promote_company.id and tab_promote.company_id', 'left')
->where($map)
@ -1254,6 +1260,7 @@ class ExportController extends Controller
}else {
$value['payed_time'] = "------";
}
$value['merchant_id'] = getMerchantName($value['merchant_id']);
checkEncryptionAuth($value['user_account'],'spend_lists');
// $value['user_account'] = encryption($value['user_account']);
($value['promote_account']=='官方渠道'||$value['promote_account']=='自然注册')?($value['promote_account']=C('OFFICIEL_CHANNEL')):'';
@ -1352,6 +1359,10 @@ class ExportController extends Controller
$map['pay_status'] = $_REQUEST['pay_status'];
unset($_REQUEST['pay_status']);
}
if ($_REQUEST['merchant_id']) {
$map['merchant_id'] = $_REQUEST['merchant_id'];
unset($_REQUEST['merchant_id']);
}
$map1 = $map;
$map1['pay_status'] = 1;
@ -1369,6 +1380,7 @@ class ExportController extends Controller
array('pay_amount', "充值平台币"),
array('pay_way', "充值方式", 'get_pay_way', '*'),
array('pay_ip', "充值ip"),
array('merchant_id', "所属商户"),
array('create_time', "充值时间"),
array('payed_time','支付时间'),
array('pay_status', L('Order_status'), 'get_info_status', '*', '9'),
@ -1384,6 +1396,8 @@ class ExportController extends Controller
($xlsData[$key]['promote_account']=='官方渠道'||$xlsData[$key]['promote_account']=='自然注册')?($xlsData[$key]['promote_account']=C('OFFICIEL_CHANNEL')):'';
$xlsData[$key]['merchant_id'] = getMerchantName($value['merchant_id']);
$xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']);
if ($value['pay_status'] == 1){
$xlsData[$key]['payed_time'] = date('Y-m-d H:i:s', $value['payed_time']);
@ -2390,6 +2404,10 @@ class ExportController extends Controller
$map['pay_status'] = $_REQUEST['pay_status'];
unset($_REQUEST['pay_status']);
}
if ($_REQUEST['merchant_id']) {
$map['merchant_id'] = $_REQUEST['merchant_id'];
unset($_REQUEST['merchant_id']);
}
$map1 = $map;
$map1['pay_status'] = 1;
@ -2411,6 +2429,7 @@ class ExportController extends Controller
array('promote_account', L('Subordinate_channel')),
array('pay_amount', "充值平台币"),
array('pay_way', "充值方式"),
array('merchant_id', "所属商户"),
array('create_time', "充值时间"),
array('pay_status', L('Order_status'), 'get_info_status', '*', '9'),
array('', "共计充值{$total}"),
@ -2427,6 +2446,7 @@ class ExportController extends Controller
// var_dump($xlsData);die();
foreach ($xlsData as $key => $value) {
$xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']);
$xlsData[$key]['merchant_id'] = getMerchantName($value['merchant_id']);
if(!$xlsData[$key]['pay_way']) {
$xlsData[$key]['pay_way'] = '无';
} else {
@ -2449,6 +2469,7 @@ class ExportController extends Controller
array('order_amount', '订单金额'),
array('pay_amount', '实付金额'),
array('pay_way', '充值方式'),
array('merchant_id', '所属商户'),
array('add_time', '录入时间'),
);
@ -2490,6 +2511,10 @@ class ExportController extends Controller
$timeend = strtotime($params['timeend'])+86399;
$map['t.pay_time'] = array("ELT",$timeend);
}
if ($_REQUEST['merchant_id']) {
$map['merchant_id'] = $_REQUEST['merchant_id'];
unset($_REQUEST['merchant_id']);
}
$orderData =M('test_order t', 'tab_')
@ -2517,6 +2542,7 @@ class ExportController extends Controller
$order_list['pay_amount'] = $v['pay_amount'];
$order_list['pay_way'] = get_pay_way($v['pay_way']);
$order_list['add_time'] = date('Y-m-d H:i:s', $v['add_time']);
$order_list['merchant_id'] = getMerchantName($v['merchant_id']);
checkEncryptionAuth($order_list['user_account'],'TestOrder_lists');
@ -8253,18 +8279,21 @@ class ExportController extends Controller
$map = [];
$searchGameIds = null;
$game_ids = array_column(getGameByName(I("game_name"), I("sdk_type")), 'id');
if ($game_ids) {
$map['s.game_id'] = ['in', $game_ids];
$searchGameIds = $game_ids;
}
if (!empty(I('partner_id'))) {
$map['g.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'))) {
@ -8272,25 +8301,41 @@ class ExportController extends Controller
if (!empty($map['_string'])) {
$map['_string'] .= " and ";
}
$map['_string'] .= " s.pay_time < {$timeend}";
$map['_string'] .= " s.payed _time < {$timeend}";
}
if (!empty(I('game_type_id'))) {
$map['g.game_type_id'] = I('game_type_id');
$searchGameIds = M('game', 'tab_')->where(['game_type_id' => I('game_type_id', 0)])->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,
]);
$aggData = [];
$aggTotal = '0.00';
if ($result['code'] == '0000') {
@ -8298,7 +8343,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';
@ -8306,11 +8351,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'];