♻️ 重构代码 . R.ok R.failed

This commit is contained in:
冷冷 committed 2019-05-13 17:01:54 +08:00
1 parent 8affb5519e
commit 0ca10e1adc
43 files changed
+231 -249

No files matched your search

@@ -96,8 +96,7 @@ public class ValidateCodeGatewayFilter extends AbstractGatewayFilterFactory {
try {
return response.writeWith(Mono.just(response.bufferFactory()
.wrap(objectMapper.writeValueAsBytes(
R.builder().msg(e.getMessage())
.code(CommonConstants.FAIL).build()))));
R.failed(e.getMessage())))));
} catch (JsonProcessingException e1) {
log.error("对象输出异常", e1);
}
@@ -17,7 +17,6 @@
package com.pig4cloud.pigx.gateway.handler;
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
import com.pig4cloud.pigx.common.core.util.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
@@ -49,9 +48,6 @@ public class HystrixFallbackHandler implements HandlerFunction<ServerResponse> {
return ServerResponse.status(HttpStatus.INTERNAL_SERVER_ERROR.value())
.contentType(MediaType.APPLICATION_JSON_UTF8)
.body(BodyInserters.fromObject(R.builder()
.msg("服务异常")
.code(CommonConstants.FAIL)
.build()));
.body(BodyInserters.fromObject(R.failed("服务异常")));
}
}