调整json转换工具

This commit is contained in:
TinyAnts 2022-11-16 11:49:39 +08:00
parent a5d63d6c96
commit 124b1ff5dd
1 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
package com.mdd.front; package com.mdd.front;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.mdd.common.core.AjaxResult; import com.mdd.common.core.AjaxResult;
@ -35,7 +35,7 @@ public class LikeFrontInterceptor implements HandlerInterceptor {
// 404拦截 // 404拦截
response.setContentType("application/json;charset=utf-8"); response.setContentType("application/json;charset=utf-8");
if (response.getStatus() == 404) { if (response.getStatus() == 404) {
AjaxResult result = AjaxResult.failed(HttpEnum.REQUEST_404_ERROR.getCode(), HttpEnum.REQUEST_404_ERROR.getMsg()); AjaxResult<Object> result = AjaxResult.failed(HttpEnum.REQUEST_404_ERROR.getCode(), HttpEnum.REQUEST_404_ERROR.getMsg());
response.getWriter().print(JSON.toJSONString(result)); response.getWriter().print(JSON.toJSONString(result));
return false; return false;
} }
@ -62,14 +62,14 @@ public class LikeFrontInterceptor implements HandlerInterceptor {
// Token是否为空 // Token是否为空
if (StringUtils.isBlank(token)) { if (StringUtils.isBlank(token)) {
AjaxResult result = AjaxResult.failed(HttpEnum.TOKEN_EMPTY.getCode(), HttpEnum.TOKEN_EMPTY.getMsg()); AjaxResult<Object> result = AjaxResult.failed(HttpEnum.TOKEN_EMPTY.getCode(), HttpEnum.TOKEN_EMPTY.getMsg());
response.getWriter().print(JSON.toJSONString(result)); response.getWriter().print(JSON.toJSONString(result));
return false; return false;
} }
// Token是否过期 // Token是否过期
if (!RedisUtil.exists(token)) { if (!RedisUtil.exists(token)) {
AjaxResult result = AjaxResult.failed(HttpEnum.TOKEN_INVALID.getCode(), HttpEnum.TOKEN_INVALID.getMsg()); AjaxResult<Object> result = AjaxResult.failed(HttpEnum.TOKEN_INVALID.getCode(), HttpEnum.TOKEN_INVALID.getMsg());
response.getWriter().print(JSON.toJSONString(result)); response.getWriter().print(JSON.toJSONString(result));
return false; return false;
} }
@ -84,14 +84,14 @@ public class LikeFrontInterceptor implements HandlerInterceptor {
// 校验用户被删除 // 校验用户被删除
if (user.getIsDelete() == 1) { if (user.getIsDelete() == 1) {
AjaxResult result = AjaxResult.failed(HttpEnum.TOKEN_INVALID.getCode(), HttpEnum.TOKEN_INVALID.getMsg()); AjaxResult<Object> result = AjaxResult.failed(HttpEnum.TOKEN_INVALID.getCode(), HttpEnum.TOKEN_INVALID.getMsg());
response.getWriter().print(JSON.toJSONString(result)); response.getWriter().print(JSON.toJSONString(result));
return false; return false;
} }
// 校验用户被禁用 // 校验用户被禁用
if (user.getIsDisable() == 1) { if (user.getIsDisable() == 1) {
AjaxResult result = AjaxResult.failed(HttpEnum.LOGIN_DISABLE_ERROR.getCode(), HttpEnum.LOGIN_DISABLE_ERROR.getMsg()); AjaxResult<Object> result = AjaxResult.failed(HttpEnum.LOGIN_DISABLE_ERROR.getCode(), HttpEnum.LOGIN_DISABLE_ERROR.getMsg());
response.getWriter().print(JSON.toJSONString(result)); response.getWriter().print(JSON.toJSONString(result));
return false; return false;
} }