@ -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;
}