达人排行榜榜单调整 连续充值周期更新
parent
89ffd40206
commit
7d0388eaed
|
|
@ -70,6 +70,9 @@ public class ActivityLogic {
|
||||||
Map<Integer, SGlobalActivity> sGlobalActivityMap = SGlobalActivity.getsGlobalActivityMap();
|
Map<Integer, SGlobalActivity> sGlobalActivityMap = SGlobalActivity.getsGlobalActivityMap();
|
||||||
for (SGlobalActivity sGlobalActivity : sGlobalActivityMap.values()) {
|
for (SGlobalActivity sGlobalActivity : sGlobalActivityMap.values()) {
|
||||||
int time = sGlobalActivity.getTime();
|
int time = sGlobalActivity.getTime();
|
||||||
|
if(ActivityTypeEnum.getActicityCacheSize()==0){//init cache
|
||||||
|
ActivityTypeEnum.getActicityType(sGlobalActivity.getId());
|
||||||
|
}
|
||||||
if (time == 2) {
|
if (time == 2) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -937,7 +940,7 @@ public class ActivityLogic {
|
||||||
|
|
||||||
int start = 0;
|
int start = 0;
|
||||||
int maxSize = SGameSetting.getGameSetting().getShowRank();
|
int maxSize = SGameSetting.getGameSetting().getShowRank();
|
||||||
List<CommonProto.ExpertInfo> expertInfos = new ArrayList<>(maxSize);
|
List<CommonProto.ExpertInfo> expertInfos = new LinkedList<>();
|
||||||
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK, Integer.toString(acitvityId), 0, maxSize - 1);
|
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK, Integer.toString(acitvityId), 0, maxSize - 1);
|
||||||
for (ZSetOperations.TypedTuple<String> item : rankInfo) {
|
for (ZSetOperations.TypedTuple<String> item : rankInfo) {
|
||||||
String value = item.getValue();
|
String value = item.getValue();
|
||||||
|
|
@ -949,17 +952,21 @@ public class ActivityLogic {
|
||||||
CommonProto.ExpertInfo personInfoBuild = CommonProto.ExpertInfo.newBuilder()
|
CommonProto.ExpertInfo personInfoBuild = CommonProto.ExpertInfo.newBuilder()
|
||||||
.setName(playerInfoManager.getNickName())
|
.setName(playerInfoManager.getNickName())
|
||||||
.setScore(score)
|
.setScore(score)
|
||||||
|
.setLevel(playerInfoManager.getLevel())
|
||||||
|
.setHeadFrame(playerInfoManager.getHeadFrame())
|
||||||
|
.setHead(0)
|
||||||
.setRank(++start)
|
.setRank(++start)
|
||||||
.build();
|
.build();
|
||||||
expertInfos.add(personInfoBuild);
|
expertInfos.add(personInfoBuild);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rankInfo.size() > 2 * maxSize) {
|
//策划要全部数据
|
||||||
//删除多余数据 预留一些 长度maxSize
|
// if (rankInfo.size() > 2 * maxSize) {
|
||||||
String key = RedisKey.getKey(RedisKey.EXPERT_RANK, String.valueOf(acitvityId), false);
|
// //删除多余数据 预留一些 长度maxSize
|
||||||
int size = RedisUtil.getInstence().getZsetSize(key);
|
// String key = RedisKey.getKey(RedisKey.EXPERT_RANK, String.valueOf(acitvityId), false);
|
||||||
RedisUtil.getInstence().removeZSetRangeByRank(key, maxSize, size);
|
// int size = RedisUtil.getInstence().getZsetSize(key);
|
||||||
}
|
// RedisUtil.getInstence().removeZSetRangeByRank(key, maxSize, size);
|
||||||
|
// }
|
||||||
|
|
||||||
int uid = session.getUid();
|
int uid = session.getUid();
|
||||||
int score = RedisUtil.getInstence().getZSetScore(RedisKey.EXPERT_RANK, Integer.toString(acitvityId), Integer.toString(uid)).intValue();
|
int score = RedisUtil.getInstence().getZSetScore(RedisKey.EXPERT_RANK, Integer.toString(acitvityId), Integer.toString(uid)).intValue();
|
||||||
|
|
@ -967,10 +974,10 @@ public class ActivityLogic {
|
||||||
|
|
||||||
PlayerInfoProto.GetExpertInfoResponse buildResponse = PlayerInfoProto.GetExpertInfoResponse.newBuilder()
|
PlayerInfoProto.GetExpertInfoResponse buildResponse = PlayerInfoProto.GetExpertInfoResponse.newBuilder()
|
||||||
.setMyRank(myRank)
|
.setMyRank(myRank)
|
||||||
.setMyScore(score)
|
|
||||||
.addAllExpert(expertInfos)
|
.addAllExpert(expertInfos)
|
||||||
|
.setMyScore(score)
|
||||||
.build();
|
.build();
|
||||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.GETF_EXPERT_RANK_INFO_REQUEST_VALUE, buildResponse, true);
|
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.GETF_EXPERT_RANK_INFO_RESPONSE_VALUE, buildResponse, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ public enum ActivityTypeEnum {
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractActivity toActivity(int id) {
|
public AbstractActivity toActivity(int id) {
|
||||||
|
|
||||||
if (acticityCache.containsKey(id)) {
|
if (acticityCache.containsKey(id)) {
|
||||||
return acticityCache.get(id);
|
return acticityCache.get(id);
|
||||||
}
|
}
|
||||||
|
|
@ -90,6 +89,10 @@ public enum ActivityTypeEnum {
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Integer getActicityCacheSize() {
|
||||||
|
return acticityCache.size();
|
||||||
|
}
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,13 @@ class RechargeSumDayActivity extends AbstractActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume(User user) throws Exception {
|
public void onResume(User user) {
|
||||||
ActivityManager activityManager = user.getActivityManager();
|
ActivityManager activityManager = user.getActivityManager();
|
||||||
ActivityMission activityMission = activityManager.getActivityMissionMap().get(id);
|
ActivityMission activityMission = activityManager.getActivityMissionMap().get(id);
|
||||||
activityMission.setValue(0);
|
if (activityMission.getValue() == SActivityRewardConfig.getsActivityRewardConfigByActivityId(id).size()) {
|
||||||
|
activityMission.initMissionInfo(id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
int missionId = SActivityRewardConfig.getRechargeDaySum().get(activityMission.getValue() + 1);
|
int missionId = SActivityRewardConfig.getRechargeDaySum().get(activityMission.getValue() + 1);
|
||||||
if (user.getPlayerInfoManager().getRechargedaily() > SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId).getValues()[0][0]) {
|
if (user.getPlayerInfoManager().getRechargedaily() > SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId).getValues()[0][0]) {
|
||||||
activityMission.setValue(activityMission.getValue() + 1);
|
activityMission.setValue(activityMission.getValue() + 1);
|
||||||
|
|
@ -51,7 +54,7 @@ class RechargeSumDayActivity extends AbstractActivity {
|
||||||
boolean checkValue(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
boolean checkValue(ISession session, SActivityRewardConfig sActivityRewardConfig, ActivityProgressInfo activityProgressInfo) throws Exception {
|
||||||
int[][] values = sActivityRewardConfig.getValues();
|
int[][] values = sActivityRewardConfig.getValues();
|
||||||
User user = UserManager.getUser(session.getUid());
|
User user = UserManager.getUser(session.getUid());
|
||||||
int value = user.getActivityManager().getActivityMissionMap().get(sActivityRewardConfig.getActivityId()).getValue()+1;
|
int value = user.getActivityManager().getActivityMissionMap().get(sActivityRewardConfig.getActivityId()).getValue() + 1;
|
||||||
if (value < values[0][1]) {
|
if (value < values[0][1]) {
|
||||||
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "value illegality");
|
MessageUtil.sendErrorResponse(session, 0, rewardResponseValue, "value illegality");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue