聊天信息管理后台代码提交
parent
2dd2a38fe0
commit
25f6ba0796
|
|
@ -1,7 +1,9 @@
|
||||||
package com.ljsd.jieling.chat.logic;
|
package com.ljsd.jieling.chat.logic;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.ljsd.GameApplication;
|
import com.ljsd.GameApplication;
|
||||||
|
import com.ljsd.jieling.chat.ChatRedisEntity;
|
||||||
import com.ljsd.jieling.chat.messge.MessageCache;
|
import com.ljsd.jieling.chat.messge.MessageCache;
|
||||||
import com.ljsd.jieling.core.GlobalsDef;
|
import com.ljsd.jieling.core.GlobalsDef;
|
||||||
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
||||||
|
|
@ -27,6 +29,7 @@ import com.ljsd.jieling.util.CBean2Proto;
|
||||||
import com.ljsd.jieling.util.MessageUtil;
|
import com.ljsd.jieling.util.MessageUtil;
|
||||||
import com.ljsd.jieling.util.SensitivewordFilter;
|
import com.ljsd.jieling.util.SensitivewordFilter;
|
||||||
import com.ljsd.jieling.util.ShieldedWordUtils;
|
import com.ljsd.jieling.util.ShieldedWordUtils;
|
||||||
|
import util.TimeUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -42,6 +45,8 @@ public class ChatLogic {
|
||||||
return ChatLogic.Instance.instance;
|
return ChatLogic.Instance.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Gson gson = new Gson();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取聊天信息
|
* 获取聊天信息
|
||||||
|
|
@ -196,10 +201,24 @@ public class ChatLogic {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
onSendChatSuccess(user,chatType,message);
|
||||||
ReportUtil.onReportEvent(user, ReportEventEnum.SEND_MESSAGE.getType(),String.valueOf(chatType),message);
|
ReportUtil.onReportEvent(user, ReportEventEnum.SEND_MESSAGE.getType(),String.valueOf(chatType),message);
|
||||||
MessageUtil.sendMessage(iSession, 1, msgId, null, true);
|
MessageUtil.sendMessage(iSession, 1, msgId, null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//记录聊天信息
|
||||||
|
private void onSendChatSuccess(User user,int chatType,String message){
|
||||||
|
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||||
|
String key = RedisKey.getKey(RedisKey.CHAT_INFO_CACHE, String.valueOf(chatType), false);
|
||||||
|
ChatRedisEntity chatRedisEntity = new ChatRedisEntity(user.getId(), user.getPlayerInfoManager().getNickName(), chatType, message, TimeUtils.now(), user.getPlayerInfoManager().getSilence());
|
||||||
|
String chatInfo = gson.toJson(chatRedisEntity);
|
||||||
|
|
||||||
|
long l = redisUtil.lGetListSize(key);
|
||||||
|
if(l>1000){
|
||||||
|
redisUtil.lPop(key);
|
||||||
|
}
|
||||||
|
redisUtil.lSet(key,chatInfo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统消息
|
* 系统消息
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,7 @@ public class RedisKey {
|
||||||
|
|
||||||
public final static String USER_LEVEL_GUILD_INFO = "USER_LEVEL_GUILD_INFO"; //车迟玩法挑战记录
|
public final static String USER_LEVEL_GUILD_INFO = "USER_LEVEL_GUILD_INFO"; //车迟玩法挑战记录
|
||||||
|
|
||||||
|
public static final String CHAT_INFO_CACHE = "CHAT_INFO_CACHE";//聊天信息缓存,gm后台使用
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue