|
|
|
@ -76,6 +76,21 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$nwtflag = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(isset($_REQUEST['admin_id'])){
|
|
|
|
|
if($_REQUEST['admin_id']!=0){
|
|
|
|
|
$nwtflag = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(isset($_REQUEST['admin_id'])){
|
|
|
|
|
if($_REQUEST['admin_id']!=0){
|
|
|
|
|
$nwtflag = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(isset($_REQUEST['develop_type'])){
|
|
|
|
|
if($_REQUEST['develop_type']!=0){
|
|
|
|
|
$nwtflag = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['promote_id'])) {
|
|
|
|
|
if($_REQUEST['promote_id'] == 0){
|
|
|
|
|
$gfidlag = true;
|
|
|
|
@ -110,7 +125,14 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
"bind_coin_count"=>0,
|
|
|
|
|
"inside_cash_count"=>0,
|
|
|
|
|
);
|
|
|
|
|
$promotes = [];
|
|
|
|
|
if (count($senddata) > 0) {
|
|
|
|
|
$promotes = M('promote', 'tab_')->field(['id', 'account', 'admin_id'])->where(['id' => ['in', array_column($senddata, 'p_id')]])->select();
|
|
|
|
|
}
|
|
|
|
|
$promotes = index_by_column('id', $promotes);
|
|
|
|
|
$adminUsernames = getAdminUsernameList(array_column($promotes, 'admin_id'));
|
|
|
|
|
foreach($senddata as $k=>$v){
|
|
|
|
|
$promote = $promotes[$v['p_id']] ?? null;
|
|
|
|
|
$v['company_belong'] = $v['company_belong'] ?:0;
|
|
|
|
|
$v['company_belong'] = getCompanyBlong($v['company_belong']);
|
|
|
|
|
if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME;
|
|
|
|
@ -119,8 +141,10 @@ 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;
|
|
|
|
|
$v['promote_account'] = get_promote_name($v['p_id']);
|
|
|
|
|
|
|
|
|
|
$v['promote_account'] = $v['p_id'] == 0 ? '官方渠道' : ($promote ? $promote['account'] : '');
|
|
|
|
|
$v['admin_username'] = $adminUsernames[$promote['admin_id']] ?? '无';
|
|
|
|
|
$v['develop_type_text'] = getCompanyDevelopTypeText($v['develop_type']);
|
|
|
|
|
|
|
|
|
|
$v['inside_cash_count'] = number_format($v['inside_cash_count'],2,'.','');
|
|
|
|
|
$v['allcount'] = number_format($v['cash_count']-0+$v['balance_coin_count']+$v['bind_coin_count'],2,'.','');
|
|
|
|
|
$count['cash_count'] += $v['cash_count'];
|
|
|
|
@ -208,6 +232,13 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$map['promote.company_belong'] = $_REQUEST['company_belong'];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I('develop_type'))) {
|
|
|
|
|
$map['company.develop_type'] = I('develop_type');
|
|
|
|
|
}
|
|
|
|
|
if (!empty(I('admin_id'))) {
|
|
|
|
|
$map['promote.admin_id'] = I('admin_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($type == "spend"){
|
|
|
|
@ -222,7 +253,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
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,
|
|
|
|
|
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,IFNULL(promote.company_belong,0) company_belong";
|
|
|
|
|
IFNULL(company_id,0) company_id,company_name,develop_type,IFNULL(promote.company_belong,0) company_belong";
|
|
|
|
|
return M()
|
|
|
|
|
->table("tab_spend s use index(promote_time)")
|
|
|
|
|
->field($field)
|
|
|
|
@ -319,8 +350,18 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
"bind_coin_count"=>0,
|
|
|
|
|
"inside_cash_count"=>0,
|
|
|
|
|
);
|
|
|
|
|
foreach($senddata as $k=>$v){
|
|
|
|
|
|
|
|
|
|
$promotes = [];
|
|
|
|
|
if (count($senddata) > 0) {
|
|
|
|
|
$promotes = M('promote', 'tab_')->field(['id', 'account', 'admin_id'])->where(['id' => ['in', array_column($senddata, 'promote_id')]])->select();
|
|
|
|
|
}
|
|
|
|
|
$promotes = index_by_column('id', $promotes);
|
|
|
|
|
$adminUsernames = getAdminUsernameList(array_column($promotes, 'admin_id'));
|
|
|
|
|
|
|
|
|
|
foreach($senddata as $k=>$v){
|
|
|
|
|
$promote = $promotes[$v['promote_id']] ?? null;
|
|
|
|
|
$v['admin_username'] = $adminUsernames[$promote['admin_id']] ?? '无';
|
|
|
|
|
$v['develop_type_text'] = getCompanyDevelopTypeText($v['develop_type']);
|
|
|
|
|
$v['company_belong'] = getCompanyBlong($v['company_belong']);
|
|
|
|
|
if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME;
|
|
|
|
|
if(empty($v['promote_account'])) $v['promote_account']= "官方渠道";
|
|
|
|
@ -391,7 +432,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,
|
|
|
|
|
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,IFNULL(promote.company_belong,0) company_belong";
|
|
|
|
|
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,develop_type,IFNULL(promote.company_belong,0) company_belong";
|
|
|
|
|
return M()
|
|
|
|
|
->table("tab_spend s use index(promote_time)")
|
|
|
|
|
->field($field)
|
|
|
|
@ -439,6 +480,12 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
} elseif (isset($_REQUEST['time_end'])) {
|
|
|
|
|
$map['s.pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
|
|
|
|
|
}
|
|
|
|
|
if (!empty(I('develop_type'))) {
|
|
|
|
|
$map['develop_type'] = I('develop_type');
|
|
|
|
|
}
|
|
|
|
|
if (!empty(I('admin_id'))) {
|
|
|
|
|
$map['admin_id'] = I('admin_id');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取推广员
|
|
|
|
|
$title = '';
|
|
|
|
@ -454,13 +501,24 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}else {
|
|
|
|
|
$data =self::gameStatisticsData($map, $row, $p);
|
|
|
|
|
}
|
|
|
|
|
$promotes = [];
|
|
|
|
|
if (count($data) > 0) {
|
|
|
|
|
$promotes = M('promote', 'tab_')->field(['id', 'account', 'admin_id'])->where(['id' => ['in', array_column($data, 'p_id')]])->select();
|
|
|
|
|
}
|
|
|
|
|
$promotes = index_by_column('id', $promotes);
|
|
|
|
|
$adminUsernames = getAdminUsernameList(array_column($promotes, 'admin_id'));
|
|
|
|
|
|
|
|
|
|
foreach ($data as $key => &$value) {
|
|
|
|
|
$promote = $promotes[$value['p_id']] ?? null;
|
|
|
|
|
$value['cash_count']?:0;
|
|
|
|
|
$value['balance_coin_count']?:0;
|
|
|
|
|
$value['inside_cash_count']?:0;
|
|
|
|
|
$value['all_cash_count'] = number_format($value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count'],2,'.','');
|
|
|
|
|
$value['company_belong'] =getCompanyBlong($value['company_belong']);
|
|
|
|
|
|
|
|
|
|
$value['admin_username'] = $adminUsernames[$promote['admin_id']] ?? '无';
|
|
|
|
|
$value['develop_type_text'] = getCompanyDevelopTypeText($value['develop_type']);
|
|
|
|
|
|
|
|
|
|
$value['game_name'] =clearGameNameType($value['game_name']);
|
|
|
|
|
$value['sdk_version'] =getGameTypeName($value['sdk_version']);
|
|
|
|
|
|
|
|
|
@ -538,6 +596,14 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$map['pay_order_number'] = $_REQUEST['pay_order_number'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* if (!empty(I('develop_type'))) {
|
|
|
|
|
$map['company.develop_type'] = I('develop_type');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I('admin_id'))) {
|
|
|
|
|
$map['market_admin_id'] = I('admin_id');
|
|
|
|
|
} */
|
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type']) || isset($_REQUEST['partner_id'])) {
|
|
|
|
|
$map["game_id"] = array("in",implode(',', array_column(getGameidByPartnerNameType($_REQUEST['partner_id'],$_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) );
|
|
|
|
|
}
|
|
|
|
@ -650,7 +716,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
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,
|
|
|
|
|
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,IFNULL(promote.company_belong,0) company_belong")
|
|
|
|
|
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')
|
|
|
|
|
->join("tab_promote promote ON s.promote_id = promote.id","left")
|
|
|
|
|
->join("tab_promote_company company ON promote.company_id = company.id","left")
|
|
|
|
@ -678,7 +744,9 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count");
|
|
|
|
|
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');
|
|
|
|
|
->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id')
|
|
|
|
|
->join("tab_promote promote ON s.promote_id = promote.id","left")
|
|
|
|
|
->join("tab_promote_company company ON promote.company_id = company.id","left");
|
|
|
|
|
}
|
|
|
|
|
$data = $query->where(['s.pay_status' => 1])
|
|
|
|
|
->where($map)
|
|
|
|
@ -987,6 +1055,20 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
$title .= (getCompanyBlong($_REQUEST['company_belong'])."-");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty(I('develop_type'))) {
|
|
|
|
|
$map['company.develop_type'] = I('develop_type');
|
|
|
|
|
if(I('develop_type') != 0){
|
|
|
|
|
$gfflg = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!empty(I('admin_id'))) {
|
|
|
|
|
$map['promote.admin_id'] = I('admin_id');
|
|
|
|
|
if(I('admin_id') != 0){
|
|
|
|
|
$gfflg = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['promote_id'])) {
|
|
|
|
|
if($ptype){
|
|
|
|
|
$pmap = false;//取消非特异推广员检索
|
|
|
|
|