热榜点赞
parent
5861711eaa
commit
ce9d4f5b27
|
@ -41,7 +41,6 @@ public class LikeHeroRankHandler extends BaseHandler<HeroInfoProto.LikeHeroRankR
|
|||
String userId = String.valueOf(user.getId());
|
||||
|
||||
// 英雄是否点赞过验证
|
||||
|
||||
HashSet<Integer> entry = RedisUtil.getInstence().getMapEntry(RedisKey.USER_LIKE_HERO_HOT_RANK, rankSubId, userId, HashSet.class);
|
||||
if (entry != null && entry.contains(heroTid)){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"该英雄已点赞");
|
||||
|
@ -49,7 +48,7 @@ public class LikeHeroRankHandler extends BaseHandler<HeroInfoProto.LikeHeroRankR
|
|||
|
||||
// 排行榜是否开启验证
|
||||
Map<Integer, SHotRanking> config = STableManager.getConfig(SHotRanking.class);
|
||||
SHotRanking hotRanking = config.get(rankSubId);
|
||||
SHotRanking hotRanking = config.get(Integer.parseInt(rankSubId));
|
||||
if (hotRanking == null || hotRanking.getOpen() == 0){
|
||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE,"排行榜未开启:"+rankSubId);
|
||||
}
|
||||
|
@ -59,6 +58,9 @@ public class LikeHeroRankHandler extends BaseHandler<HeroInfoProto.LikeHeroRankR
|
|||
rank.addRank(proto.getHeroTid(), rankSubId, 1);
|
||||
|
||||
// 更新点赞记录
|
||||
if (entry == null){
|
||||
entry = new HashSet<>();
|
||||
}
|
||||
entry.add(heroTid);
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.USER_LIKE_HERO_HOT_RANK, rankSubId, userId, entry);
|
||||
|
||||
|
|
Loading…
Reference in New Issue