'注释:回调验签'

dev-discount
胡锐 4 years ago
parent 19e84a03af
commit 6a41968ff1
  1. 1
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  2. 7
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  3. 4
      hai-cweb/src/main/java/com/cweb/controller/pay/WechatPayController.java

@ -139,6 +139,7 @@ public class WechatController {
user.setPhone(phoneNoInfo.getPurePhoneNumber()); user.setPhone(phoneNoInfo.getPurePhoneNumber());
highUserService.insertUser(user); highUserService.insertUser(user);
} else { } else {
user.setPhone(phoneNoInfo.getPurePhoneNumber());
user.setOpenId(openId);; user.setOpenId(openId);;
highUserService.updateUser(user); highUserService.updateUser(user);
} }

@ -89,9 +89,9 @@ public class OrderController {
} }
JSONObject jsonObject = JSONObject.parseObject(reqBodyStr); JSONObject jsonObject = JSONObject.parseObject(reqBodyStr);
Long orderId = jsonObject.getLong("orderId"); Long orderId = jsonObject.getLong("orderId");
String orderType = jsonObject.getString("orderScene"); // 订单类型 String orderScene = jsonObject.getString("orderScene"); // 订单类型
String openId = jsonObject.getString("openId"); // openId String openId = jsonObject.getString("openId"); // openId
if ( orderId == null || StringUtils.isBlank(orderType) || StringUtils.isBlank(openId)) { if ( orderId == null || StringUtils.isBlank(orderScene) || StringUtils.isBlank(openId)) {
log.error("orderToPay error!", "参数错误"); log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
} }
@ -109,7 +109,7 @@ public class OrderController {
// 商品类型 1:卡卷 2:金币充值 // 商品类型 1:卡卷 2:金币充值
for (HighChildOrder childOrder : order.getHighChildOrderList()) { for (HighChildOrder childOrder : order.getHighChildOrderList()) {
if (childOrder.getGoodsType() == 2) { if (childOrder.getGoodsType() == 1) {
HighCouponModel coupon = highCouponService.getCouponById(childOrder.getGoodsId()); HighCouponModel coupon = highCouponService.getCouponById(childOrder.getGoodsId());
// 支付类型:1.微信支付 2.金币支付 // 支付类型:1.微信支付 2.金币支付
if (coupon.getPayType() != 1) { if (coupon.getPayType() != 1) {
@ -122,6 +122,7 @@ public class OrderController {
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
map.put("orderNo", order.getOrderNo()); map.put("orderNo", order.getOrderNo());
map.put("payPrice", order.getPayPrice()); map.put("payPrice", order.getPayPrice());
map.put("orderScene", orderScene);
map.put("body","购买卡券"); map.put("body","购买卡券");
map.put("subject","购买卡券"); map.put("subject","购买卡券");

@ -45,7 +45,7 @@ public class WechatPayController {
String notifyXml = null; // 微信支付系统发送的数据(<![CDATA[product_001]]>格式) String notifyXml = null; // 微信支付系统发送的数据(<![CDATA[product_001]]>格式)
notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8"); notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8");
if (SignatureUtil.reCheckIsSignValidFromWeiXin(notifyXml, SysConst.getSysConfig().getWxApiKey(), "UTF-8")) { /*if (SignatureUtil.reCheckIsSignValidFromWeiXin(notifyXml, SysConst.getSysConfig().getWxApiKey(), "UTF-8")) {
log.info("微信支付系统发送的数据:" + notifyXml); log.info("微信支付系统发送的数据:" + notifyXml);
SortedMap<String, String> map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8"); SortedMap<String, String> map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8");
@ -56,7 +56,7 @@ public class WechatPayController {
log.error("返回信息:" + notifyXml); log.error("返回信息:" + notifyXml);
resXml = "<xml>" + "<return_code><![CDATA[FAIL]]></return_code>" resXml = "<xml>" + "<return_code><![CDATA[FAIL]]></return_code>"
+ "<return_msg><![CDATA[签名验证错误]]></return_msg>" + "</xml> "; + "<return_msg><![CDATA[签名验证错误]]></return_msg>" + "</xml> ";
} }*/
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream()); BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
out.write(resXml.getBytes()); out.write(resXml.getBytes());

Loading…
Cancel
Save