|
|
|
@ -33,15 +33,24 @@ class PromoteCompanyController extends ThinkController
|
|
|
|
|
$map = [];
|
|
|
|
|
$promotemap=[];
|
|
|
|
|
$company_name = trim(I('company_name'));
|
|
|
|
|
|
|
|
|
|
//市场部权限begin
|
|
|
|
|
$pro_id = getMarketAuthPromoteId();
|
|
|
|
|
if($pro_id){
|
|
|
|
|
$promotemap["_string"]="p.id in ({$pro_id})";
|
|
|
|
|
$c_id = throwPromoteIdToCompanyId($pro_id);
|
|
|
|
|
$map["_string"]="id in ({$c_id})";
|
|
|
|
|
}
|
|
|
|
|
//市场部权限end
|
|
|
|
|
|
|
|
|
|
if($company_name) $map['tab_promote_company.company_name'] = array('like',"%{$company_name}%");
|
|
|
|
|
if (isset($_REQUEST['status']) && $_REQUEST['status'] !== '') {
|
|
|
|
|
$status = intval($_REQUEST['status']);
|
|
|
|
|
$map['tab_promote_company.status'] = $status;
|
|
|
|
|
$parameter['status'] = $status;
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['promote_id'])) {
|
|
|
|
|
$map['id'] = M("Promote","tab_")->field("company_id")->where("id={$_REQUEST['promote_id']}")->find()['company_id'];
|
|
|
|
|
$promotemap['id']=$_REQUEST['promote_id'];
|
|
|
|
|
$promotemap['p.id']=$_REQUEST['promote_id'];
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['company_type'])) {
|
|
|
|
|
$map['company_type'] = $_REQUEST['company_type'];
|
|
|
|
@ -49,6 +58,13 @@ class PromoteCompanyController extends ThinkController
|
|
|
|
|
if (isset($_REQUEST['company_belong'])) {
|
|
|
|
|
$map['company_belong'] = $_REQUEST['company_belong'];
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['game_name'])) {
|
|
|
|
|
//换成id
|
|
|
|
|
$g_name = $_REQUEST['game_name'];
|
|
|
|
|
$g_id = M("Game","tab_")->where("relation_game_name = '{$g_name}'")->field("relation_game_id")->find()['relation_game_id'];
|
|
|
|
|
$reg_str = "([^0-9]|^){$g_id },";
|
|
|
|
|
$map["game_ids"]=["EXP","REGEXP '{$reg_str}'"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$page = intval(I('get.p', 0));
|
|
|
|
@ -92,10 +108,14 @@ class PromoteCompanyController extends ThinkController
|
|
|
|
|
$v['validity_time'] = $validity_start_time . '-' . $validity_end_time;
|
|
|
|
|
//遍历获取游戏信息
|
|
|
|
|
if(empty($v["game_ids"])){
|
|
|
|
|
$game = $this->getPromoteGameRadio($v["id"],false);
|
|
|
|
|
$senddata=false;
|
|
|
|
|
}else{
|
|
|
|
|
$game = $this->getGamePromoteCompanyRadio($v["id"],$v["game_ids"],$is_export);
|
|
|
|
|
if(isset($_REQUEST['game_name'])) {
|
|
|
|
|
$v["game_ids"] = $g_id;
|
|
|
|
|
}
|
|
|
|
|
$senddata = $this->getGamePromoteCompanyRadio($v["id"],$v["game_ids"],$is_export);
|
|
|
|
|
}
|
|
|
|
|
$game = $this->getPromoteGameRadio($v["id"],$senddata,$promotemap);
|
|
|
|
|
$v += $game;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -104,9 +124,9 @@ class PromoteCompanyController extends ThinkController
|
|
|
|
|
$companycount = $model->field("id")->where($map)->select();
|
|
|
|
|
$count = count($companycount);
|
|
|
|
|
$companyallids = implode(',', array_column($companycount, 'id'));
|
|
|
|
|
$promotemap['company_id']=["in",$companyallids];
|
|
|
|
|
$promotemap['level']=1;
|
|
|
|
|
$promotecount = M("Promote","tab_")->where($promotemap)->count();
|
|
|
|
|
$promotemap['p.company_id']=["in",$companyallids];
|
|
|
|
|
$promotemap['p.level']=1;
|
|
|
|
|
$promotecount = M("Promote","tab_")->alias('p')->where($promotemap)->count();
|
|
|
|
|
// dd($companyres);
|
|
|
|
|
$this->assign('listData', $companyres);
|
|
|
|
|
$this->assign('count', $count);
|
|
|
|
@ -1094,7 +1114,7 @@ class PromoteCompanyController extends ThinkController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(empty($game_arr)){
|
|
|
|
|
return $this->getPromoteGameRadio($company_id,$senddata);
|
|
|
|
|
return $senddata;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$diff_ids = implode(",",array_keys($game_arr));
|
|
|
|
@ -1130,16 +1150,16 @@ class PromoteCompanyController extends ThinkController
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(empty($game_arr)){
|
|
|
|
|
return $this->getPromoteGameRadio($company_id,$senddata);
|
|
|
|
|
return $senddata;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach($game_arr as $k=>$v){
|
|
|
|
|
$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 $senddata;
|
|
|
|
|
}
|
|
|
|
|
protected function getPromoteGameRadio($company_id,$ratio){
|
|
|
|
|
protected function getPromoteGameRadio($company_id,$ratio,$p_map = false){
|
|
|
|
|
//获取会长信息
|
|
|
|
|
$payWays = PresidentDepositService::$payWays;
|
|
|
|
|
$payTypes = PresidentDepositService::$payTypes;
|
|
|
|
@ -1148,6 +1168,9 @@ class PromoteCompanyController extends ThinkController
|
|
|
|
|
$rdata = [];
|
|
|
|
|
$promotemap['p.company_id']=$company_id;
|
|
|
|
|
$promotemap['p.level'] = 1;
|
|
|
|
|
if($p_map){
|
|
|
|
|
$promotemap += $p_map;//外界条件
|
|
|
|
|
}
|
|
|
|
|
$company_row = 0;
|
|
|
|
|
|
|
|
|
|
$promoteres = M("Promote","tab_")
|
|
|
|
@ -1191,6 +1214,7 @@ class PromoteCompanyController extends ThinkController
|
|
|
|
|
$v['row'] += $ratio[$ke]["row"];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if($v['row'] == 0) $v['row']=1;
|
|
|
|
|
$rdata[] = $v;
|
|
|
|
|
$company_row += $v['row'];
|
|
|
|
|
}
|
|
|
|
|