@ -133,6 +133,7 @@ class FinancePromoteController extends AdminController
"balance_coin_count"=>0,
"bind_coin_count"=>0,
"inside_cash_count"=>0,
"discount_amount"=>0,
);
$promotes = [];
if (count($senddata) > 0) {
@ -155,6 +156,7 @@ class FinancePromoteController extends AdminController
if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0;
if(!array_key_exists('bind_coin_count',$v)) $v['bind_coin_count']=0;
if(!array_key_exists('inside_cash_count',$v)) $v['inside_cash_count']=0;
if(!array_key_exists('discount_amount',$v)) $v['discount_amount']=0;
$v['promote_account'] = get_promote_name($v['p_id']);
($v['promote_account']=='官方渠道')?($v['promote_account']=C('OFFICIEL_CHANNEL')):'';
$v['admin_username'] = $adminUsernames[$promote['admin_id']] ?? '无';
@ -169,6 +171,7 @@ class FinancePromoteController extends AdminController
$count['inside_cash_count'] += $v['inside_cash_count'];
$count['all_count'] += $v['allcount'];
$count['unallcount'] += $v['unallcount'];
$count['discount_amount'] += $v['discount_amount'];
$data[] = $v;
}
$data = my_sort($data, $data_order_type, (int)$data_order);
@ -191,6 +194,7 @@ class FinancePromoteController extends AdminController
"inside_cash_count"=>"平台币内充",
"allcount"=>"渠道游戏内充值合计",
"unallcount"=>"渠道游戏内不结算充值合计",
"discount_amount"=>"优惠金额",
));
}
// dump($data);die();
@ -220,6 +224,7 @@ class FinancePromoteController extends AdminController
$count['bind_coin_count'] = number_format($count['bind_coin_count'],2,'.','');
$count['inside_cash_count'] = number_format($count['inside_cash_count'],2,'.','');
$count['all_count'] = number_format($count['all_count'],2,'.','');
$count['discount_amount'] = number_format($count['discount_amount'],2,'.','');
$this->checkListOrCountAuthRestMap($map,[]);
@ -295,6 +300,7 @@ class FinancePromoteController extends AdminController
$field= "SUM(CASE WHEN pay_way >= 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count,
SUM(discount_amount) as discount_amount,
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_id,0) company_id,company_name,develop_type,IFNULL(promote.company_belong,0) company_belong";
$query = SM()
@ -370,6 +376,7 @@ class FinancePromoteController extends AdminController
$field= "SUM(CASE WHEN pay_way > 0 and s.is_check=1 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 and s.is_check=1 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 and s.is_check=1 THEN pay_amount ELSE 0 END) as bind_coin_count,
SUM(discount_amount) as discount_amount,
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_id,0) company_id,company_name,develop_type,IFNULL(promote.company_belong,0) company_belong";
$query = SM()
@ -484,6 +491,7 @@ class FinancePromoteController extends AdminController
"balance_coin_count"=>0,
"bind_coin_count"=>0,
"inside_cash_count"=>0,
"discount_amount"=>0,
);
$marketAdmins = [];
@ -525,6 +533,7 @@ class FinancePromoteController extends AdminController
$allcount['bind_coin_count'] += $v['bind_coin_count'];
$allcount['inside_cash_count'] += $v['inside_cash_count'];
$allcount['all_count'] += $v['allcount'];
$allcount['discount_amount'] += $v['discount_amount'];
$data[] = $v;
}
@ -533,6 +542,7 @@ class FinancePromoteController extends AdminController
$allcount['bind_coin_count'] = number_format($allcount['bind_coin_count'],2,'.','');
$allcount['inside_cash_count'] = number_format($allcount['inside_cash_count'],2,'.','');
$allcount['all_count'] = number_format($allcount['all_count'],2,'.','');
$allcount['discount_amount'] = number_format($allcount['discount_amount'],2,'.','');
$data = my_sort($data, $data_order_type, (int)$data_order);
if(isset($_REQUEST['export'])){
@ -552,7 +562,8 @@ class FinancePromoteController extends AdminController
"balance_coin_count"=>"平台币直充支出",
"bind_coin_count"=>"内充支出",
"inside_cash_count"=>"平台币内充",
"allcount"=>"渠道游戏内充值合计"
"allcount"=>"渠道游戏内充值合计",
"discount_amount"=>"优惠金额",
));
}
@ -603,6 +614,7 @@ class FinancePromoteController extends AdminController
$field= "SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count,
SUM(discount_amount) as discount_amount,
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,develop_type,IFNULL(promote.company_belong,0) company_belong";
$query = SM()
->table("tab_spend s use index(promote_time)")
@ -744,7 +756,8 @@ class FinancePromoteController extends AdminController
"cash_count"=>"游戏现金金额",
"balance_coin_count"=>"平台币直充支出",
"inside_cash_count"=>"内充支出",
"all_cash_count"=>"游戏内充值合计"
"all_cash_count"=>"游戏内充值合计",
"discount_amount"=>"优惠金额",
));
}
@ -763,11 +776,13 @@ class FinancePromoteController extends AdminController
$sumCash = $totalData['cash_count'];
$sumBalance = $totalData['balance_coin_count'];
$sumInside = $totalData['inside_cash_count'];
$sumDiscount = $totalData['discount_amount'];
$sumAll = number_format($sumCash + $sumBalance + $sumInside,2,'.','');
$departments = M('department', 'sys_')->select();
$this->assign('departments', $departments);
$this->assign('sumCash', $sumCash);
$this->assign('sumDiscount', $sumDiscount);
$this->assign('sumBalance', $sumBalance);
$this->assign('sumInside', $sumInside);
$this->assign('sumAll', $sumAll);
@ -864,7 +879,7 @@ class FinancePromoteController extends AdminController
$map['merchant_id'] = $_REQUEST['merchant_id'];
}
$field = "pay_order_number,FROM_UNIXTIME(payed_time) as pay_time,user_account,user_nickname,game_name,sdk_version,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way,market_admin_id,merchant_id";
$field = "pay_order_number,FROM_UNIXTIME(payed_time) as pay_time,user_account,user_nickname,game_name,sdk_version,promote_account,spend_ip,server_name,game_player_name,pay_amount,discount_amount, cost,pay_way,market_admin_id,merchant_id";
$group = "";
$order = "pay_time DESC";
if(isset($_REQUEST['export'])){
@ -924,6 +939,7 @@ class FinancePromoteController extends AdminController
"server_name"=>"游戏区服",
"game_player_name"=>"角色名称",
"cost"=>"订单金额",
"discount_amount"=>"折扣",
"pay_amount"=>"实付金额",
"pay_way"=>"充值方式",
"merchant_name"=>"所属商户",
@ -976,6 +992,7 @@ class FinancePromoteController extends AdminController
SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count,
SUM(discount_amount) as discount_amount,
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_name,'{$this->COMPANY_NAME}') company_name,develop_type,IFNULL(promote.company_belong,0) company_belong")
->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
@ -1012,7 +1029,8 @@ class FinancePromoteController extends AdminController
$query = SM("spend","tab_")->alias("s")
->field("SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count");
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count,
SUM(discount_amount) as discount_amount");
if ($join) {
$query = $query->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id')