From 38fc3c305435714c01fca0befb10e1c35c64d15b Mon Sep 17 00:00:00 2001 From: chenzhi Date: Thu, 13 Feb 2020 15:48:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=85=AC=E5=8F=B8=E5=88=97?= =?UTF-8?q?=E8=A1=A82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PromoteCompanyController.class.php | 56 ++++++++++++++++++- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 032e92db8..a38a750c4 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -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)