ソースを参照

修复app游戏加载以及排行榜的bug

hurixing 2 年 前
コミット
9a25283c33

+ 4 - 4
hcp-core/src/main/java/com/yingyangfly/core/recommend/RecommendFacade.java

@@ -262,10 +262,10 @@ public class RecommendFacade {
             log.info("<<<<<<<<<<<<用户:{},业务为:{}>>>>>>>>>>>", JSON.toJSONString(u),JSON.toJSONString(rule),"库存数量大于推荐数量,裁切");
             return getRandomElements(games, maxSize-existSize);
         }else {
-            log.info("<<<<<<<<<<<<用户:{},业务为:{}>>>>>>>>>>>", JSON.toJSONString(u),JSON.toJSONString(rule),"库存数量小于推荐数量,随机添补");
-            List<Game> gamesRecommend = recommendRandom.getGames(u, null, null, null, rule);
-            games.addAll(getRandomElements(gamesRecommend, maxSize-allSize));
-            log.info("<<<<<<<<<<<<用户:{},业务为:{},添补游戏为:{}>>>>>>>>>>>", JSON.toJSONString(u),JSON.toJSONString(rule),JSON.toJSONString(games));
+//            log.info("<<<<<<<<<<<<用户:{},业务为:{}>>>>>>>>>>>", JSON.toJSONString(u),JSON.toJSONString(rule),"库存数量小于推荐数量,随机添补");
+//            List<Game> gamesRecommend = recommendRandom.getGames(u, null, null, null, rule);
+//            games.addAll(getRandomElements(gamesRecommend, maxSize-allSize));
+//            log.info("<<<<<<<<<<<<用户:{},业务为:{},添补游戏为:{}>>>>>>>>>>>", JSON.toJSONString(u),JSON.toJSONString(rule),JSON.toJSONString(games));
             return games;
         }
     }

+ 9 - 0
hcp-core/src/main/java/com/yingyangfly/core/service/impl/GameServiceImpl.java

@@ -2,6 +2,7 @@ package com.yingyangfly.core.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yingyangfly.core.domain.*;
 import com.yingyangfly.core.dto.AppCurrentLoginUser;
@@ -136,6 +137,14 @@ public class GameServiceImpl extends ServiceImpl<GameMapper, Game> implements Ga
             game.setGameDuration(game.getGameDuration()*60);
             return save(game);
         }
+        Game gameUpdate = this.getById(game.getId());
+        if (gameUpdate.getTotalNum() != game.getTotalNum()){
+            GameUser gameUser = new GameUser();
+            gameUser.setTotalNum(game.getTotalNum());
+            LambdaQueryWrapper<GameUser> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(GameUser::getGameCode,gameUpdate.getGameCode());
+            gameUserMapper.update(gameUser,wrapper);
+        }
         return saveOrUpdate(game);
     }