工会统计列表数据与搜索修复

master
liuweiwen 5 years ago
parent b3e32506cc
commit 28a1efe2f4

@ -41,7 +41,6 @@ class FinancePromoteController extends AdminController
$senddata = [];
//获取各会长的充值方式
$cash = self::getJoinPromoteData([],$istimeselect);
foreach($cash as $k=>$v){
$senddata[$v['p_id']] = $v;
}
@ -57,6 +56,26 @@ class FinancePromoteController extends AdminController
$senddata[$v['p_id']] = $v;
};
}
//官方渠道单算
//判断公司
$gfflah = false;
if (isset($_REQUEST['company_id']) && $_REQUEST['company_id']==0) {
$gfflah = true;
}
if (isset($_REQUEST['promote_id'])) {
if($_REQUEST['promote_id'] == 0){
$gfflah = true;
}else{
$gfflah =false;
}
}
if($gfflah){
//计算官方渠道
unset($_REQUEST['company_id']);
$_REQUEST['promote_id'] = 0;
$gfcash = self::getJoinPromoteData([],$istimeselect);
$senddata[0] = $gfcash[0];
}
if(!empty($senddata)){
if(array_key_exists(0,$senddata) || $_REQUEST['promote_id']==0){
@ -138,6 +157,7 @@ class FinancePromoteController extends AdminController
}
if (isset($_REQUEST['company_id'])) {
$map['promote.company_id'] = $_REQUEST['company_id'];
}
if($type == "spend"){
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
@ -167,11 +187,14 @@ 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(if(substring_index(substring_index(`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(`chain`,'/',2),'/',-1)),0) p_id";
$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";
return M("promote_coin s","tab_")
->field($field)
->where($map)
->join("tab_promote promote ON s.promote_id = promote.id","left")
->join("tab_promote_company company ON promote.company_id = company.id","left")
->group('p_id')
->select();
}
@ -208,13 +231,14 @@ class FinancePromoteController extends AdminController
$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'];
$senddata[$v['promote_id']]['inside_cash_count']= $v['pay_amount']-$v['back_amount'];
}else{
$v['inside_cash_count'] = $v['pay_amount'];
$v['inside_cash_count'] = $v['pay_amount']-$v['back_amount'];
unset($v['pay_amount']);
$senddata[$v['promote_id']] = $v;
};
}
if(!empty($senddata)){
if(array_key_exists(0,$senddata) || $_REQUEST['promote_id']==0){
$pmap['status']=1;
if($istimeselect){
@ -226,6 +250,7 @@ class FinancePromoteController extends AdminController
}
}
}
$count = count($senddata);
if ($_REQUEST['data_order'] != '') {
$data_order = reset(explode(',', $_REQUEST['data_order']));
@ -325,12 +350,13 @@ class FinancePromoteController extends AdminController
}
$map['s.status']=1;
$map['s.source_id']=0;
$map['s.type']=1;
$field= "sum(num) pay_amount,promote_id";
$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";
return M("promote_coin s","tab_")
->field($field)
->where($map)
->join("tab_promote promote ON s.promote_id = promote.id","left")
->join("tab_promote_company company ON promote.company_id = company.id", "left")
->group('promote_id')
->select();
}

Loading…
Cancel
Save