优化游戏比例申请

master
chenzhi 3 years ago
parent c01b370405
commit 22619dff0c

@ -6,6 +6,7 @@ class CompanyGameRatioController extends AdminController
{
public $admininfo;
public $DBModel;
public $MarketEvent;
public $OpAuthList=[];
public $Status = [
"-2"=>"管理员拒绝",
@ -24,6 +25,7 @@ class CompanyGameRatioController extends AdminController
{
$this->admininfo = $_SESSION['onethink_admin']['user_auth'];
$this->DBModel = M("company_game_ratio","tab_");
$this->MarketEvent = A("Market","Event");
parent::_initialize();
}
@ -78,18 +80,16 @@ class CompanyGameRatioController extends AdminController
}
}
}
$isMarketAdmin = isMarketAdmin();
if($isMarketAdmin) {
$userAuth = session('user_auth');
$adminId = $userAuth['uid'];
$companyIds = M('promote', 'tab_')->where(['admin_id' => $adminId, 'level' => 1])->getField('company_id', true);
$companyIds = array_unique($companyIds);
$marketCondition = '';
if (count($companyIds) > 0) {
$marketCondition = 'm.company_id in(' . implode(',', $companyIds) . ')';
} else {
$marketCondition = '1<>1';
$gid = session('user_group_id');
$markerGroup = $this->MarketEvent->isMarketAdminGroup($gid);
if($markerGroup){
$companyIds = $this->MarketEvent->getAdminCompanyId();
//取消0
$companyIds = implode(",",array_diff(explode(",",$companyIds),[0]));
$marketCondition = 'm.company_id in(' . $companyIds . ')';
if($markerGroup['department_level'] == $this->MarketEvent->getConfig("DirectorLevel")){
//总监
$marketCondition .= " OR (m.company_id = 0 AND m.company_belong != 0 )";
}
$where['_string'] = isset($where['_string']) ? $where['_string'] . ' and ' . $marketCondition : $marketCondition;
}
@ -265,6 +265,22 @@ class CompanyGameRatioController extends AdminController
}
}
$gid = session('user_group_id');
$markerGroup = $this->MarketEvent->isMarketAdminGroup($gid);
if($markerGroup){
$companyIds = $this->MarketEvent->getAdminCompanyId();
//取消0
$companyIds = implode(",",array_diff(explode(",",$companyIds),[0]));
$marketCondition = 'm.company_id in(' . $companyIds . ')';
if($markerGroup['department_level'] == $this->MarketEvent->getConfig("DirectorLevel")){
//总监
$marketCondition .= " OR (m.company_id = 0 AND m.company_belong != 0 )";
}
$where['_string'] = isset($where['_string']) ? $where['_string'] . ' and ' . $marketCondition : $marketCondition;
}
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$time_start = strtotime($_REQUEST['time_start']);
$time_end = strtotime($_REQUEST['time_end'])+ 86399;

@ -58,6 +58,7 @@ class OldCountController extends \Think\Controller
// 'id'=>1,
// 'name'=>'市场一部',
// 'group_ids'=>'11,12,14,21,25',
// 'leader_group'=>'14',
// 'create_time'=>time(),
// 'update_time'=>time()
// ]);
@ -65,6 +66,7 @@ class OldCountController extends \Think\Controller
// 'id'=>2,
// 'name'=>'市场二部',
// 'group_ids'=>'26,27,28,29,30',
// 'leader_group'=>'28',
// 'create_time'=>time(),
// 'update_time'=>time()
// ]);

@ -99,6 +99,13 @@ class MarketEvent extends Controller
$gid = M("auth_group_access")->where("uid = '{$uid}'")->getField('group_id');
return M('department','sys_')->where("id = '{$department_id}' and leader_group = '$gid'")->field("id")->find();
}
public function isMarketLeder($uid)
{
$gid = M("auth_group_access")->where("uid = '{$uid}'")->getField('group_id');
return M("auth_group")->where("id = '{$gid}' and department_level = '{$this->DirectorLevel}'")->field("id")->find();
}
/**
* 添加部门总监的会长权限
* $uid,$promote_id

Loading…
Cancel
Save