更新房间等级图标
This commit is contained in:
@@ -397,6 +397,9 @@ public class Constant {
|
||||
public static final int ROOM_BACKGROUND = 113;
|
||||
public static final int ROOM_BACKGROUND_CHANGE = 1131;
|
||||
|
||||
public static final int ROOM_LEVEL = 114;
|
||||
public static final int ROOM_LEVEL_UP = 1141;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -3,8 +3,10 @@ package com.accompany.business.service.room;
|
||||
import com.accompany.business.constant.RoomConstant;
|
||||
import com.accompany.business.model.room.RoomLevelInfo;
|
||||
import com.accompany.business.model.room.RoomMicDress;
|
||||
import com.accompany.business.service.SendSysMsgService;
|
||||
import com.accompany.business.service.user.UsersService;
|
||||
import com.accompany.business.vo.room.RoomLevelVo;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.netease.ErBanNetEaseService;
|
||||
import com.accompany.common.netease.neteaseacc.result.RoomMemberRet;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
@@ -46,12 +48,33 @@ public class RoomLevelService {
|
||||
@Autowired
|
||||
private ErBanNetEaseService erBanNetEaseService;
|
||||
|
||||
@Autowired
|
||||
private SendSysMsgService sendSysMsgService;
|
||||
|
||||
public RScoredSortedSet<Long> roomExpCache(Integer partitionId) {
|
||||
return redissonClient.getScoredSortedSet(RoomConstant.RedisKey.room_val.getKey(partitionId), LongCodec.INSTANCE);
|
||||
}
|
||||
|
||||
public void updateRoomLevelExp(Integer partitionId, Long roomUid, Double exp) {
|
||||
roomExpCache(partitionId).addScore(roomUid, exp);
|
||||
if (roomUid == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
BigDecimal totalScore = BigDecimal.valueOf(roomExpCache(partitionId).addScore(roomUid, exp));
|
||||
BigDecimal lastScore = totalScore.subtract(BigDecimal.valueOf(exp));
|
||||
TreeMap<BigDecimal, RoomLevelInfo> levelInfoTreeMap = roomLevelInfoService.getLevelInfoTreeMap();
|
||||
Map.Entry<BigDecimal, RoomLevelInfo> totalLevelInfoEntry = levelInfoTreeMap.headMap(totalScore, true).lastEntry();
|
||||
Map.Entry<BigDecimal, RoomLevelInfo> lastLevelInfoEntry = levelInfoTreeMap.headMap(lastScore, true).lastEntry();
|
||||
Integer totalLevel = totalLevelInfoEntry.getValue().getLevelSeq();
|
||||
Integer lastLevel = lastLevelInfoEntry.getValue().getLevelSeq();
|
||||
if ((totalLevel - lastLevel) > 0) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("roomLevelIcon", totalLevelInfoEntry.getValue().getLevelIcon());
|
||||
sendSysMsgService.sendSingleRoomMessage(roomUid, String.valueOf(roomUid), Constant.DefMsgType.ROOM_LEVEL, Constant.DefMsgType.ROOM_LEVEL_UP, jsonObject);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("updateRoomLevelExp:partitionId:{},roomUid:{},exp:{},e:{}", partitionId, roomUid, exp, e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public RoomLevelInfo getRoomLevelByRoomUid(Integer partitionId, Long roomUid) {
|
||||
|
Reference in New Issue
Block a user