release: redis记录

release-2024-04-25
huangyw 2 months ago
parent 6b58503bcb
commit e8aa61790d

@ -95,19 +95,20 @@ public class WxPayController {
// 根据证书序列号查询对应的证书来验证签名结果 // 根据证书序列号查询对应的证书来验证签名结果
boolean verifySignature = WxPayKit.verifySignature(response, wxPayConfig.getPlatformCertPath()); boolean verifySignature = WxPayKit.verifySignature(response, wxPayConfig.getPlatformCertPath());
log.info("verifySignature: {}", verifySignature); log.info("verifySignature: {}", verifySignature);
if (response.getStatus() == 200 && verifySignature) { // if (response.getStatus() == 200 && verifySignature) {
if (response.getStatus() == 200) {
String body = response.getBody(); String body = response.getBody();
JSONObject jsonObject = JSONUtil.parseObj(body); JSONObject jsonObject = JSONUtil.parseObj(body);
String prepayId = jsonObject.getStr("prepay_id"); String prepayId = jsonObject.getStr("prepay_id");
Map<String, String> map = WxPayKit.appCreateSign(wxPayConfig.getAppId(), wxPayConfig.getMchId(), prepayId, wxPayConfig.getPrivateKeyPath()); Map<String, String> map = WxPayKit.appCreateSign(wxPayConfig.getAppId(), wxPayConfig.getMchId(), prepayId, wxPayConfig.getPrivateKeyPath());
log.info("唤起支付参数:{}", map); log.info("唤起支付参数:{}", map);
return Result.success(map); return Result.success(map);
} }
return Result.success(response); return Result.success(response);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return Result.failed(e.getMessage()); return Result.failed(e.getMessage());
} }
} }
@ -121,8 +122,15 @@ public class WxPayController {
String serialNo = request.getHeader("Wechatpay-Serial"); String serialNo = request.getHeader("Wechatpay-Serial");
String signature = request.getHeader("Wechatpay-Signature"); String signature = request.getHeader("Wechatpay-Signature");
String s = DateTimeZoneUtil.dateToTimeZone(System.currentTimeMillis());
log.info("timestamp:{} nonce:{} serialNo:{} signature:{}", timestamp, nonce, serialNo, signature); log.info("timestamp:{} nonce:{} serialNo:{} signature:{}", timestamp, nonce, serialNo, signature);
redisUtils.set("payNotify" + s + " timestamp", timestamp);
redisUtils.set("payNotify" + s + " nonce", nonce);
redisUtils.set("payNotify" + s + " serialNo", serialNo);
redisUtils.set("payNotify" + s + " signature", signature);
String result = HttpKit.readData(request); String result = HttpKit.readData(request);
redisUtils.set("payNotify" + s + " result", result);
log.info("支付通知密文 {}", result); log.info("支付通知密文 {}", result);
// 需要通过证书序列号查找对应的证书verifyNotify 中有验证证书的序列号 // 需要通过证书序列号查找对应的证书verifyNotify 中有验证证书的序列号
@ -130,7 +138,7 @@ public class WxPayController {
wxPayConfig.getApiV3Key(), wxPayConfig.getPlatformCertPath()); wxPayConfig.getApiV3Key(), wxPayConfig.getPlatformCertPath());
log.info("支付通知明文 {}", plainText); log.info("支付通知明文 {}", plainText);
redisUtils.set("payNotify" + DateTimeZoneUtil.dateToTimeZone(System.currentTimeMillis()), plainText); redisUtils.set("payNotify" + s + " plainText", plainText);
if (StrUtil.isNotEmpty(plainText)) { if (StrUtil.isNotEmpty(plainText)) {
response.setStatus(200); response.setStatus(200);

Loading…
Cancel
Save