diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index cbb65152c..f8d1e4282 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -59,120 +59,122 @@ class PromoteCompanyController extends ThinkController }else{ $companyres = $companyres->page($page,$row)->select(); } - //获取公司id - $companyids = implode(',', array_column($companyres, 'id')); - //获取所属会长及其游戏分成 - $promotemap['company_id']=["in",$companyids]; - $promotemap['level'] = 1; - - $promoteres = M("Promote","tab_") - ->field("id,company_id,account,settlement_type") - ->where($promotemap) - ->select(); - //获取会长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(); - $gameradiores = []; - //比例数据处理 - $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']; + if(1 == 0){ + //获取公司id + $companyids = implode(',', array_column($companyres, 'id')); + //获取所属会长及其游戏分成 + $promotemap['company_id']=["in",$companyids]; + $promotemap['level'] = 1; + + $promoteres = M("Promote","tab_") + ->field("id,company_id,account,settlement_type") + ->where($promotemap) + ->select(); + //获取会长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(); + //比例数据处理 + $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{ - $t['name']="月流水>".$va['turnover']; + $t['name']="月流水≥".$va['turnover']; } - }else{ - $t['name']="月流水≥".$va['turnover']; + $v['turnover_ratio'][]=$t; } - $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($v["ratio"]); - unset($v["relation_game_id"]); - unset($v["game_id"]); - $gameradiotemp[$v['promote_id']][]=$v; - } - unset($gameradiores); - //会长数据处理 - $promoterestemp=[]; - foreach($promoteres as $k=>$v){ - if(array_key_exists($v['id'],$gameradiotemp)){ - //存在 - $v['list'] = $gameradiotemp[$v['id']]; - foreach($gameradiotemp[$v['id']] as $ke=>$va){ - $v['row'] += $va['row']; + unset($gameradiores); + //会长数据处理 + $promoterestemp=[]; + foreach($promoteres as $k=>$v){ + if(array_key_exists($v['id'],$gameradiotemp)){ + //存在 + $v['list'] = $gameradiotemp[$v['id']]; + foreach($gameradiotemp[$v['id']] as $ke=>$va){ + $v['row'] += $va['row']; + } + }else{ + $v['list']=[ + ["relation_game_name"=>"--","game_type_name"=>"--", + "turnover_ratio"=>[ + ["name"=>"--","ratio"=>"--"] + ], + "row"=>1 + ] + ]; + $v["row"]=1; } - }else{ - $v['list']=[ - ["relation_game_name"=>"--","game_type_name"=>"--", - "turnover_ratio"=>[ - ["name"=>"--","ratio"=>"--"] - ], - "row"=>1 - ] - ]; - $v["row"]=1; - } - if($v['settlement_type'] == 1){ - $v['settlement_type']="周结"; - }else{ - $v['settlement_type']="月结"; + if($v['settlement_type'] == 1){ + $v['settlement_type']="周结"; + }else{ + $v['settlement_type']="月结"; + } + $promoterestemp[$v['company_id']]["list"][]=$v; } - $promoterestemp[$v['company_id']]["list"][]=$v; + unset($promoteres); + } - unset($promoteres); - //处理公司数据 + //处理公司数据 foreach($companyres as $k=>&$v){ - if(array_key_exists($v['id'],$promoterestemp)){ - //存在 - $v['list'] = $promoterestemp[$v['id']]['list']; - foreach($promoterestemp[$v['id']] as $ke=>$va){ - foreach($va as $key=>$val){ - $v['row'] += $val['row']; - } + // if(array_key_exists($v['id'],$promoterestemp)){ + // //存在 + // $v['list'] = $promoterestemp[$v['id']]['list']; + // foreach($promoterestemp[$v['id']] as $ke=>$va){ + // foreach($va as $key=>$val){ + // $v['row'] += $val['row']; + // } - } - $v['can_del'] = 0; - }else{ - //空值 - $v['can_del'] = 1; - $v['list']=[ - [ - "account"=>"--", - "settlement_type"=>"--", - 'list'=>[ - [ - "relation_game_name"=>"--", - "game_type_name"=>"--", - "turnover_ratio"=>[ - ["name"=>"--","ratio"=>"--"] - ], - "row"=>1 - ] - ] - ] - ]; - $v['row'] += 1; - } + // } + // $v['can_del'] = 0; + // }else{ + // //空值 + // $v['can_del'] = 1; + // $v['list']=[ + // [ + // "account"=>"--", + // "settlement_type"=>"--", + // 'list'=>[ + // [ + // "relation_game_name"=>"--", + // "game_type_name"=>"--", + // "turnover_ratio"=>[ + // ["name"=>"--","ratio"=>"--"] + // ], + // "row"=>1 + // ] + // ] + // ] + // ]; + // $v['row'] += 1; + // } if( $v["contact_begin"] >0 ){ $v["contact_begin"] = date('Y/m/d', $v["contact_begin"]); }else{ @@ -191,6 +193,7 @@ class PromoteCompanyController extends ThinkController $v["company_type"] = ($v["company_type"]=="1" ? "公司" :'个人'); $v["company_belong"] = ($v["company_belong"]=="0" ? "内团" : ($v["company_belong"]=="1" ? "外团" : ($v["company_belong"]=="2" ? "外团分发" : '无'))); } + // dd($companyres); diff --git a/Application/Admin/View/PromoteCompany/lists.html b/Application/Admin/View/PromoteCompany/lists.html index d2a55b961..5cc89f55e 100644 --- a/Application/Admin/View/PromoteCompany/lists.html +++ b/Application/Admin/View/PromoteCompany/lists.html @@ -125,12 +125,12 @@ 银行账号 是否签署合同 备注 - +