工会统计新增内外团占比

master
zhengyongxing 5 years ago
parent 1c8f0d4464
commit 10f6caddfa

@ -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)

@ -155,6 +155,7 @@
<tr>
<th>推广公司</th>
<th>会长渠道</th>
<th>内外团</th>
<th class="tooltip"><a class="paixu" data-order='cash_count'>
<if condition="$userarpu_order eq 4 and $userarpu_order_type eq 'cash_count'">游戏现金金额▲
@ -204,6 +205,7 @@
<tr>
<td>{$data.company_name}</td>
<td>{$data['promote_account']}</td>
<td>{$data['company_belong']}</td>
<td>{$data.cash_count}</td>
<td class="coin-detail" data-pay_type="0" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>0,'promote_type'=>1,'promote_id'=>$data['p_id'],p=>1,row=>10]))}">
@ -232,6 +234,7 @@
</empty>
<tr class="data_summary">
<td colspan="2" style="text-align: center;">汇总:</td>
<td style="text-align: center;">---</td>
<td>{$all_count['cash_count']}</td>
<td>{$all_count['balance_coin_count']}</td>
<td>{$all_count['bind_coin_count']}</td>
@ -243,6 +246,10 @@
<a href="{:U('FinancePromote/promoteUser',array_merge(I('get.'),['p'=>1]))}">渠道查看</a>
</td>
</tr>
<tr class="data_summary">
<td style="text-align: center;">内外团占比:</td>
<td colspan="20" style="text-align: center;">内团充值金额占比:{$insideBelong}%&nbsp&nbsp&nbsp&nbsp外团充值金额占比:{$outBelong}%</td>
</tr>
</tbody>
</table>
</div>

@ -155,6 +155,7 @@
<tr>
<th>推广公司</th>
<th>推广员账号</th>
<th>内外团</th>
<th class="tooltip"><a class="paixu" data-order='cash_count'>
<if condition="$userarpu_order eq 4 and $userarpu_order_type eq 'cash_count'">游戏现金金额▲
@ -203,6 +204,7 @@
<tr>
<td>{$data.company_name}</td>
<td>{$data['promote_account']}</td>
<td>{$data['company_belong']}</td>
<td>{$data.cash_count}</td>
<td>{$data.balance_coin_count}</td>
@ -219,6 +221,7 @@
</empty>
<tr class="data_summary">
<td colspan="2" style="text-align: center;">汇总:</td>
<td style="text-align: center;">---</td>
<td>{$all_count['cash_count']}</td>
<td>{$all_count['balance_coin_count']}</td>
<td>{$all_count['bind_coin_count']}</td>

Loading…
Cancel
Save