@ -120,21 +120,6 @@ class FinancePromoteController extends AdminController
if(!array_key_exists('bind_coin_count',$v)) $v['bind_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('inside_cash_count',$v)) $v['inside_cash_count']=0;
$v['promote_account'] = get_promote_name($v['p_id']);
$v['promote_account'] = get_promote_name($v['p_id']);
if ($v['admin_id']) {
$v['admin_id'] = get_admin_account($v['admin_id']);
} else {
$v['admin_id'] = '无';
}
if ($v['develop_type'] == 1) {
$v['develop_type'] = '自主开发';
} elseif($v['develop_type'] == 2) {
$v['develop_type'] = '自主开发及维护';
} elseif($v['develop_type'] == 3) {
$v['develop_type'] = '只维护';
} else {
$v['develop_type'] = '未设定';
}
$v['inside_cash_count'] = number_format($v['inside_cash_count'],2,'.','');
$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,'.','');
$v['allcount'] = number_format($v['cash_count']-0+$v['balance_coin_count']+$v['bind_coin_count'],2,'.','');
@ -238,7 +223,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 = 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(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(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,admin_id,develop_type ";
IFNULL(company_id,0) company_id,company_name,IFNULL(promote.company_belong,0) company_belong";
return M()
return M()
->table("tab_spend s use index(promote_time)")
->table("tab_spend s use index(promote_time)")
->field($field)
->field($field)
@ -255,7 +240,7 @@ class FinancePromoteController extends AdminController
$map['s.source_id']=0;
$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)='',
$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,
s.promote_id,substring_index(substring_index(`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_id,0) company_id,company_name,IFNULL(promote.company_belong,0) company_belong,admin_id,develop_type ";
IFNULL(company_id,0) company_id,company_name,IFNULL(promote.company_belong,0) company_belong";
return M("promote_coin s","tab_")
return M("promote_coin s","tab_")
->field($field)
->field($field)
->where($map)
->where($map)