Merge branch 'master' of 8.136.139.249:wmtx/platform into feature/more_finance_20201211

master
chenzhi 4 years ago
commit 29636f2922

@ -3021,11 +3021,19 @@ function getMarketAuthPromoteId()
{ {
$map['level'] = 1; $map['level'] = 1;
if (isMarketLeader()) { if (isMarketLeader()) {
$map['admin_id'] = ['gt', 0]; //搜索所有市场部管理员id
$mid = M("AuthGroup")->where("title like '%市场%'")->getField("id",true);
$mid = implode(",",$mid);
$admin_id = M("AuthGroupAccess")->where("group_id in ({$mid})")->getField("uid",true);
$admin_id = implode(",",$admin_id);
$map['admin_id'] = ['in', $admin_id];
}elseif(isMarketAdmin()){ }elseif(isMarketAdmin()){
$userAuth = session('user_auth'); $userAuth = session('user_auth');
$adminId = $userAuth['uid']; $adminId = $userAuth['uid'];
$map['admin_id'] = $adminId; $map['admin_id'] = $adminId;
}else{ }else{
return false; return false;
} }
@ -3039,12 +3047,11 @@ function getMarketAuthPromoteId()
function throwPromoteIdToCompanyId($p_ids) function throwPromoteIdToCompanyId($p_ids)
{ {
$map["id"]=["in","{$p_ids}"]; $dbres = M("Promote","tab_")->where("id in ({$p_ids})")->field("count(*) count,company_id")->group("company_id")->select();
$dbres = M("Promote","tab_")->where($map)->group("company_id")->getField("company_id",true);
if(empty($dbres)){ if(empty($dbres)){
return -1; return -1;
}else{ }else{
return implode(",",$dbres); return implode(",",array_column($dbres,"company_id"));
} }
} }

@ -40,16 +40,20 @@ class PromoteCompanyController extends ThinkController
$is_export = true; $is_export = true;
$this->getAggregatePackage(); $this->getAggregatePackage();
} }
$map = []; $map = [
$promotemap=[]; "_string" => "1 = 1"
];
$promotemap=[
"_string" => "1 = 1"
];
$company_name = trim(I('company_name')); $company_name = trim(I('company_name'));
//市场部权限begin //市场部权限begin
$pro_id = getMarketAuthPromoteId(); $pro_id = getMarketAuthPromoteId();
if($pro_id){ if($pro_id){
$promotemap["_string"]="p.id in ({$pro_id})"; $promotemap["_string"] .=" AND p.id in ({$pro_id})";
$c_id = throwPromoteIdToCompanyId($pro_id); $c_id = throwPromoteIdToCompanyId($pro_id);
$map["_string"]="id in ({$c_id})"; $map["_string"] .=" AND id in ({$c_id})";
} }
//市场部权限end //市场部权限end
@ -74,11 +78,7 @@ class PromoteCompanyController extends ThinkController
$g_name = $_REQUEST['game_name']; $g_name = $_REQUEST['game_name'];
$g_id = M("Game","tab_")->where("relation_game_name = '{$g_name}'")->field("relation_game_id")->find()['relation_game_id']; $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 },"; // $reg_str = "([^0-9]|^){$g_id },";
if (isset($map["_string"])) { $map["_string"] .= ' AND concat(",", game_ids, ",") like "%,' . $g_id . ',%"';
$map['_string'] = ' AND concat(",", game_ids, ",") like "%,' . $g_id . ',%"';
}else{
$map["_string"] = ' concat(",", game_ids, ",") like "%,' . $g_id . ',%"';
}
// $map["game_ids"]=["EXP","REGEXP '{$reg_str}'"]; // $map["game_ids"]=["EXP","REGEXP '{$reg_str}'"];
} }
@ -93,11 +93,8 @@ class PromoteCompanyController extends ThinkController
$c_id = -1; $c_id = -1;
} }
$c_id = implode(",", $c_id); $c_id = implode(",", $c_id);
if(isset($map["_string"])){ $map["_string"] .= " AND id in ($c_id)";
$map["_string"] .= " ADN id in ($c_id)";
}else{
$map["_string"] = " id in ($c_id)";
}
} }

@ -397,7 +397,7 @@ class BaseController extends HomeController
// 推广公司 // 推广公司
$promoteCompanyService = new PromoteCompanyService(); $promoteCompanyService = new PromoteCompanyService();
$promoteCompany = $promoteCompanyService->getCompanies([$topPromote['company_id']]); $promoteCompany = $promoteCompanyService->getCompanies([$topPromote['company_id']]);
if ($promoteCompany[$topPromote['company_id']]['type'] == $promoteCompanyService::TYPE_CUSTOM) { // 特殊公司不能看 if ($promoteCompany[$topPromote['company_id']]['type'] == $promoteCompanyService::TYPE_CUSTOM && $promote['level'] == 4) { // 特殊公司不能看
return false; return false;
} }

@ -4,6 +4,7 @@
namespace Home\Controller; namespace Home\Controller;
use Base\Model\PromoteModel; use Base\Model\PromoteModel;
use Base\Service\PromoteCompanyService;
use Base\Service\PromoteService; use Base\Service\PromoteService;
use Base\Service\PromoteGradeService; use Base\Service\PromoteGradeService;
@ -14,7 +15,10 @@ class PromoteGradeController extends BaseController
parent::_initialize(); parent::_initialize();
$loginPromote = $this->getLoginPromote(); $loginPromote = $this->getLoginPromote();
if(C('APP_ENV') == 'dev' || in_array($loginPromote['company_id'], [334, 370])) { // 推广公司
$promoteCompanyService = new PromoteCompanyService();
$promoteCompany = $promoteCompanyService->getCompanies([$loginPromote['company_id']]);
if (C('APP_ENV') == 'dev' || $promoteCompany[$loginPromote['company_id']]['type'] == $promoteCompanyService::TYPE_CUSTOM) { // 特殊公司
} else { } else {
return $this->error('您没有权限'); return $this->error('您没有权限');

Loading…
Cancel
Save