@ -105,6 +105,7 @@ class FinancePromoteController extends AdminController
);
foreach($senddata as $k=>$v){
$v['company_belong']?$v['company_belong']='外团':$v['company_belong']='内团';
if(empty($v['company_name'])) $v['company_name']= "万盟天下科技";
if(empty($v['p_id'])) $v['p_id']= "0";
if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
@ -138,6 +139,24 @@ class FinancePromoteController extends AdminController
$this->assign('_page', $page);
}
$outBelong = 0;
$insideBelong = 0;
foreach ($data as $key => $value) {
if ($value['company_belong']) {
$outBelong+=$value['allcount'];
} else {
$insideBelong+=$value['allcount'];
}
}
//外团占比
$this->assign('outBelong',$outBelong/$count['all_count']*100);
//内团占比
$this->assign('insideBelong',$insideBelong/$count['all_count']*100);
$size = $row;
$data = array_slice($data, ($arraypage - 1) * $size, $size);
$this->assign('list_data', $data);
@ -176,7 +195,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(company_id,0) company_id,company_name,promote.company_belong ";
return M()
->table("tab_spend s")
->field($field)
@ -193,7 +212,7 @@ class FinancePromoteController extends AdminController
$map['s.source_id']=0;
$field= "SUM(CASE WHEN s.type = 1 THEN num ELSE 0 END) as pay_amount,SUM(CASE WHEN s.type = 2 THEN num ELSE 0 END) as back_amount,IFNULL(if(substring_index(substring_index(`chain`,'/',2),'/',-1)='',
s.promote_id,substring_index(substring_index(`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_id,0) company_id,company_name";
IFNULL(company_id,0) company_id,company_name,promote.company_belong ";
return M("promote_coin s","tab_")
->field($field)
->where($map)
@ -229,10 +248,12 @@ class FinancePromoteController extends AdminController
$senddata = [];
//获取各会长的现金充值
$cash = self::promoteUserData([],$istimeselect);
foreach($cash as $k=>$v){
$senddata[$v['promote_id']] = $v;
}
$inside = self::promoteUserData([],$istimeselect,"promote_coin");
foreach($inside as $k=>$v){
if(array_key_exists($v['promote_id'],$senddata)){
$senddata[$v['promote_id']]['inside_cash_count']= $v['pay_amount']-$v['back_amount'];
@ -276,6 +297,7 @@ class FinancePromoteController extends AdminController
);
foreach($senddata as $k=>$v){
$v['company_belong']?$v['company_belong']='外团':$v['company_belong']='内团';
if(empty($v['company_name'])) $v['company_name']= "万盟天下科技";
if(empty($v['promote_account'])) $v['promote_account']= "官方渠道";
if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
@ -339,7 +361,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(company_id,0) company_id,company_name,promote_id,promote.account promote_account,promote.company_belong ";
return M()
->table("tab_spend s")
->field($field)
@ -355,7 +377,7 @@ class FinancePromoteController extends AdminController
$map['s.status']=1;
$map['s.source_id']=0;
$field= "SUM(CASE WHEN s.type = 1 THEN num ELSE 0 END) as pay_amount,SUM(CASE WHEN s.type = 2 THEN num ELSE 0 END) as back_amount,
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account";
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,promote.company_belong ";
return M("promote_coin s","tab_")
->field($field)
->where($map)