Browse Source

feat : 微信h5支付调试完成

bilingfeng 2 years ago
parent
commit
614481df93

+ 1 - 1
game-module/game-sdk/src/main/java/com/zanxiang/sdk/SDKApplication.java

@@ -14,7 +14,7 @@ public class SDKApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(SDKApplication.class, args);
-        System.out.println("赞象SDK服务启动成功1111 ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象SDK服务启动成功2222 ( ´・・)ノ(._.`) \n" +
                 " ______  __     __     \n" +
                 "/_____/\\/__/\\ /__/\\    \n" +
                 "\\:::__\\/\\ \\::\\\\:.\\ \\   \n" +

+ 0 - 4
game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/Impl/pay/PayService.java

@@ -17,7 +17,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.jdom.JDOMException;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletRequest;
@@ -42,9 +41,6 @@ public class PayService {
     @Autowired
     public GamePayWayService gamePayWayService;
 
-    @Value("${server.domain}")
-    public String domain;
-
     /**
      * 自定义参数
      */

+ 3 - 2
game-module/game-sdk/src/main/java/com/zanxiang/sdk/service/Impl/pay/WxPayServiceImpl.java

@@ -215,7 +215,7 @@ public class WxPayServiceImpl extends PayService implements OrderPayService {
     private ResultMap mp(ProductPayParamBO product) {
         //redirect_uri 需要在微信支付端添加认证网址
         totalFee = WxPayUtil.subZeroAndDot(this.totalFee);
-        String redirectUri = serverUrl + "weixinMobile/dopay?outTradeNo=" + product.getOutTradeNo() + "&totalFee=" + totalFee;
+        String redirectUri = serverUrl + "/api/sdk/weixinMobile/dopay?outTradeNo=" + product.getOutTradeNo() + "&totalFee=" + totalFee;
         //也可以通过state传递参数 redirect_uri 后面加参数未经过验证
         String result = SnsAPI.connectOauth2Authorize(config.getAppId(), redirectUri, true, null);
         return ResultMap.ok(result);
@@ -298,7 +298,8 @@ public class WxPayServiceImpl extends PayService implements OrderPayService {
         URL payUrl = new URL(url);
         URLConnection con = payUrl.openConnection();
         // 加referer防盗链,必须是你申请的支付白名单
-        con.setRequestProperty("Referer", "https://test.game.hzshengmel.com");
+//        con.setRequestProperty("Referer", "https://test.game.hzshengmel.com");
+        con.setRequestProperty("Referer", serverUrl);
         BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), StandardCharsets.UTF_8));
         String result = "";
         String realLineStr = null;