master
ELF 5 years ago
parent b41705941f
commit 29e4b4e501

@ -250,7 +250,14 @@ class UserController extends AdminController {
if($password != $repassword){
$this->error('管理员密码和确认密码不一致!');
}
$usernameUser = M('UcenterMember', 'sys_')->field('username')->where(['username' => $username])->find();
if (!empty($usernameUser)) {
$this->error('用户名已存在!');
}
$emailUser = M('UcenterMember', 'sys_')->field('username')->where(['username' => $username])->find();
if (!empty($emailUser)) {
$this->error('邮箱已存在!');
}
/* 调用注册接口注册用户 */
$User = new UserApi;
$uid = $User->register($username, $password, $email,$second_pwd);

@ -102,7 +102,7 @@ class UcenterMemberModel extends Model{
* @param string $mobile 用户手机号码
* @return integer 注册成功-用户信息,注册失败-错误编号
*/
public function register($username, $password, $email,$second_pwd,$mobile){
public function register($username, $password, $email, $second_pwd,$mobile){
$data = array(
'username' => $username,
'password' => $password,
@ -110,11 +110,13 @@ class UcenterMemberModel extends Model{
'email' => $email,
'mobile' => $mobile,
);
//验证手机
if(empty($data['mobile'])) unset($data['mobile']);
/* 添加用户 */
if($data = $this->create($data)){
$data['username'] = $username;
$data['email'] = $email;
$status = M('UcenterMember', 'sys_')->data($data)->add();
$uid = 0;
if ($status) {

Loading…
Cancel
Save