he2802 2 lat temu
rodzic
commit
f0e2afebd5

+ 4 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/wx/service/impl/WxPayServiceImpl.java

@@ -311,6 +311,7 @@ public class WxPayServiceImpl implements IWxPayService {
     public Map<String, String> paymentGzh(String out_trade_no, String openid, String body, BigDecimal price, String url) {
         initData();
         WxSmallConfig config = new WxSmallConfig(gzhAppid, mchid, key);
+        Map<String, String> resp = null;
         try {
             WXPay wxpay = new WXPay(config);
             BigDecimal unit = new BigDecimal(100);
@@ -327,7 +328,7 @@ public class WxPayServiceImpl implements IWxPayService {
             data.put("trade_type", "JSAPI");
             String TenantId = ServletUtils.getRequest().getHeader("TenantId");
             data.put("attach", TenantId);
-            Map<String, String> resp = wxpay.unifiedOrder(data);
+            resp = wxpay.unifiedOrder(data);
             Map<String, String> result = new HashMap<>();
             //         result.put("provider","wxpay");
             result.put("appId", gzhAppid);
@@ -340,7 +341,8 @@ public class WxPayServiceImpl implements IWxPayService {
             return result;
         } catch (Exception e) {
             e.printStackTrace();
-            throw new CustomException("错误" + e.getMessage());
+            log.error(JSON.toJSONString(resp));
+            throw new CustomException("支付错误" + e.getMessage());
         }
 
         //    return null;