| | |
| | | package com.sinata.appointment.common; |
| | | |
| | | import cn.dev33.satoken.exception.NotLoginException; |
| | | import cn.dev33.satoken.exception.NotPermissionException; |
| | | import com.sinata.appointment.constants.HttpBizCode; |
| | | import com.sinata.appointment.exception.BizException; |
| | | |
| | |
| | | @ExceptionHandler(SaTokenException.class) |
| | | public Result<Void> handleSaToken(SaTokenException e) { |
| | | log.error("satoken error", e); |
| | | if (e instanceof NotPermissionException){ |
| | | return ResultUtil.error(HttpBizCode.FORBIDDEN, "无权限访问"); |
| | | } |
| | | if (e instanceof NotLoginException notLogin |
| | | && NotLoginException.KICK_OUT.equals(notLogin.getType())) { |
| | | return ResultUtil.error(HttpBizCode.UNAUTHORIZED, "账号已被禁用,请重新登录"); |