优化下游显示

master
chenzhi 4 years ago
parent 8c191c2f05
commit 6bb398bcc3

@ -6,6 +6,7 @@ use mysql_xdevapi\Exception;
use User\Api\UserApi as UserApi;
use OSS\OssClient;
use OSS\Core\OSsException;
use Base\Service\PresidentDepositService;
use Think\Controller;
/**
@ -67,7 +68,11 @@ class PromoteCompanyController extends ThinkController
//获取公司信息
if(!empty($companyres)){
foreach($companyres as $k=>&$v){
$tmpr = D("CompanyRelation")->getCompanyRelation(2,$value['id']);
$v["settlement_type"] = $tmpr['settlement_type'];
$v["company_belong"] = getCompanyBlong($v["company_belong"]);
$v["develop_type"] = getCompanyRelation($v["develop_type"]);
$v['company_type'] = $v['company_type'] == 2 ? '个人' : '公司';
//遍历获取游戏信息
if(empty($v["game_ids"])){
$game = $this->getPromoteGameRadio($v["id"],false);
@ -1100,32 +1105,49 @@ class PromoteCompanyController extends ThinkController
}
protected function getPromoteGameRadio($company_id,$ratio){
//获取会长信息
$payWays = PresidentDepositService::$payWays;
$payTypes = PresidentDepositService::$payTypes;
$statusList = PresidentDepositService::$statusList;
$rdata = [];
$promotemap['company_id']=$company_id;
$promotemap['level'] = 1;
$promotemap['p.company_id']=$company_id;
$promotemap['p.level'] = 1;
$company_row = 0;
$promoteres = M("Promote","tab_")
->field("id,company_id,account,game_ids")
->alias('p')
->field("p.id,p.company_id,p.account,p.game_ids,d.amount,IFNULL(d.pay_way,-1) pay_way,d.status,d.pay_type")
->join("tab_president_deposit as d ON p.id = d.promote_id")
->where($promotemap)
->select();
// dd($promoteres);
$adminList = getMarketAdminsByPromoteIds(array_column($promoteres, 'id'));
if(empty($promoteres)){
//无会长
return ["list"=>["account" => "--","list" => ["turnover_ratio"=>[["name"=>"--","ratio"=>"--"]],"ratio"=>0,"relation_game_id"=>$k,"cp_ratio"=>[["name"=>"--","ratio"=>"--"]],"row"=>1,"relation_game_name"=>"--","game_type_name"=>"--"]],"row"=>1];
return ["list"=>["account" => "--","list" => ["turnover_ratio"=>[["name"=>"--","ratio"=>"--"]],"ratio"=>0,"relation_game_id"=>$k,"cp_ratio"=>[["name"=>"--","ratio"=>"--"]],"row"=>1,"original_package_name"=>"--","relation_game_name"=>"--","game_type_name"=>"--"]],"row"=>1];
}
foreach ($promoteres as $k => &$v) {
$v['market_admin_username'] = isset($adminList[$v['id']]) && $adminList[$v['id']]['admin'] ? $adminList[$v['id']]['admin']['username'] : '无';
if($v['pay_way'] == -1){
$v['pay_way'] = "--";
$v['status'] = "--";
$v['pay_type']="--";
}else{
$v['status'] = $statusList[$v['status']] ?? '--';
$v['pay_type'] = $payTypes[$v['pay_type']] ?? '--';
$v['pay_way'] = $payWays[$v['pay_way']] ?? '--';
}
if($ratio == false || empty($v['game_ids'])){
$v['row']=1;
$v['list'] = ["turnover_ratio"=>[["name"=>"--","ratio"=>"--"]],"ratio"=>0,"relation_game_id"=>$k,"cp_ratio"=>[["name"=>"--","ratio"=>"--"]],"row"=>1,"relation_game_name"=>"--","game_type_name"=>"--"];
$v['list'] = ["turnover_ratio"=>[["name"=>"--","ratio"=>"--"]],"ratio"=>0,"relation_game_id"=>$k,"cp_ratio"=>[["name"=>"--","ratio"=>"--"]],"row"=>1,"original_package_name"=>"--","relation_game_name"=>"--","game_type_name"=>"--"];
$rdata[] = $v;
$company_row += $v['row'];
}else{
$v['list'] = [];
$v['row']=0;
$v['game_ids'] = $this->changeGameidToRelationGameid($v['game_ids']);
$game_arr = array_flip(explode(",",$v['game_ids']));
foreach($game_arr as $ke=>$va){
if(isset($ratio[$ke])){
@ -1136,6 +1158,7 @@ class PromoteCompanyController extends ThinkController
$rdata[] = $v;
$company_row += $v['row'];
}
// dd($v);
}
return ["list"=>$rdata,"row"=>$company_row];
}
@ -1197,7 +1220,7 @@ class PromoteCompanyController extends ThinkController
protected function getGameInfo($game_ids){
$gameinfo = [];
$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();
$dbres = M("Game","tab_")->where("relation_game_id in ($game_ids)")->field("relation_game_id,relation_game_name,game_type_name,original_package_name")->group("relation_game_id")->select();
foreach($dbres as $k=>$v){
$gameinfo[$v['relation_game_id']] = $v;
}

@ -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>
@ -150,42 +150,44 @@
<td rowspan="{$data.row}">{$data.company_name}</td>
<td rowspan="{$data.row}"><a class="ajax-view" data-id="{$data.id}">查看</a></td>
<td rowspan="{$data.row}">{$data.platform_name}</td>
<td rowspan="{$data.row}">{$data.platform_name|default="--"}</td>
<td rowspan="{$data.row}">{$data.company_belong}</td>
<td rowspan="{$data.row}">{$data.develop_type}</td>
<td rowspan="{$data.row}">{$data.uid}</td>
<td rowspan="{$data.row}">{$data.company_type}</td>
<td rowspan="{$data.row}">{$data.yj}</td>
<td rowspan="{$data.row}">{$data.jszq}</td>
<td rowspan="{$data.row}">{$data.settlement_type}</td>
<notempty name="data.list">
<td rowspan="{$data['list'][0]['row']}">{$data['list'][0]['account']}</td>
<td rowspan="{$data['list'][0]['row']}">{$data['list'][0]['account']|default="--"}</td>
<td rowspan="{$data['list'][0]['row']}">{$data['list'][0]['market_admin_username']|default="--"}</td>
<td rowspan="{$data['list'][0]['row']}">{$data['list'][0]['pay_type']|default="--"}</td>
<notempty name="data['list'][0]['list']">
<td rowspan="{$data['list'][0]['list'][0]['row']}">{$data['list'][0]['list'][0]['relation_game_name']}</td>
<td rowspan="{$data['list'][0]['list'][0]['row']}">{$data['list'][0]['list'][0]['relation_game_name']}</td>
<td rowspan="{$data['list'][0]['list'][0]['row']}">{$data['list'][0]['list'][0]['relation_game_name']}</td>
<td rowspan="{$data['list'][0]['list'][0]['row']}">{$data['list'][0]['list'][0]['original_package_name']|default="--"}</td>
<td rowspan="{$data['list'][0]['list'][0]['row']}">{$data['list'][0]['list'][0]['relation_game_name']|default="--"}</td>
<td rowspan="{$data['list'][0]['list'][0]['row']}">{$data['list'][0]['list'][0]['game_type_name']|default="--"}</td>
<notempty name="data['list'][0]['list'][0]['turnover_ratio']">
<td>{$data['list'][0]['list'][0]['turnover_ratio'][0]['name']}</td>
<td>{$data['list'][0]['list'][0]['turnover_ratio'][0]['ratio']}</td>
<td>{$data['list'][0]['list'][0]['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$data['list'][0]['list'][0]['turnover_ratio'][0]['ratio']|default="--"}</td>
<else />
<td >-</td>
<td>-</td>
<td >--</td>
<td>--</td>
</notempty>
<else />
<td >-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td >--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
</notempty>
<else />
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
</notempty>
@ -202,8 +204,8 @@
<foreach name="data['list'][0]['list'][0]['turnover_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']}</td>
<td>{$game_ratio['ratio']}%</td>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|default="--"}%</td>
</tr>
</if>
</foreach>
@ -216,14 +218,14 @@
<foreach name="data['list'][0]['list']" item="p_ratio" key="pkey">
<if condition="$pkey gt 0">
<tr>
<td rowspan="{$p_ratio['row']}">{$p_ratio['relation_game_name']}</td>
<td rowspan="{$p_ratio['row']}">{$p_ratio['relation_game_name']}</td>
<td rowspan="{$p_ratio['row']}">{$p_ratio['relation_game_name']}</td>
<td rowspan="{$p_ratio['row']}">{$p_ratio['original_package_name']|default="--"}</td>
<td rowspan="{$p_ratio['row']}">{$p_ratio['relation_game_name']|default="--"}</td>
<td rowspan="{$p_ratio['row']}">{$p_ratio['game_type_name']|default="--"}</td>
<notempty name="p_ratio['turnover_ratio']">
<td>{$p_ratio['turnover_ratio'][0]['name']}</td>
<td>{$p_ratio['turnover_ratio'][0]['ratio']}</td>
<td>{$p_ratio['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$p_ratio['turnover_ratio'][0]['ratio']|default="--"}</td>
<else />
<td >-</td>
<td>-</td>
@ -234,8 +236,8 @@
<foreach name="p_ratio['turnover_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td artt= '2'>{$game_ratio['name']}</td>
<td>{$game_ratio['ratio']}%</td>
<td artt= '2'>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|default="--"}%</td>
</tr>
</if>
</foreach>
@ -248,25 +250,28 @@
<foreach name="data['list']" item="promote" key="promotekey">
<if condition="$promotekey gt 0">
<tr>
<td rowspan="{$promote['row']}">{$promote['account']}</td>
<td rowspan="{$promote['row']}">{$promote['account']|default="--"}</td>
<td rowspan="{$promote['row']}">{$promote['market_admin_username']|default="--"}</td>
<td rowspan="{$promote['row']}">{$promote['pay_type']|default="--"}</td>
<notempty name="promote['list']">
<td rowspan="{$promote['list']['row']}">{$promote['list']['relation_game_name']}</td>
<td rowspan="{$promote['list']['row']}">{$promote['list']['relation_game_name']}</td>
<td rowspan="{$promote['list']['row']}">{$promote['list']['relation_game_name']}</td>
<td rowspan="{$promote['list']['row']}">{$promote['list']['original_package_name']|default="--"}</td>
<td rowspan="{$promote['list']['row']}">{$promote['list']['relation_game_name']|default="--"}</td>
<td rowspan="{$promote['list']['row']}">{$promote['list']['game_type_name']|default="--"}</td>
<notempty name="$promote['list']['turnover_ratio']">
<td>{$promote['list']['turnover_ratio'][0]['name']}</td>
<td>{$promote['list']['turnover_ratio'][0]['ratio']}</td>
<td>{$promote['list']['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$promote['list']['turnover_ratio'][0]['ratio']|default="--"}</td>
<else />
<td >-</td>
<td>-</td>
<td >--</td>
<td>--</td>
</notempty>
<else />
<td >-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td >--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
</notempty>
</tr>
</if>

Loading…
Cancel
Save