优化管理员添加

master
chenzhi 4 years ago
parent bea2fa7003
commit 6c9ae2332b

@ -160,7 +160,7 @@ function get_marking($id)
return $game['marking'];
}
function get_auth_group_name($uid){
$model = D("auth_group_access");
$model = SM("auth_group_access");
$res = $model->join("sys_auth_group on sys_auth_group.id = sys_auth_group_access.group_id")
->field("title")
->where("uid=".$uid)

@ -120,6 +120,7 @@ return array(
"sys_auth_group_access",
"sys_ucenter_member",
"sys_menu",
"sys_member",
'sys_auth_rule',
"sys_action_log",

@ -42,7 +42,7 @@ class UserController extends AdminController
$map['nickname'] = array('like', '%' . (string)$nickname . '%');
}
$list = $this->lists('Member', $map);
$list = $this->lists('Member', $map,"uid desc",true,true);
int_to_string($list);
$this->checkListOrCountAuthRestMap($map,[]);
@ -282,16 +282,16 @@ class UserController extends AdminController
if ($password != $repassword) {
$this->error('管理员密码和确认密码不一致!');
}
$usernameUser = M('UcenterMember', 'sys_')->field('username')->where(['username' => $username])->find();
$usernameUser = SM('UcenterMember', 'sys_')->field('username')->where(['username' => $username])->find();
if (!empty($usernameUser)) {
$this->error('用户名已存在!');
}
$emailUser = M('UcenterMember', 'sys_')->field('id')->where(['email' => $email])->find();
$emailUser = SM('UcenterMember', 'sys_')->field('id')->where(['email' => $email])->find();
if (!empty($emailUser)) {
$this->error('邮箱已存在!');
}
$moblieUser = M('UcenterMember', 'sys_')->field('id')->where(['mobile' => $_POST['mobile']])->find();
$moblieUser = SM('UcenterMember', 'sys_')->field('id')->where(['mobile' => $_POST['mobile']])->find();
if (!empty($moblieUser)) {
$this->error('手机号码已存在!');
@ -304,8 +304,8 @@ class UserController extends AdminController
$user = array('uid' => $uid,'real_name'=>$real_name, 'nickname' => $username, 'status' => 1,"birthday"=>date('Y-m-d',time()));
$data['uid'] = $uid;
$data['group_id'] = I('auth');
M('auth_group_access')->data($data)->add();
if (!M('Member')->add($user)) {
SM('auth_group_access')->data($data)->add();
if (!SM('Member')->add($user)) {
$this->error('用户添加失败!');
} else {
//操作日志
@ -322,7 +322,7 @@ class UserController extends AdminController
$this->error($this->showRegError($uid));
}
} else {
$list = D('AuthGroup')->where(array('status' => 1))->select();
$list = SM('AuthGroup')->where(array('status' => 1))->select();
$this->assign('lists', $list);
$this->meta_title = '新增管理员';
@ -502,7 +502,6 @@ class UserController extends AdminController
$this->assign("authid", $au["group_id"]);
$this->assign("houtai", $au["houtai"]);
$list = D('AuthGroup')->where(array('status' => 1))->select();
dd(D('AuthGroup'));
$username = $_POST['username'];
$password = $_POST['password'];
$this->assign('lists', $list);

Loading…
Cancel
Save