|
|
|
@ -78,6 +78,9 @@ class MarketEvent extends Controller
|
|
|
|
|
{
|
|
|
|
|
return $this->$key;
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* 获取等级名称
|
|
|
|
|
*/
|
|
|
|
|
public function getLevelName($level)
|
|
|
|
|
{
|
|
|
|
|
return $this->LevelConfig[$level];
|
|
|
|
@ -112,7 +115,64 @@ class MarketEvent extends Controller
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
$info = M('auth_group','sys_')->where(['id'=>$leader_group])->find();
|
|
|
|
|
return M('auth_group','sys_')->where(['id'=>$leader_group])->save(['data_president'=>$info['data_president'].",".$promote_id]);
|
|
|
|
|
$dataPresident = explode(',', $info['data_president']);
|
|
|
|
|
$dataPresident = array_unique(array_merge($dataPresident, array($promote_id)));
|
|
|
|
|
return $this->saveLeaderPresident($leader_group,$dataPresident);;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 移除原有权限
|
|
|
|
|
* @param [array] $promoteIds
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function removePresident($promoteIds)
|
|
|
|
|
{
|
|
|
|
|
if(!is_array($promoteIds)){
|
|
|
|
|
$promoteIds = explode(",",$promoteIds);
|
|
|
|
|
};
|
|
|
|
|
$leaderPresident = $this->getLeaderPresident();
|
|
|
|
|
foreach ($leaderPresident as $k => $v) {
|
|
|
|
|
$dataPresident = explode(',', $v);
|
|
|
|
|
$dataPresident = array_diff($dataPresident, $promoteIds);
|
|
|
|
|
$this->saveLeaderPresident($k,$dataPresident);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 添加原有权限,设计重复问题
|
|
|
|
|
* @param [array] $promoteIds
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
public function pushPresident($promoteIds)
|
|
|
|
|
{
|
|
|
|
|
if(!is_array($promoteIds)){
|
|
|
|
|
$promoteIds = explode(",",$promoteIds);
|
|
|
|
|
};
|
|
|
|
|
foreach ($promoteIds as $k => $v) {
|
|
|
|
|
$admin_id = M("Promote","tab_")->where("id = {$v}")->getField("admin_id");
|
|
|
|
|
$this->addPresident($admin_id,$v);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getLeaderPresident()
|
|
|
|
|
{
|
|
|
|
|
$where = [
|
|
|
|
|
"department_id"=>['in',$this->MarketDepartmentId],
|
|
|
|
|
"department_level"=>['eq',$this->DirectorLevel]
|
|
|
|
|
];
|
|
|
|
|
return M('auth_group','sys_')->where($where)->getField("id,data_president",true);
|
|
|
|
|
}
|
|
|
|
|
private function saveLeaderPresident($gid,$data_president)
|
|
|
|
|
{
|
|
|
|
|
if(is_array($data_president)){
|
|
|
|
|
$data_president = implode(",",$data_president);
|
|
|
|
|
};
|
|
|
|
|
$savedata = [
|
|
|
|
|
"id"=>$gid,
|
|
|
|
|
"data_president"=>$data_president
|
|
|
|
|
];
|
|
|
|
|
return M('auth_group','sys_')->save($savedata);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getDepartmentUserId($department_id)
|
|
|
|
|