优化渠道统计

master
chenzhi 4 years ago
parent 19c62de87c
commit 45d883e89c

@ -1058,18 +1058,18 @@ function showNumPercent($num)
}
//优化子站点实例化方法
function SM($name='', $tablePrefix='tab_')
function SM($name='', $tablePrefix='tab_',$is_subsiteTable=false)
{
$tableName = strtolower($tablePrefix.unCamelize($name));
if(is_subsiteTable($tableName)){
if(is_subsiteTable($tableName) || $is_subsiteTable){
return M($name, $tablePrefix,SUBSITE_DB);
}
return M($name, $tablePrefix);
}
//判断是否有子站点表格
function is_subsiteTable($tableName)
function is_subsiteTable($tableName,$is_subsiteTable=false)
{
if(IS_SUBSITE && in_array($tableName,C('SUBSITE_TABLE'))){
if(IS_SUBSITE && ($is_subsiteTable || in_array($tableName,C('SUBSITE_TABLE')))){
return true;
}
return false;

@ -1333,7 +1333,7 @@ class FinanceController extends ThinkController
// setPowerPromoteIds($map);
//获取现金充值
$cashStatistics = M('spend', 'tab_')
$cashStatistics = SM('spend', 'tab_')
->field('pay_way,"" as pay_type,SUM(pay_amount) AS pay_amount')
->where(['pay_status' => 1,'pay_way'=>['egt',1],'payed_time'=>$time])
->group('pay_way')
@ -1345,7 +1345,7 @@ class FinanceController extends ThinkController
$cashStatistics = array_column($cashStatistics, null, 'pay_way');
// dd($cashStatistics);
//获取平台币充值
$deposit = M('deposit', 'tab_')->where([
$deposit = SM('deposit', 'tab_')->where([
'pay_source' => 2,
'tab_deposit.pay_status' => 1,
'tab_deposit.pay_way' => ['gt', 0],
@ -1436,7 +1436,7 @@ class FinanceController extends ThinkController
$offcialmap['pay_way'] = array('egt',1);
$offcialmap['pay_source'] = 0;
$offcialData = M('deposit','tab_')
$offcialData = SM('deposit','tab_')
->field("pay_way,'' as pay_type,sum(pay_amount) as pay_amount")
->where([
'pay_status'=>1,

@ -56,11 +56,15 @@ class PayChannelController extends ThinkController
$map['pay_status'] = $coinMap['pay_status'] = 1;
$map['pay_way'] = array('egt',1);
if(IS_SUBSITE){
$map['partner_type']=PARTNER_TYPE;
$coinMap['tab_deposit.partner_type']=PARTNER_TYPE;
}
// setPowerPromoteIds($map,'promote_id');
//游戏币计算
$data = M('spend use index(pay_channel)','tab_')
$data = SM('spend use index(pay_channel)','tab_',true)
->field("game_name,sum(pay_amount) as pay_amount,game_id,sdk_version")
->where($map)
->group('game_id')
@ -79,7 +83,6 @@ class PayChannelController extends ThinkController
->where($coinMap)
->group("game_id")
->select();
// unset($coinMap['game_id']);
//平台币充值
$coinSum = M('deposit','tab_')
@ -94,12 +97,13 @@ class PayChannelController extends ThinkController
foreach($coinData as $key => $value) {
$handleCoinData[$value['game_id']] = $value['platform_coin'];
}
//测试白名单
$testList = implode(",",M("test_white_list","tab_")->getField("user_id",true));
//测试数据汇总计算
$testData = M('spend','tab_')
$testData = SM('spend','tab_')
->field("sum(pay_amount) as test_coin,game_name,game_id")
->join("inner join tab_test_white_list on tab_spend.user_id=tab_test_white_list.user_id")
->where($map)
->where("user_id in ({$testList})")
->group('game_id')
->select();
@ -131,6 +135,7 @@ class PayChannelController extends ThinkController
$data[$key]['sdk_version'] =getGameTypeName($data[$key]['sdk_version']);
}
$superMap = $map;
if(isset($superMap['partner_type'])) unset($superMap['partner_type']);
unset($superMap['payed_time']);
$superMap['pay_time'] = $map['payed_time'];
// unset($superMap['promote_id']);
@ -446,6 +451,7 @@ class PayChannelController extends ThinkController
->select(false);
$superMap = $map;
if(isset($superMap['partner_type'])) unset($superMap['partner_type']);
if ($map['payed_time']){
$superMap['pay_time'] = $map['payed_time'];
unset($superMap['payed_time']);

Loading…
Cancel
Save