xiongzhu hace 3 años
padre
commit
0697ba6092

+ 2 - 0
src/main/java/com/izouma/nineth/config/Constants.java

@@ -21,6 +21,8 @@ public interface Constants {
 
     Long BLACK_HOLE_USER_ID = 1435297L;
 
+    String ALIPAY_URL_SCHEME = "alipays://platformapi/startapp?saId=10000007&qrcode=";
+
     interface PayChannel {
         String SAND = "sandPay";
         String HM   = "hmPay";

+ 10 - 10
src/main/java/com/izouma/nineth/service/OrderPayService.java

@@ -128,11 +128,11 @@ public class OrderPayService {
 
         String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("User-Agent");
         if (ua.toLowerCase().contains("micromessenger")) {
-            return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(qrCode, StandardCharsets.UTF_8)
+            return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
                     + "&orderId=" + orderId + "&type=order&returnUrl="
                     + URLEncoder.encode(generalProperties.getHost() + "/9th/store", StandardCharsets.UTF_8);
         } else {
-            return "alipays://platformapi/startapp?saId=10000007&qrcode=" + qrCode;
+            return Constants.ALIPAY_URL_SCHEME + qrCode;
         }
     }
 
@@ -234,11 +234,11 @@ public class OrderPayService {
 
         String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("User-Agent");
         if (ua.toLowerCase().contains("micromessenger")) {
-            return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(qrCode, StandardCharsets.UTF_8)
+            return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
                     + "&orderId=" + orderId + "&type=gift&returnUrl="
                     + URLEncoder.encode(generalProperties.getHost() + "/9th/store", StandardCharsets.UTF_8);
         } else {
-            return "alipays://platformapi/startapp?saId=10000007&qrcode=" + qrCode;
+            return Constants.ALIPAY_URL_SCHEME + qrCode;
         }
     }
 
@@ -324,11 +324,11 @@ public class OrderPayService {
 
         String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("User-Agent");
         if (ua.toLowerCase().contains("micromessenger")) {
-            return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(qrCode, StandardCharsets.UTF_8)
+            return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
                     + "&orderId=" + orderId + "&type=mintOrder&returnUrl="
                     + URLEncoder.encode(generalProperties.getHost() + "/9th/store", StandardCharsets.UTF_8);
         } else {
-            return "alipays://platformapi/startapp?saId=10000007&qrcode=" + qrCode;
+            return Constants.ALIPAY_URL_SCHEME + qrCode;
         }
     }
 
@@ -445,11 +445,11 @@ public class OrderPayService {
 
         String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("User-Agent");
         if (ua.toLowerCase().contains("micromessenger")) {
-            return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(qrCode, StandardCharsets.UTF_8)
+            return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
                     + "&orderId=" + order.getId() + "&type=recharge&returnUrl="
                     + URLEncoder.encode(generalProperties.getHost() + "/9th/store", StandardCharsets.UTF_8);
         } else {
-            return "alipays://platformapi/startapp?saId=10000007&qrcode=" + qrCode;
+            return Constants.ALIPAY_URL_SCHEME + qrCode;
         }
     }
 
@@ -608,11 +608,11 @@ public class OrderPayService {
 
         String ua = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getHeader("User-Agent");
         if (ua.toLowerCase().contains("micromessenger")) {
-            return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(qrCode, StandardCharsets.UTF_8)
+            return "/static/wx_alipay_bridge.html?payUrl=" + URLEncoder.encode(Constants.ALIPAY_URL_SCHEME + qrCode, StandardCharsets.UTF_8)
                     + "&orderId=" + orderId + "&type=auctionOrder&returnUrl="
                     + URLEncoder.encode(generalProperties.getHost() + "/9th/store", StandardCharsets.UTF_8);
         } else {
-            return "alipays://platformapi/startapp?saId=10000007&qrcode=" + qrCode;
+            return Constants.ALIPAY_URL_SCHEME + qrCode;
         }
     }