|  |  |  | 
|---|
|  |  |  | import com.moral.constant.Constants; | 
|---|
|  |  |  | import com.moral.constant.ResponseCodeEnum; | 
|---|
|  |  |  | import com.moral.constant.ResultMessage; | 
|---|
|  |  |  | import com.moral.exception.TokenException; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.http.HttpStatus; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.ControllerAdvice; | 
|---|
|  |  |  | 
|---|
|  |  |  | return ResultMessage.fail(ResponseCodeEnum.FAIL.getCode(), "请求用户数据失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 处理TokenException异常 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @ExceptionHandler({TokenException.class}) | 
|---|
|  |  |  | @ResponseBody | 
|---|
|  |  |  | @ResponseStatus(HttpStatus.OK) | 
|---|
|  |  |  | public ResultMessage handleTokenException(TokenException ex) { | 
|---|
|  |  |  | return ResultMessage.fail(ex.getCode(),ex.getMsg()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|