Răsfoiți Sursa

添加 宠物 修改倍数

kk 2 luni în urmă
părinte
comite
74d2af31cd

+ 38 - 0
game-business/src/main/java/com/game/business/task/AppGameBettingTask.java

@@ -15,6 +15,7 @@ import com.game.common.constant.finance.FinTranType2;
 import com.game.common.constant.finance.FinTranType3;
 import com.game.common.core.domain.HttpRet;
 import com.game.common.core.redis.RedisCache;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
@@ -219,6 +220,43 @@ public class AppGameBettingTask {
             if(type == 3){
                 appGame.setGameDate(gameDate);
                 appGameService.updateAppGame(appGame);
+
+                // 修改倍数
+                if(gameCode.equals(Common.GAME_ONE_CODE)){
+
+                    String gameLotteryBet = gameLotteryObject.getString("gameLotteryBet");
+                    if(StringUtils.isBlank(gameLotteryBet)){
+                        continue;
+                    }
+
+                    gameLotteryBet = gameLotteryBet.replace(" ", "").trim();
+                    JSONArray items = JSONArray.parseArray(gameLotteryBet);
+                    if(items == null || items.isEmpty()){
+                       continue;
+                    }
+
+                    AppGameItem appGameItem = new AppGameItem();
+                    appGameItem.setGameId(appGame.getId());
+                    List<AppGameItem> itemList = appGameItemService.selectAppGameItemList(appGameItem);
+
+                    if(itemList == null || itemList.isEmpty()){
+                        continue;
+                    }
+
+                    if(itemList.size() != items.size()){
+                        continue;
+                    }
+
+                    // 升序排序
+                    Collections.sort(itemList, Comparator.comparing(AppGameItem::getItemLocation));
+
+                    for (int j = 0; j < itemList.size(); j++) {
+                        AppGameItem gameItem = itemList.get(j);
+                        gameItem.setItemMultiple(items.getDouble(j));
+                        appGameItemService.updateAppGameItem(gameItem);
+                    }
+                }
+
                 continue;
             }