提交 c173eba6 编写于 作者: 爱吃血肠's avatar 爱吃血肠

用户注册

上级 4ed048d3
...@@ -8,6 +8,9 @@ import org.slf4j.Logger; ...@@ -8,6 +8,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
...@@ -87,6 +90,7 @@ public class UserServiceImpl implements UserService { ...@@ -87,6 +90,7 @@ public class UserServiceImpl implements UserService {
* 处理用户注册 * 处理用户注册
* @param user * @param user
*/ */
@Transactional(propagation= Propagation.REQUIRED,isolation = Isolation.READ_COMMITTED,rollbackFor=Throwable.class)
@Override @Override
public void userRegister(User user, String code,HttpSession session) { public void userRegister(User user, String code,HttpSession session) {
try{ try{
...@@ -94,7 +98,7 @@ public class UserServiceImpl implements UserService { ...@@ -94,7 +98,7 @@ public class UserServiceImpl implements UserService {
if(!emailCode.equals(code)){ if(!emailCode.equals(code)){
throw new BizException("验证码错误"); throw new BizException("验证码错误");
} }
if(1 == userDao.insertTUser(user)){ if(1 != userDao.insertTUser(user)){
throw new Exception("插入数据影响函数不唯一"); throw new Exception("插入数据影响函数不唯一");
} }
}catch (BizException biz){ }catch (BizException biz){
......
...@@ -81,7 +81,7 @@ public class UserController { ...@@ -81,7 +81,7 @@ public class UserController {
} catch (Exception e) { } catch (Exception e) {
return new BaseResult<>(false, ResultEnum.INVALID_USER.getMsg()); return new BaseResult<>(false, ResultEnum.INVALID_USER.getMsg());
} }
return new BaseResult<>(true, "登陆成功"); return new BaseResult<>(true, "注册成功");
} }
/** /**
* 用户注册时获取邮箱验证码 * 用户注册时获取邮箱验证码
......
...@@ -93,11 +93,7 @@ function sure(){ ...@@ -93,11 +93,7 @@ function sure(){
dataType: "json", dataType: "json",
url: '/user/register', url: '/user/register',
success: function (data) { success: function (data) {
if (data.success) { window.location.href="/user/login";
} else {
}
} }
}); });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册