parent
ffcc775991
commit
ee2464169c
|
@ -1,6 +1,13 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
import com.ljsd.jieling.logic.arena.LuofuLogic;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 罗浮gm
|
||||
|
@ -33,6 +40,32 @@ public class Cmd_luofu extends GmAbstract {
|
|||
}
|
||||
LOGGER.info("罗浮,发奖......");
|
||||
break;
|
||||
case "rank":
|
||||
try {
|
||||
int uid = Integer.parseInt(args[1]);
|
||||
int ranking = Integer.parseInt(args[2]);
|
||||
User user = UserManager.getUser(uid);
|
||||
Integer type = LuofuLogic.getRegisterType(user.getId());
|
||||
if (type == null || type == 0){
|
||||
LOGGER.error("罗浮交换排名失败,未报名......");
|
||||
return "未报名";
|
||||
}
|
||||
String typeString = type.toString();
|
||||
AbstractRank rank = RankEnum.toRank(RankEnum.CROSS_SERVICE_ARENA.getType());
|
||||
Set<ZSetOperations.TypedTuple<String>> rankByKey = rank.getRankByKey(typeString, ranking - 1, ranking - 1);
|
||||
if (rankByKey == null || rankByKey.isEmpty() ){
|
||||
LOGGER.error("罗浮交换排名失败,排名不存在......");
|
||||
return "排名不存在";
|
||||
}
|
||||
ZSetOperations.TypedTuple<String> next = rankByKey.iterator().next();
|
||||
double score = rank.getScoreById(user.getId(), typeString);
|
||||
rank.addRank(user.getId(), typeString, score);
|
||||
rank.addRank(Integer.parseInt(next.getValue()), typeString, next.getScore());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
LOGGER.info("罗浮,交换排名......");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue