fix: 微信支付,接口bug修复。

This commit is contained in:
tianyongbao
2026-01-19 14:16:33 +08:00
parent 063579f8e3
commit 3fc42ac5b9
4 changed files with 7 additions and 4 deletions

View File

@@ -400,6 +400,6 @@ wx:
# 支付回调通知配置 # 支付回调通知配置
pay-notify: pay-notify:
# 支付回调通知URL需根据实际域名配置 # 支付回调通知URL需根据实际域名配置
notify-url: "https://yourdomain.com/weixin/pay_notify" notify-url: "https://api.yuceyun.cn/fishery-api/weixin/pay_notify"
# 微信商户号与上面wx.pay.mch-id保持一致 # 微信商户号与上面wx.pay.mch-id保持一致
mch-id: "1671289865" mch-id: "1671289865"

View File

@@ -216,7 +216,8 @@ public class WeixinController extends BaseController {
openId, openId,
request.getPayId(), request.getPayId(),
request.getListDeviceId(), request.getListDeviceId(),
request.getJsCode() request.getJsCode(),
wxPayNotifyProperties.getNotifyUrl()
); );
if (orderId == null || orderId <= 0) { if (orderId == null || orderId <= 0) {

View File

@@ -20,9 +20,10 @@ public interface PayOrderBusinessService {
* @param payId 支付选项ID * @param payId 支付选项ID
* @param deviceIds 设备ID列表 * @param deviceIds 设备ID列表
* @param jsCode 微信登录code * @param jsCode 微信登录code
* @param notifyUrl 支付回调通知URL
* @return 订单ID * @return 订单ID
*/ */
Long createPayOrder(Long userId, String openId, Integer payId, List<Long> deviceIds, String jsCode); Long createPayOrder(Long userId, String openId, Integer payId, List<Long> deviceIds, String jsCode, String notifyUrl);
/** /**
* 根据商户订单号查询订单 * 根据商户订单号查询订单

View File

@@ -46,7 +46,7 @@ public class PayOrderBusinessServiceImpl implements PayOrderBusinessService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long createPayOrder(Long userId, String openId, Integer payId, List<Long> deviceIds, String jsCode) { public Long createPayOrder(Long userId, String openId, Integer payId, List<Long> deviceIds, String jsCode, String notifyUrl) {
// 1. 获取支付选项配置 // 1. 获取支付选项配置
WxPayItemProperties.PayItem payItem = wxPayItemProperties.getPayItemById(payId); WxPayItemProperties.PayItem payItem = wxPayItemProperties.getPayItemById(payId);
if (payItem == null) { if (payItem == null) {
@@ -92,6 +92,7 @@ public class PayOrderBusinessServiceImpl implements PayOrderBusinessService {
order.setProfitStatus(0); order.setProfitStatus(0);
order.setTradeType("JSAPI"); order.setTradeType("JSAPI");
order.setAttachment(String.valueOf(payId)); // 设置支付选项ID order.setAttachment(String.valueOf(payId)); // 设置支付选项ID
order.setNotifyUrl(notifyUrl); // 设置支付回调通知URL
payOrderMapper.insert(order); payOrderMapper.insert(order);