优化游戏比例申请

master
chenzhi 3 years ago
parent c01b370405
commit 22619dff0c

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

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

@ -99,6 +99,13 @@ class MarketEvent extends Controller
$gid = M("auth_group_access")->where("uid = '{$uid}'")->getField('group_id'); $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(); 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 * $uid,$promote_id

Loading…
Cancel
Save