|
|
|
@ -36,8 +36,60 @@ class PromoteCompanyController extends ThinkController
|
|
|
|
|
$row = empty($row) ? 10 : $row;//每页条数
|
|
|
|
|
|
|
|
|
|
//获取分页公司数据
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$companyres = $model->field("*")
|
|
|
|
|
->where($map)
|
|
|
|
|
->order("last_up_time desc")
|
|
|
|
|
// ->page($page,$row)
|
|
|
|
|
->select();
|
|
|
|
|
//获取公司id
|
|
|
|
|
$companyids = implode(',', array_column($companyres, 'id'));
|
|
|
|
|
//获取所属会长及其游戏分成
|
|
|
|
|
$promoteres = M("Promote","tab_")
|
|
|
|
|
->field("id,company_id,account,settlement_type")
|
|
|
|
|
->where(array(
|
|
|
|
|
"company_id"=>["in",$companyids]
|
|
|
|
|
))
|
|
|
|
|
->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'];
|
|
|
|
|
}
|
|
|
|
|
$v['turnover_ratio'][]=$t;
|
|
|
|
|
}
|
|
|
|
|
unset($v["ratio"]);
|
|
|
|
|
unset($v["relation_game_id"]);
|
|
|
|
|
unset($v["game_id"]);
|
|
|
|
|
$gameradiotemp[$v['promote_id']]["list"][]=$v;
|
|
|
|
|
}
|
|
|
|
|
dd($gameradiotemp);
|
|
|
|
|
/* 查询记录总数 */
|
|
|
|
|
$count = $model
|
|
|
|
|
->where($map)
|
|
|
|
|