Browse Source

fix:微信支付调整

wrj 1 year ago
parent
commit
2f726b6093

+ 1 - 1
nightFragrance-admin/src/main/resources/application-test.yml

@@ -211,7 +211,7 @@ wx:
   # 商户秘钥
   mch-key: 39C9AIJ1RQKT3I8V16BYZ6LLBI0H30NB
   # 异步回调地址
-  notify-url: https://test.baoxianzhanggui.com/wx/pay/payNotify
+  notify-url: https://test.baoxianzhanggui.com/nightFragrance/wx/pay/payNotify
   # 证书地址
   cert-path: /nightFragrance/pay/apiclient_cert.pem
   # 证书秘钥地址

+ 7 - 2
nightFragrance-massage/src/main/java/com/ylx/massage/service/impl/TRechargeServiceImpl.java

@@ -20,6 +20,7 @@ import com.ijpay.wxpay.enums.v3.BasePayApiEnum;
 import com.ijpay.wxpay.model.v3.Amount;
 import com.ijpay.wxpay.model.v3.Payer;
 import com.ijpay.wxpay.model.v3.UnifiedOrderModel;
+import com.ylx.common.config.WechatAccountConfig;
 import com.ylx.common.config.WxPayConfig;
 import com.ylx.common.core.domain.R;
 import com.ylx.common.exception.ServiceException;
@@ -66,6 +67,9 @@ public class TRechargeServiceImpl extends ServiceImpl<TRechargeMapper, TRecharge
     @Autowired
     private WxPayConfig wxPayProperties;
 
+    @Autowired
+    private WechatAccountConfig wechatAccountConfig;
+
     String serialNo;
 
     @Override
@@ -124,7 +128,8 @@ public class TRechargeServiceImpl extends ServiceImpl<TRechargeMapper, TRecharge
     public R getPay(String setOutTradeNo, BigDecimal amount, String openId, String description, String attach) throws Exception {
         String timeExpire = DateTimeZoneUtil.dateToTimeZone(System.currentTimeMillis() + 1000 * 60 * 3);
         UnifiedOrderModel unifiedOrderModel = new UnifiedOrderModel()
-                .setAppid(wxPayProperties.getAppId())
+//                .setAppid(wxPayProperties.getAppId())
+                .setAppid(wechatAccountConfig.getMpAppId())
                 .setMchid(wxPayProperties.getMchId())
                 //商品描述
                 .setDescription(description)
@@ -162,7 +167,7 @@ public class TRechargeServiceImpl extends ServiceImpl<TRechargeMapper, TRecharge
             String body = response.getBody();
             JSONObject jsonObject = JSONUtil.parseObj(body);
             String prepayId = jsonObject.getStr("prepay_id");
-            Map<String, String> map = WxPayKit.jsApiCreateSign(wxPayProperties.getAppId(), prepayId, wxPayProperties.getCertKeyPath());
+            Map<String, String> map = WxPayKit.jsApiCreateSign(wechatAccountConfig.getMpAppId(), prepayId, wxPayProperties.getCertKeyPath());
             log.info("唤起支付参数:{}", map);
             return R.ok(JSONUtil.toJsonStr(map));
         }