新增游戏搜索

master
chenzhi 4 years ago
parent d91d8346b9
commit a3f28b67a5

@ -2807,4 +2807,37 @@ function promote_listsMarket($type){
}
return $data;
}
}
//市场部获取公司或推广员id
function getMarketAuthPromoteId()
{
$map['level'] = 1;
if (isMarketLeader()) {
$map['admin_id'] = ['gt', 0];
}elseif(isMarketAdmin()){
$userAuth = session('user_auth');
$adminId = $userAuth['uid'];
$map['admin_id'] = $adminId;
}else{
return false;
}
$dbres = M("Promote","tab_")->where($map)->getField("id",true);
if(empty($dbres)){
return -1;
}else{
return implode(",",$dbres);
}
}
function throwPromoteIdToCompanyId($p_ids)
{
$map["id"]=["in","{$p_ids}"];
$dbres = M("Promote","tab_")->where($map)->group("company_id")->getField("company_id",true);
if(empty($dbres)){
return -1;
}else{
return implode(",",$dbres);
}
}

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

@ -75,7 +75,7 @@
</volist>
</select>
</div>
<div class="input-list input-list-channelstatus">
<div class="input-list input-list-channelstatus search_label_rehab">
<select name="company_belong" class="select_gallery">
<option value="">请选择团体类型</option>
<volist name=":getCompanyBlong()" id="vo">
@ -90,6 +90,16 @@
<option value="2" <?php echo I('company_type') == 2 ? "selected" : ''?>>个人</option>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="game_name" name="game_name" class="select_gallery" >
<option value="">游戏名称</option>
<volist name=":getAllGame()" id="vo">
<option value="{$vo.game_name}" <if condition="$vo.game_name eq I('game_name')">selected</if> >{$vo.game_name}</option>
</volist>
</select>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('PromoteCompany/lists','model='.$model['name'].'&row='.I('row'),false)}">搜索</a>

Loading…
Cancel
Save