Browse Source

-fix : 解决微信支付CP方金额精度不正确的问题

bilingfeng 9 months ago
parent
commit
69bc09ba22

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

@@ -23,7 +23,7 @@ public class SDKApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(SDKApplication.class, args);
-        System.out.println("赞象SDK服务启动成功 <兼容腾讯私域APP回传> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象SDK服务启动成功 <解决微信支付CP方金额精度不正确的问题> ( ´・・)ノ(._.`) \n" +
                 " ___________ _   __\n" +
                 "/  ___|  _  \\ | / /\n" +
                 "\\ `--.| | | | |/ / \n" +

+ 3 - 5
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/util/WxPayUtil.java

@@ -64,11 +64,9 @@ public class WxPayUtil {
      * @return : 返回处理完的字符串
      */
     public static String subZeroAndDot(String s) {
-        if (s.indexOf(".") > 0) {
-            // 去掉多余的0
-            s = s.replaceAll("0+?$", "");
-            // 如最后一位是.则去掉
-            s = s.replaceAll("[.]$", "");
+        int dotIndex = s.indexOf(".");
+        if (dotIndex > 0) {
+            s = s.substring(0, dotIndex);
         }
         return s;
     }