mirror of
https://github.com/dromara/payment-spring-boot.git
synced 2026-03-13 21:33:41 +08:00
优化返回体
This commit is contained in:
@@ -2,8 +2,11 @@ package com.enongm.dianji.payment.wechat.v3;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Dax
|
* @author Dax
|
||||||
* @since 13:20
|
* @since 13:20
|
||||||
@@ -17,9 +20,18 @@ public class WechatResponseEntity<T> {
|
|||||||
|
|
||||||
public void convert(ResponseEntity<T> responseEntity) {
|
public void convert(ResponseEntity<T> responseEntity) {
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.info("wechat response {}", responseEntity);
|
log.debug("wechat response {}", responseEntity);
|
||||||
}
|
}
|
||||||
|
if (Objects.nonNull(responseEntity)) {
|
||||||
this.httpStatus = responseEntity.getStatusCodeValue();
|
this.httpStatus = responseEntity.getStatusCodeValue();
|
||||||
this.body = responseEntity.getBody();
|
this.body = responseEntity.getBody();
|
||||||
|
} else {
|
||||||
|
this.httpStatus = HttpStatus.REQUEST_TIMEOUT.value();
|
||||||
|
this.body = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean successful() {
|
||||||
|
return this.httpStatus == HttpStatus.OK.value();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user