Merge branch 'feature/platfrom_aggregate_finance' of wmtx/platform into release

隐藏推广公司比例
master
廖金灵 5 years ago committed by Gogs
commit 65d746c75f

@ -141,10 +141,10 @@ class FinancePromoteController extends AdminController
if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0; 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('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'] = $v['p_id'] == 0 ? '官方渠道' : ($promote ? $promote['account'] : ''); $v['promote_account'] = get_promote_name($v['p_id']);
($v['promote_account']=='官方渠道')?($v['promote_account']=C('OFFICIEL_CHANNEL')):'';
$v['admin_username'] = $adminUsernames[$promote['admin_id']] ?? '无'; $v['admin_username'] = $adminUsernames[$promote['admin_id']] ?? '无';
$v['develop_type_text'] = getCompanyDevelopTypeText($v['develop_type']); $v['develop_type_text'] = getCompanyDevelopTypeText($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,'.','');
$count['cash_count'] += $v['cash_count']; $count['cash_count'] += $v['cash_count'];

@ -59,119 +59,122 @@ class PromoteCompanyController extends ThinkController
}else{ }else{
$companyres = $companyres->page($page,$row)->select(); $companyres = $companyres->page($page,$row)->select();
} }
//获取公司id if(1 == 0){
$companyids = implode(',', array_column($companyres, 'id')); //获取公司id
//获取所属会长及其游戏分成 $companyids = implode(',', array_column($companyres, 'id'));
$promotemap['company_id']=["in",$companyids]; //获取所属会长及其游戏分成
$promotemap['level'] = 1; $promotemap['company_id']=["in",$companyids];
$promotemap['level'] = 1;
$promoteres = M("Promote","tab_")
->field("id,company_id,account,settlement_type") $promoteres = M("Promote","tab_")
->where($promotemap) ->field("id,company_id,account,settlement_type")
->select(); ->where($promotemap)
//获取会长id
$promoteids = implode(',', array_column($promoteres, 'id'));
//获取游戏比例
$gameradiores = M("PromoteGameRatio","tab_")
->alias("pg")
->field("pg.ratio,pg.relation_game_id,pg.turnover_ratio,pg.game_id,pg.promote_id,ga.relation_game_name,ga.game_type_name")
->join("tab_game ga ON pg.game_id = ga.id")
->where(array(
"status"=>1,
"promote_id"=>["in",$promoteids]
))
->group("relation_game_id,promote_id")
->select(); ->select();
//比例数据处理 //获取会长id
$gameradiotemp = array(); $promoteids = implode(',', array_column($promoteres, 'id'));
foreach($gameradiores as $k=>$v){ //获取游戏比例
$turnover_ratio = json_decode($v['turnover_ratio'],true); $gameradiores = M("PromoteGameRatio","tab_")
$v['turnover_ratio'] = array( ->alias("pg")
array("ratio"=>$v['ratio']."%","name"=>"默认比例") ->field("pg.ratio,pg.relation_game_id,pg.turnover_ratio,pg.game_id,pg.promote_id,ga.relation_game_name,ga.game_type_name")
); ->join("tab_game ga ON pg.game_id = ga.id")
->where(array(
foreach($turnover_ratio as $ke=>$va){ "status"=>1,
$t=array("ratio"=>$va["ratio"]."%"); "promote_id"=>["in",$promoteids]
if(array_key_exists("instanceof",$va)){ ))
//存在 ->group("relation_game_id,promote_id")
if($va['instanceof']=='1'){ ->select();
$t['name']="月流水≥".$va['turnover']; //比例数据处理
$gameradiotemp = array();
foreach($gameradiores as $k=>$v){
$turnover_ratio = json_decode($v['turnover_ratio'],true);
$v['turnover_ratio'] = array(
array("ratio"=>$v['ratio']."%","name"=>"默认比例")
);
foreach($turnover_ratio as $ke=>$va){
$t=array("ratio"=>$va["ratio"]."%");
if(array_key_exists("instanceof",$va)){
//存在
if($va['instanceof']=='1'){
$t['name']="月流水≥".$va['turnover'];
}else{
$t['name']="月流水>".$va['turnover'];
}
}else{ }else{
$t['name']="月流水>".$va['turnover']; $t['name']="月流水".$va['turnover'];
} }
}else{ $v['turnover_ratio'][]=$t;
$t['name']="月流水≥".$va['turnover'];
} }
$v['turnover_ratio'][]=$t; $v['row'] = count($v['turnover_ratio']);
unset($v["ratio"]);
unset($v["relation_game_id"]);
unset($v["game_id"]);
$gameradiotemp[$v['promote_id']][]=$v;
} }
$v['row'] = count($v['turnover_ratio']); unset($gameradiores);
unset($v["ratio"]); //会长数据处理
unset($v["relation_game_id"]); $promoterestemp=[];
unset($v["game_id"]); foreach($promoteres as $k=>$v){
$gameradiotemp[$v['promote_id']][]=$v; if(array_key_exists($v['id'],$gameradiotemp)){
} //存在
unset($gameradiores); $v['list'] = $gameradiotemp[$v['id']];
//会长数据处理 foreach($gameradiotemp[$v['id']] as $ke=>$va){
$promoterestemp=[]; $v['row'] += $va['row'];
foreach($promoteres as $k=>$v){ }
if(array_key_exists($v['id'],$gameradiotemp)){ }else{
//存在 $v['list']=[
$v['list'] = $gameradiotemp[$v['id']]; ["relation_game_name"=>"--","game_type_name"=>"--",
foreach($gameradiotemp[$v['id']] as $ke=>$va){ "turnover_ratio"=>[
$v['row'] += $va['row']; ["name"=>"--","ratio"=>"--"]
],
"row"=>1
]
];
$v["row"]=1;
} }
}else{ if($v['settlement_type'] == 1){
$v['list']=[ $v['settlement_type']="周结";
["relation_game_name"=>"--","game_type_name"=>"--", }else{
"turnover_ratio"=>[ $v['settlement_type']="月结";
["name"=>"--","ratio"=>"--"] }
], $promoterestemp[$v['company_id']]["list"][]=$v;
"row"=>1
]
];
$v["row"]=1;
}
if($v['settlement_type'] == 1){
$v['settlement_type']="周结";
}else{
$v['settlement_type']="月结";
} }
$promoterestemp[$v['company_id']]["list"][]=$v; unset($promoteres);
} }
unset($promoteres); //处理公司数据
//处理公司数据
foreach($companyres as $k=>&$v){ foreach($companyres as $k=>&$v){
if(array_key_exists($v['id'],$promoterestemp)){ // if(array_key_exists($v['id'],$promoterestemp)){
//存在 // //存在
$v['list'] = $promoterestemp[$v['id']]['list']; // $v['list'] = $promoterestemp[$v['id']]['list'];
foreach($promoterestemp[$v['id']] as $ke=>$va){ // foreach($promoterestemp[$v['id']] as $ke=>$va){
foreach($va as $key=>$val){ // foreach($va as $key=>$val){
$v['row'] += $val['row']; // $v['row'] += $val['row'];
} // }
} // }
$v['can_del'] = 0; // $v['can_del'] = 0;
}else{ // }else{
//空值 // //空值
$v['can_del'] = 1; // $v['can_del'] = 1;
$v['list']=[ // $v['list']=[
[ // [
"account"=>"--", // "account"=>"--",
"settlement_type"=>"--", // "settlement_type"=>"--",
'list'=>[ // 'list'=>[
[ // [
"relation_game_name"=>"--", // "relation_game_name"=>"--",
"game_type_name"=>"--", // "game_type_name"=>"--",
"turnover_ratio"=>[ // "turnover_ratio"=>[
["name"=>"--","ratio"=>"--"] // ["name"=>"--","ratio"=>"--"]
], // ],
"row"=>1 // "row"=>1
] // ]
] // ]
] // ]
]; // ];
$v['row'] += 1; // $v['row'] += 1;
} // }
if( $v["contact_begin"] >0 ){ if( $v["contact_begin"] >0 ){
$v["contact_begin"] = date('Y/m/d', $v["contact_begin"]); $v["contact_begin"] = date('Y/m/d', $v["contact_begin"]);
}else{ }else{
@ -190,6 +193,7 @@ class PromoteCompanyController extends ThinkController
$v["company_type"] = ($v["company_type"]=="1" ? "公司" :'个人'); $v["company_type"] = ($v["company_type"]=="1" ? "公司" :'个人');
$v["company_belong"] = ($v["company_belong"]=="0" ? "内团" : ($v["company_belong"]=="1" ? "外团" : ($v["company_belong"]=="2" ? "外团分发" : '无'))); $v["company_belong"] = ($v["company_belong"]=="0" ? "内团" : ($v["company_belong"]=="1" ? "外团" : ($v["company_belong"]=="2" ? "外团分发" : '无')));
} }
// dd($companyres); // dd($companyres);

@ -464,7 +464,7 @@ class PromoteModel extends Model{
$userAuth = session('user_auth'); $userAuth = session('user_auth');
setPowerPromoteIds($where,'id'); setPowerPromoteIds($where,'id');
$offcialData = [0=>['id'=>0,'nickname'=>'官方渠道']]; $offcialData = [0=>['id'=>0,'nickname'=>'江息网络']];
$result = $this->field("*")->where($where)->select(); $result = $this->field("*")->where($where)->select();
foreach ($result as &$item) { foreach ($result as &$item) {

@ -125,12 +125,12 @@
<th>银行账号</th> <th>银行账号</th>
<th>是否签署合同</th> <th>是否签署合同</th>
<th>备注</th> <th>备注</th>
<!--
<th>会长账号</th> <th>会长账号</th>
<th>结算周期</th> <th>结算周期</th>
<th>产品类型</th> <th>产品类型</th>
<th>游戏名称</th> <th>游戏名称</th>
<th colspan="2">合作方分成比例</th> <th colspan="2">合作方分成比例</th> -->
</tr> </tr>
</thead> </thead>

Loading…
Cancel
Save