优化推广员公司列表

master
chenzhi 5 years ago
parent 5367ea4aae
commit 8c191c2f05

@ -1060,6 +1060,7 @@ class PromoteCompanyController extends ThinkController
} }
} }
} }
if(empty($game_arr)){ if(empty($game_arr)){
return $this->getPromoteGameRadio($company_id,$senddata); return $this->getPromoteGameRadio($company_id,$senddata);
} }
@ -1092,7 +1093,8 @@ class PromoteCompanyController extends ThinkController
} }
foreach($game_arr as $k=>$v){ foreach($game_arr as $k=>$v){
$senddata[$k]= ["turnover_ratio"=>[["name"=>"--","ratio"=>"--"]],"ratio"=>0,"relation_game_id"=>$k,"cp_ratio"=>[["name"=>"--","ratio"=>"--"]],"row"=>1,"relation_game_name"=>"--","game_type_name"=>"--"]; $senddata[$k]= ["turnover_ratio"=>[["name"=>"--","ratio"=>"--"]],"ratio"=>0,"relation_game_id"=>$k,"cp_ratio"=>[["name"=>"--","ratio"=>"--"]],"row"=>1];
$senddata[$k]+= $game[$k];;
} }
return $this->getPromoteGameRadio($company_id,$senddata); return $this->getPromoteGameRadio($company_id,$senddata);
} }
@ -1122,6 +1124,8 @@ class PromoteCompanyController extends ThinkController
}else{ }else{
$v['list'] = []; $v['list'] = [];
$v['row']=0; $v['row']=0;
$v['game_ids'] = $this->changeGameidToRelationGameid($v['game_ids']);
$game_arr = array_flip(explode(",",$v['game_ids'])); $game_arr = array_flip(explode(",",$v['game_ids']));
foreach($game_arr as $ke=>$va){ foreach($game_arr as $ke=>$va){
if(isset($ratio[$ke])){ if(isset($ratio[$ke])){
@ -1191,16 +1195,19 @@ class PromoteCompanyController extends ThinkController
} }
//获取游戏基础信息 //获取游戏基础信息
protected function getGameInfo($game_ids){ protected function getGameInfo($game_ids){
$gameinfo = []; $gameinfo = [];
$dbres = M("Game","tab_")->where("id in ($game_ids)")->field("relation_game_id,relation_game_name,game_type_name")->select(); $dbres = M("Game","tab_")->where("relation_game_id in ($game_ids)")->field("relation_game_id,relation_game_name,game_type_name")->group("relation_game_id")->select();
foreach($dbres as $k=>$v){ foreach($dbres as $k=>$v){
$gameinfo[$v['relation_game_id']] = $v; $gameinfo[$v['relation_game_id']] = $v;
} }
return $gameinfo; return $gameinfo;
} }
//无游戏id获取比例 //普通游戏id转唯一游戏id
protected function noGameidsGetPromote($company_id){ protected function changeGameidToRelationGameid($ids)
{
$rid = M('game', 'tab_')->field('relation_game_id')->where(["id"=>["in",$ids]])->group("relation_game_id")->select();
return implode(",",array_column($rid,'relation_game_id'));
} }

Loading…
Cancel
Save