no message
This commit is contained in:
@ -107,8 +107,8 @@ public class PaymentController {
|
||||
/**
|
||||
* 微信支付结果通知
|
||||
*/
|
||||
@PostMapping("/notify/{companyId}")
|
||||
public String notify(@PathVariable Long companyId, HttpServletRequest request) {
|
||||
@PostMapping("/notify")
|
||||
public String notify(@PathVariable HttpServletRequest request) {
|
||||
try {
|
||||
// 读取微信回调数据
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@ -119,10 +119,12 @@ public class PaymentController {
|
||||
}
|
||||
|
||||
String xmlData = sb.toString();
|
||||
logger.info("收到微信支付通知,公司ID: {}, 数据: {}", companyId, xmlData);
|
||||
logger.info("收到微信支付通知,数据: {}", xmlData);
|
||||
|
||||
// 解析XML数据
|
||||
Map<String, String> notifyMap = WXPayUtil.xmlToMap(xmlData);
|
||||
String companyIdStr = notifyMap.get("attach");
|
||||
Long companyId = Long.parseLong(companyIdStr);
|
||||
|
||||
// 验证签名
|
||||
if (!wechatPayService.verifyNotifySign(companyId, notifyMap)) {
|
||||
@ -159,7 +161,7 @@ public class PaymentController {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("处理微信支付通知异常,公司ID: {}", companyId, e);
|
||||
logger.error("处理微信支付通知异常,{}", e);
|
||||
return buildResponse("FAIL", "处理异常");
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ public class WechatPayService {
|
||||
reqData.put("openid", request.getOpenId());
|
||||
|
||||
if (request.getAttach() != null) {
|
||||
reqData.put("attach", request.getAttach());
|
||||
reqData.put("attach", request.getCompanyId().toString());
|
||||
}
|
||||
|
||||
// 调用微信统一下单接口
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
server:
|
||||
port: 8019
|
||||
|
||||
@ -56,7 +57,7 @@ mybatis-plus:
|
||||
|
||||
wechat:
|
||||
pay:
|
||||
app-id: your_app_id
|
||||
app-id: wx25e1ad1a70c326de
|
||||
mch-id: your_mch_id
|
||||
key: your_api_key
|
||||
notify-url: https://yourdomain.com/api/payment/notify
|
||||
notify-url: http://115.190.8.52:8019/api/payment/notify
|
||||
|
||||
Reference in New Issue
Block a user