master
jiahuiwen 2021-10-27 18:28:15 +08:00
parent 1b37f3963e
commit 703d8152ec
1 changed files with 21 additions and 18 deletions

View File

@ -13,6 +13,7 @@ import com.jmfy.util.MD5Util;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -37,26 +38,28 @@ public class HaoGameRechargeController {
private static final Logger LOGGER = LoggerFactory.getLogger(HaoGameRechargeController.class);
@RequestMapping(value = "/haoGameCallback")
public String haoGameCallback(HttpServletRequest request) throws Exception {
public String haoGameCallback(HttpServletRequest request, @RequestBody String body) throws Exception {
try {
BufferedReader reader = request.getReader();
StringBuilder sb = new StringBuilder();
String str;
while ((str = reader.readLine()) != null) {
sb.append(str);
LOGGER.info("haoGameCallback getOuttradeno={} ",str);
}
String body = sb.toString();
if (body.isEmpty()) {
LOGGER.info("haoGameCallback body.isEmpty=");
}
LOGGER.info("haoGameCallback body.length={} body={}", body.length(), body);
HaoGameParamBean haoGameParamBean = JsonUtil.serializeToObject(body);
LOGGER.info("haoGameCallback getOuttradeno={} getOpenid={} getSign={}",haoGameParamBean.getOuttradeno(), haoGameParamBean.getOpenid(), haoGameParamBean.getSign());
} catch (Exception e) {
e.printStackTrace();
}
// try {
// BufferedReader reader = request.getReader();
// StringBuilder sb = new StringBuilder();
// String str;
// while ((str = reader.readLine()) != null) {
// sb.append(str);
// LOGGER.info("haoGameCallback getOuttradeno={} ",str);
// }
// String body = sb.toString();
// if (body.isEmpty()) {
// LOGGER.info("haoGameCallback body.isEmpty=");
// }
//
// HaoGameParamBean haoGameParamBean = JsonUtil.serializeToObject(body);
// LOGGER.info("haoGameCallback getOuttradeno={} getOpenid={} getSign={}",haoGameParamBean.getOuttradeno(), haoGameParamBean.getOpenid(), haoGameParamBean.getSign());
// } catch (Exception e) {
// e.printStackTrace();
// }