瀏覽代碼

feat : 充值打折

bilingfeng 9 月之前
父節點
當前提交
68d8e7eeeb

+ 11 - 0
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/Game.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.*;
 import lombok.*;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
 
 /**
@@ -142,4 +143,14 @@ public class Game implements Serializable {
      */
     private String appType;
 
+    /**
+     * 是否虚拟游戏
+     */
+    private Boolean isUnrealGame;
+
+    /**
+     * 充值折扣
+     */
+    private BigDecimal rechargeRebate;
+
 }

+ 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直投兼容修改3> ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象SDK服务启动成功 <游戏充值打折> ( ´・・)ノ(._.`) \n" +
                 " ___________ _   __\n" +
                 "/  ___|  _  \\ | / /\n" +
                 "\\ `--.| | | | |/ / \n" +

+ 6 - 0
game-module/game-module-sdk/src/main/java/com/zanxiang/game/module/sdk/service/impl/OrderServiceImpl.java

@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.RoundingMode;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 
@@ -71,6 +72,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                     JsonUtil.toString(gameUser), JsonUtil.toString(gameUserRole));
             throw new BaseException("参数错误, 游戏用户信息不全");
         }
+
+        //判断是否设置充值打折
+        if (game.getRechargeRebate() != null) {
+            payParam.setAmount(payParam.getAmount().multiply(game.getRechargeRebate()).setScale(2, RoundingMode.HALF_UP));
+        }
         //游戏支付配置信息
         GamePayWayDTO gamePayWayDTO = gamePayWayService.getGamePayWay(gameId, payParam.getPayWay(), payParam.getPayDevice());
         //生成订单id