添加图片压缩
This commit is contained in:
parent
793e8f59be
commit
a3be6de573
@ -101,6 +101,7 @@
|
||||
create_time DESC
|
||||
) a1
|
||||
GROUP BY a1.authorId
|
||||
|
||||
ORDER BY
|
||||
create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -2,6 +2,7 @@ package com.dd.admin.common.exception;
|
||||
|
||||
import com.dd.admin.common.model.result.ResultBean;
|
||||
import com.dd.admin.common.model.result.ResultError;
|
||||
import io.jsonwebtoken.ExpiredJwtException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.annotation.Order;
|
||||
@ -70,6 +71,13 @@ public class ControllerExceptionHandler {
|
||||
return ResultError.error(ResultBean.DEFAULT_ERROR_CODE,ResultBean.DEFAULT_ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@ExceptionHandler(ExpiredJwtException.class)
|
||||
@ResponseBody
|
||||
public ResultError ExpiredJwtException(Exception e) throws IOException {
|
||||
log.error("Exception{}",e);
|
||||
return ResultError.error(ResultBean.DEFAULT_ERROR_CODE,ResultBean.DEFAULT_ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
@ExceptionHandler(BadSqlGrammarException.class)
|
||||
@ResponseBody
|
||||
public ResultError BadSqlGrammarException(BadSqlGrammarException e) throws IOException {
|
||||
|
@ -41,11 +41,17 @@ public class ApiInterceptor implements HandlerInterceptor {
|
||||
}
|
||||
String token = request.getHeader("token");
|
||||
if (StrUtil.isBlank(token)) {
|
||||
throw new ApiException("请登录后访问");
|
||||
throw new ApiException(700,"请登录后访问");
|
||||
}
|
||||
//解析token
|
||||
System.out.println(token);
|
||||
String authorId = jwtTokenUtil.getUsernameFromToken(token);
|
||||
String authorId = "";
|
||||
try {
|
||||
authorId = jwtTokenUtil.getUsernameFromToken(token);
|
||||
}catch (Exception e) {
|
||||
throw new ApiException(700,"token已失效");
|
||||
}
|
||||
|
||||
request.setAttribute("authorId",authorId);
|
||||
|
||||
// Author author = authorService.getById(authorId);
|
||||
|
Loading…
x
Reference in New Issue
Block a user