优化添加会长

master
chenzhi 3 years ago
parent e97d763bc8
commit aae58f024b

@ -96,7 +96,24 @@ 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();
}
/**
* 添加部门总监的会长权限
* $uid,$promote_id
*/
public function addPresident($uid,$promote_id)
{
$leader_group = M("auth_group_access")
->alias("acc")
->where(['acc.uid'=>$uid])
->join("sys_auth_group as gro on acc.group_id = gro.id")
->join("sys_department as dep on gro.department_id = dep.id")
->getField("dep.leader_group",1);
if(!$leader_group){
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]);
}
public function getDepartmentUserId($department_id)
{

@ -1123,8 +1123,9 @@ class PromoteService {
// 如果是外团的,则自动加入市场总监审核列表
if ($data['level'] == 1 && in_array($data['company_belong'], [1, 2])) {
$id = M('promote', 'tab_')->getLastInsID();
$info = M('sys_auth_group')->where(['title'=>'市场总监'])->find();
M('sys_auth_group')->where(['title'=>'市场总监'])->save(['data_president'=>$info['data_president'].",".$id]);
A('Market','Event')->addPresident($data['admin_id'],$id);
// $info = M('sys_auth_group')->where(['title'=>'市场总监'])->find();
// M('sys_auth_group')->where(['title'=>'市场总监'])->save(['data_president'=>$info['data_president'].",".$id]);
resetUserAuth();
}

Loading…
Cancel
Save