Explorar el Código

Merge branch 'package' of GameCenter/game-center into dev

zhimo hace 5 meses
padre
commit
b8fcd70129

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java

@@ -23,7 +23,7 @@ public class ManageApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功 < (发码器代码完成提交1200・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 < (发码器代码完成提交1300・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 4 - 0
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/GameGiftPackCodeServiceImpl.java

@@ -101,6 +101,7 @@ public class GameGiftPackCodeServiceImpl extends ServiceImpl<GameGiftPackCodeMap
         List<String> existCodeList = super.list(new LambdaQueryWrapper<GameGiftPackCode>()
                 .select(GameGiftPackCode::getCode)
                 .eq(GameGiftPackCode::getLinkId, param.getLinkId())
+                .eq(GameGiftPackCode::getEnabled, Boolean.TRUE)
                 .eq(GameGiftPackCode::getGameId, param.getGameId())
                 .in(GameGiftPackCode::getCode, param.getCodeList())
         ).stream().map(GameGiftPackCode::getCode).collect(Collectors.toList());
@@ -109,6 +110,7 @@ public class GameGiftPackCodeServiceImpl extends ServiceImpl<GameGiftPackCodeMap
                 .filter(code -> !existCodeList.contains(code))
                 .map(code -> this.transform(param, code))
                 .collect(Collectors.toList());
+        assert CollectionUtils.isNotEmpty(saveList) : "参数错误, 礼包码已存在, 禁止重复添加";
         //保存返回
         super.saveBatch(saveList);
         //将礼包码主键添加到缓存
@@ -139,6 +141,8 @@ public class GameGiftPackCodeServiceImpl extends ServiceImpl<GameGiftPackCodeMap
                 .filter(id -> redisUtil.isMemberInSet(giftPackCodeKey, String.valueOf(id)))
                 .map(Object::toString)
                 .toArray(String[]::new);
+        //不存在缓存队列中, 不可以删除
+        assert giftPackCodeIdArray.length != 0 : "缓存队列中不存在可删除的礼包码";
         //先从缓存中移除
         redisUtil.removeOfSet(giftPackCodeKey, giftPackCodeIdArray);
         List<Long> giftPackCodeIdList = Arrays.stream(giftPackCodeIdArray).map(Long::parseLong).collect(Collectors.toList());