合服掉封禁问题处理
parent
297a7cac2a
commit
9f019317b3
|
@ -16,6 +16,7 @@ import com.ljsd.jieling.logic.activity.event.ServerOpenEvent;
|
|||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.MailingSystemManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.thread.ThreadManager;
|
||||
import com.ljsd.jieling.thread.task.MongoDataHandlerTask;
|
||||
|
@ -105,6 +106,7 @@ public class GameLogicService implements IService {
|
|||
ThriftPoolUtils.getInstance().initContext();
|
||||
GlobalDataManaager.getInstance().init();
|
||||
GuilidManager.init();
|
||||
PlayerLogic.banPlayerRedisInit();
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
LOGGER.info("ShutdownHook start");
|
||||
|
|
|
@ -1178,14 +1178,7 @@ public class RedisUtil {
|
|||
|
||||
public <T> void putMapEntry(String type,String key,String mapKey, T value){
|
||||
String rkey = getKey(type, key);
|
||||
for (int i = 0; i < MAX_TRY_TIMES; i++) {
|
||||
try {
|
||||
redisTemplate.opsForHash().put(rkey,mapKey,gson.toJson(value));
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
TimeUtils.sleep(FAILED_SLEEP);
|
||||
}
|
||||
}
|
||||
putMapEntry2(rkey, mapKey, value);
|
||||
}
|
||||
|
||||
public <T> void putMapEntry2(String key, String mapKey, T value){
|
||||
|
@ -1201,11 +1194,15 @@ public class RedisUtil {
|
|||
|
||||
public <T> void putMapEntrys(String type,String key,Map<String,T> valus){
|
||||
String rkey = getKey(type, key);
|
||||
putMapEntrys2(rkey, valus);
|
||||
}
|
||||
|
||||
public <T> void putMapEntrys2(String key,Map<String,T> valus){
|
||||
Map<String, String> result = new HashMap<>();
|
||||
valus.forEach((k,v)-> result.put(k,gson.toJson(v)));
|
||||
for (int i = 0; i < MAX_TRY_TIMES; i++) {
|
||||
try {
|
||||
redisTemplate.opsForHash().putAll(rkey,result);
|
||||
redisTemplate.opsForHash().putAll(key,result);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
TimeUtils.sleep(FAILED_SLEEP);
|
||||
|
@ -1273,18 +1270,6 @@ public class RedisUtil {
|
|||
return getMapValues2(rkey, keyClazz, valueClazz);
|
||||
}
|
||||
|
||||
public <K,T> Map<K,T> getMapValues(String type, String key, Class<K> keyClazz, Type valueType){
|
||||
Map<K,T> result = new HashMap<>();
|
||||
String rkey = getKey(type, key);
|
||||
Map<Object, Object> entries = redisTemplate.opsForHash().entries(rkey);
|
||||
for(Map.Entry<Object,Object> item : entries.entrySet()){
|
||||
Object key1 = item.getKey();
|
||||
Object value = item.getValue();
|
||||
result.put(gson.fromJson(gson.toJson(key1),keyClazz),gson.fromJson(value.toString(), valueType));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public <K,T> Map<K,T> getMapValues2(String key, Class<K> keyClazz, Class<T> valueClazz){
|
||||
Map<K,T> result = new HashMap<>();
|
||||
Map<Object, Object> entries = redisTemplate.opsForHash().entries(key);
|
||||
|
@ -1296,6 +1281,18 @@ public class RedisUtil {
|
|||
return result;
|
||||
}
|
||||
|
||||
public <K,T> Map<K,T> getMapValues3(String type, String key, Class<K> keyClazz, Type valueType){
|
||||
Map<K,T> result = new HashMap<>();
|
||||
String rkey = getKey(type, key);
|
||||
Map<Object, Object> entries = redisTemplate.opsForHash().entries(rkey);
|
||||
for(Map.Entry<Object,Object> item : entries.entrySet()){
|
||||
Object key1 = item.getKey();
|
||||
Object value = item.getValue();
|
||||
result.put(gson.fromJson(gson.toJson(key1),keyClazz),gson.fromJson(value.toString(), valueType));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean existsKey(String type,String key){
|
||||
String rkey = getKey(type, key);
|
||||
return redisTemplate.hasKey(rkey);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class ChampionViewFinalHandler extends BaseHandler<ArenaInfoProto.Champio
|
|||
|
||||
Type valueType = new TypeToken<List<Integer>>() {}.getType();
|
||||
int start = 0, end = - 1;
|
||||
Map<Integer, List<Integer>> finalmemberOfTeam = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_FINAL_TEAM_INFO, "", Integer.class, valueType);
|
||||
Map<Integer, List<Integer>> finalmemberOfTeam = RedisUtil.getInstence().getMapValues3(RedisKey.CHAMPION_FINAL_TEAM_INFO, "", Integer.class, valueType);
|
||||
Map<Integer, Integer> memberPerOfTeam = new HashMap<>();
|
||||
List<String> arenaRecodeds;
|
||||
if(type == 1){
|
||||
|
|
|
@ -12,9 +12,8 @@ public class Cmd_addblack extends GmAbstract {
|
|||
return false;
|
||||
}
|
||||
String uid = args[0];
|
||||
RedisUtil.getInstence().putMapEntry(RedisKey.FORBID_LOGIN, "",uid,0);
|
||||
RedisUtil.getInstence().putMapEntry2(RedisKey.FORBID_LOGIN, uid,0);
|
||||
ProtocolsManager.getInstance().minuteCheckForbidUser();
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ public class Cmd_reblack extends GmAbstract {
|
|||
return false;
|
||||
}
|
||||
String uid = args[0];
|
||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.FORBID_LOGIN, "", uid);
|
||||
RedisUtil.getInstence().removeMapEntrys2(RedisKey.FORBID_LOGIN, uid);
|
||||
ProtocolsManager.getInstance().minuteCheckForbidUser();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -862,7 +862,7 @@ public class ChampionshipLogic {
|
|||
//todo
|
||||
public static Map<Integer, List<Integer>> getMermberTeam() {
|
||||
Type type = new TypeToken<List<Integer>>() {}.getType();
|
||||
return RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_CHOSE_TEAM_INFO, "", Integer.class, type);
|
||||
return RedisUtil.getInstence().getMapValues3(RedisKey.CHAMPION_CHOSE_TEAM_INFO, "", Integer.class, type);
|
||||
}
|
||||
|
||||
public static CommonProto.TeamOneInfo.Builder getUserTeam(int robotId) {
|
||||
|
@ -943,7 +943,7 @@ public class ChampionshipLogic {
|
|||
}
|
||||
} else { //决赛
|
||||
Type valueType = new TypeToken<List<Integer>>() {}.getType();
|
||||
Map<Integer, List<Integer>> finalmemberOfTeam = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_FINAL_TEAM_INFO, "", Integer.class, valueType);
|
||||
Map<Integer, List<Integer>> finalmemberOfTeam = RedisUtil.getInstence().getMapValues3(RedisKey.CHAMPION_FINAL_TEAM_INFO, "", Integer.class, valueType);
|
||||
Map<Integer, MemberInfo> allJoinMembers = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_JOIN, "", Integer.class, MemberInfo.class);
|
||||
|
||||
List<MemberInfo> possibleJoin = new ArrayList<>();
|
||||
|
|
|
@ -1093,14 +1093,14 @@ public class ItemLogic {
|
|||
throw new ErrorCodeException(ErrorCode.ACCOUNT_ERROR);
|
||||
}
|
||||
}
|
||||
Item item7 = user.getItemManager().getItem(1004);
|
||||
if(item7 != null){
|
||||
if(item7.getItemNum() >= 300 && user.getId() != 10009366){
|
||||
String format = MessageFormat.format("道具异常,uid:{0},itemId:{1},itemNum:{2}", user.getId(), item7.getItemId(),item7.getItemNum());
|
||||
LOGGER.error(format);
|
||||
throw new ErrorCodeException(ErrorCode.ACCOUNT_ERROR);
|
||||
}
|
||||
}
|
||||
// Item item7 = user.getItemManager().getItem(1004);
|
||||
// if(item7 != null){
|
||||
// if(item7.getItemNum() >= 300 && user.getId() != 10009366){
|
||||
// String format = MessageFormat.format("道具异常,uid:{0},itemId:{1},itemNum:{2}", user.getId(), item7.getItemId(),item7.getItemNum());
|
||||
// LOGGER.error(format);
|
||||
// throw new ErrorCodeException(ErrorCode.ACCOUNT_ERROR);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -445,7 +445,7 @@ public class PlayerLogic {
|
|||
//退出公会 隔天清空援助信息
|
||||
if(playerInfoManager.getGuildId()==0){
|
||||
GuildMyInfo guildMyInfo = user.getGuildMyInfo();
|
||||
if(guildMyInfo.getGuidHelpInfo().size()!=0||guildMyInfo.getGuidHelpHadTakeInfo().size()!=0){
|
||||
if(!guildMyInfo.getGuidHelpInfo().isEmpty() || !guildMyInfo.getGuidHelpHadTakeInfo().isEmpty()){
|
||||
guildMyInfo.setGuidHelpInfo(new HashMap<>());
|
||||
guildMyInfo.setGuidHelpHadTakeInfo(new HashMap<>());
|
||||
guildMyInfo.setGuildHelpSendTime(0);
|
||||
|
@ -1966,6 +1966,21 @@ public class PlayerLogic {
|
|||
return lv;
|
||||
}
|
||||
|
||||
public static void banPlayerRedisInit(){
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
String key = redisUtil.getKey(RedisKey.FORBID_LOGIN, "");
|
||||
if (!redisUtil.hasKey(key)){
|
||||
return;
|
||||
}
|
||||
Map<String, Integer> forbidMap = redisUtil.getMapValues2(key, String.class, Integer.class);
|
||||
if (forbidMap == null || forbidMap.isEmpty()){
|
||||
return;
|
||||
}
|
||||
redisUtil.putMapEntrys2(RedisKey.FORBID_LOGIN, forbidMap);
|
||||
redisUtil.remove(key);
|
||||
LOGGER.info("封禁列表已迁移");
|
||||
}
|
||||
|
||||
//获取跨服非玉虚玩家队伍信息
|
||||
// public PlayerInfoProto.GetPlayerOneTeamInfoResponse getCrossOneTeamInfo(int id,int teamId) throws Exception {
|
||||
// CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(id);
|
||||
|
|
|
@ -565,7 +565,7 @@ public class RidingSwardLogic{
|
|||
*/
|
||||
public static Map<Integer, List<RidingSwardRecord>> getRecordList(int uid){
|
||||
Type valueType = new TypeToken<List<RidingSwardRecord>>(){}.getType();
|
||||
Map<Integer, List<RidingSwardRecord>> map = RedisUtil.getInstence().getMapValues(RedisKey.RIDING_SWARD_RECORD, String.valueOf(uid), int.class, valueType);
|
||||
Map<Integer, List<RidingSwardRecord>> map = RedisUtil.getInstence().getMapValues3(RedisKey.RIDING_SWARD_RECORD, String.valueOf(uid), int.class, valueType);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
|
|
@ -167,13 +167,12 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
public void minuteCheckForbidUser(){
|
||||
try {
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
String key = RedisKey.getKey(RedisKey.FORBID_LOGIN, "");
|
||||
if(!redisUtil.hasKey(key)){
|
||||
if(!redisUtil.hasKey(RedisKey.FORBID_LOGIN)){
|
||||
Blocker.getForbidLogin().clear();
|
||||
return;
|
||||
}
|
||||
Map<Integer, Integer> forbidMap = redisUtil.getMapValues(RedisKey.FORBID_LOGIN, "", Integer.class, Integer.class);
|
||||
if(forbidMap==null||forbidMap.size()<1){
|
||||
Map<Integer, Integer> forbidMap = redisUtil.getMapValues2(RedisKey.FORBID_LOGIN, Integer.class, Integer.class);
|
||||
if(forbidMap == null|| forbidMap.isEmpty()){
|
||||
return;
|
||||
}
|
||||
Blocker.setForbidLogin(forbidMap.keySet());
|
||||
|
@ -186,12 +185,11 @@ public class ProtocolsManager implements ProtocolsAbstract {
|
|||
public void minuteCheckFlowUser(){
|
||||
try {
|
||||
String crowdnum = RedisUtil.getInstence().getMapValue(RedisKey.GLOBAL_SYS_PRO,"","onlinenum",String.class);
|
||||
if(null!=crowdnum&&!crowdnum.equals("")){
|
||||
if(null!=crowdnum&& !crowdnum.isEmpty()){
|
||||
Blocker.maxAllowedOnlineAccountCount.set(Integer.parseInt(crowdnum));
|
||||
}
|
||||
}catch (Exception e){
|
||||
}catch (Exception ignored){
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void initHandler(String pck){
|
||||
|
|
Loading…
Reference in New Issue