|
@@ -4,6 +4,7 @@ import cn.hutool.core.exceptions.ExceptionUtil;
|
|
import cn.hutool.core.net.URLDecoder;
|
|
import cn.hutool.core.net.URLDecoder;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
import com.fdkankan.common.constant.ServerCode;
|
|
import com.fdkankan.common.constant.ServerCode;
|
|
import com.fdkankan.gateway.log.GatewayLog;
|
|
import com.fdkankan.gateway.log.GatewayLog;
|
|
import com.fdkankan.gateway.response.ResultData;
|
|
import com.fdkankan.gateway.response.ResultData;
|
|
@@ -272,10 +273,14 @@ public class AccessLogFilter implements GlobalFilter, Ordered {
|
|
HttpHeaders headers = response.getHeaders();
|
|
HttpHeaders headers = response.getHeaders();
|
|
MediaType contentType = headers.getContentType();
|
|
MediaType contentType = headers.getContentType();
|
|
if(MediaType.APPLICATION_JSON.isCompatibleWith(contentType)){
|
|
if(MediaType.APPLICATION_JSON.isCompatibleWith(contentType)){
|
|
- ResultData resultData = JSON.parseObject(responseResult, ResultData.class);
|
|
|
|
- gatewayLog.setCode(resultData.getCode());
|
|
|
|
- gatewayLog.setMessage(resultData.getMessage());
|
|
|
|
- gatewayLog.setResponseData(JSON.toJSONString(resultData.getData()));
|
|
|
|
|
|
+ JSONObject result = JSON.parseObject(responseResult);
|
|
|
|
+ String message = result.getString("message");
|
|
|
|
+ if(StrUtil.isEmpty(message)){
|
|
|
|
+ message = result.getString("msg");
|
|
|
|
+ }
|
|
|
|
+ gatewayLog.setCode(result.getInteger("code"));
|
|
|
|
+ gatewayLog.setMessage(message);
|
|
|
|
+ gatewayLog.setResponseData(JSON.toJSONString(result.get("data")));
|
|
}
|
|
}
|
|
|
|
|
|
return bufferFactory.wrap(content);
|
|
return bufferFactory.wrap(content);
|