出来登录问题
This commit is contained in:
parent
2166e40352
commit
5eb9a04d6d
|
|
@ -1,6 +1,7 @@
|
||||||
package com.mdd.common.exception;
|
package com.mdd.common.exception;
|
||||||
|
|
||||||
import com.mdd.common.enums.HttpEnum;
|
import com.mdd.common.enums.HttpEnum;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作系统异常
|
* 操作系统异常
|
||||||
|
|
@ -11,4 +12,7 @@ public class OperateException extends BaseException {
|
||||||
super(HttpEnum.FAILED.getCode(), msg);
|
super(HttpEnum.FAILED.getCode(), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OperateException(String msg, Integer errCode) {
|
||||||
|
super(errCode, msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.mdd.front.controller;
|
||||||
|
|
||||||
import com.mdd.common.aop.NotLogin;
|
import com.mdd.common.aop.NotLogin;
|
||||||
import com.mdd.common.core.AjaxResult;
|
import com.mdd.common.core.AjaxResult;
|
||||||
|
import com.mdd.common.exception.LoginException;
|
||||||
|
import com.mdd.common.exception.OperateException;
|
||||||
import com.mdd.front.LikeFrontThreadLocal;
|
import com.mdd.front.LikeFrontThreadLocal;
|
||||||
import com.mdd.front.service.IUserService;
|
import com.mdd.front.service.IUserService;
|
||||||
import com.mdd.front.validate.users.UserForgetPwdValidate;
|
import com.mdd.front.validate.users.UserForgetPwdValidate;
|
||||||
|
|
@ -31,6 +33,9 @@ public class UserController {
|
||||||
@ApiOperation(value="个人中心")
|
@ApiOperation(value="个人中心")
|
||||||
public AjaxResult<UserCenterVo> center() {
|
public AjaxResult<UserCenterVo> center() {
|
||||||
Integer userId = LikeFrontThreadLocal.getUserId();
|
Integer userId = LikeFrontThreadLocal.getUserId();
|
||||||
|
if (userId == 0) {
|
||||||
|
throw new OperateException("未登录", 1);
|
||||||
|
}
|
||||||
|
|
||||||
UserCenterVo vo = iUserService.center(userId);
|
UserCenterVo vo = iUserService.center(userId);
|
||||||
return AjaxResult.success(vo);
|
return AjaxResult.success(vo);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue