邮件定时检测发送,工会图腾信息,工会战绩,37敏感字检测
parent
3ba8de06f2
commit
bcfc9a92d6
|
@ -4,6 +4,9 @@ package com.ljsd.jieling.chat.logic;
|
|||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.chat.messge.MessageCache;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Report37Response;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Repot37EventUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
|
@ -99,11 +102,19 @@ public class ChatLogic {
|
|||
case 1: //世界
|
||||
long messageId = RedisUtil.getInstence().increment(GameApplication.serverId + RedisKey.CHAT_WORD_MSG_ID + GameApplication.serverId);
|
||||
ChatProto.ChatInfo chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,messageId);
|
||||
if(!Repot37EventUtil.Report37Chat(user, ChatContentType.WORLD_CHAT.getType(),chatInfo.getMsg())){
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "包含敏感字");
|
||||
return;
|
||||
}
|
||||
MessageCache.addWordMsg(chatInfo,messageId);
|
||||
break;
|
||||
case 2: //公会
|
||||
messageId = RedisUtil.getInstence().increment(GameApplication.serverId + RedisKey.CHAT_GUILD_MSG_ID+ GameApplication.serverId);
|
||||
chatInfo = CBean2Proto.getChatInfoBuilder(user,message,nowTime,messageId);
|
||||
if(!Repot37EventUtil.Report37Chat(user, ChatContentType.FAMILY.getType(),chatInfo.getMsg())){
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "包含敏感字");
|
||||
return;
|
||||
}
|
||||
MessageCache.addGuildMsg(chatInfo,messageId);
|
||||
break;
|
||||
case 3: //好友
|
||||
|
@ -119,11 +130,16 @@ public class ChatLogic {
|
|||
ChatProto.SendChatInfoIndication sendChatInfoIndication = ChatProto.SendChatInfoIndication.newBuilder()
|
||||
.setChatInfo(chatInfo)
|
||||
.build();
|
||||
if(!Repot37EventUtil.Report37Chat(user, ChatContentType.PRIVATE_CHAT.getType(),chatInfo.getMsg())){
|
||||
MessageUtil.sendErrorResponse(iSession, 0, msgId, "包含敏感字");
|
||||
return;
|
||||
}
|
||||
assert sessionByUid != null;
|
||||
MessageUtil.sendIndicationMessage(sessionByUid, 1, MessageTypeProto.MessageType.SEND_CHAT_INFO_INDICATION_VALUE, sendChatInfoIndication, true);
|
||||
}else{
|
||||
}else{
|
||||
RedisUtil.getInstence().hset(GameApplication.serverId +RedisKey.CUser_Chat+friendId,uid +"#"+ nowTime,message, -1);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
MessageUtil.sendMessage(iSession, 1, msgId, null, true);
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.ljsd.jieling.config;
|
||||
|
||||
import com.ljsd.jieling.logic.STableManager;
|
||||
import com.ljsd.jieling.logic.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="GuildLevelConfig")
|
||||
public class SGuildLevelConfig implements BaseConfig {
|
||||
|
||||
private int level;
|
||||
|
||||
private int exp;
|
||||
|
||||
private int num;
|
||||
|
||||
private int[] shopSort;
|
||||
|
||||
private int officalNum;
|
||||
|
||||
private int defendNum;
|
||||
|
||||
public static Map<Integer,SGuildLevelConfig> sGuildLevelConfigMap;
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int getExp() {
|
||||
return exp;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public int[] getShopSort() {
|
||||
return shopSort;
|
||||
}
|
||||
|
||||
public int getOfficalNum() {
|
||||
return officalNum;
|
||||
}
|
||||
|
||||
public int getDefendNum() {
|
||||
return defendNum;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -5,4 +5,5 @@ public class SDK37Constans {
|
|||
public static String pid = "1";
|
||||
public static String appkey = "$5wl2BKfodm4nqxVIC0XeHPb9ZRLQFz?";
|
||||
public static String payKey = "cxSeo5IBl6;kdPOJRgjEYHp9LsQMf+1V";
|
||||
public static String chatKey = "37opkldcs341";
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package com.ljsd.jieling.config.reportData;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.common.mogodb.util.BlockingUniqueQueue;
|
||||
import com.ljsd.jieling.config.json.SDK37Constans;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Report37Param;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Report37RoleLeveBean;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Report37TaskBean;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.*;
|
||||
import com.ljsd.jieling.ktbeans.KTParam;
|
||||
import com.ljsd.jieling.ktbeans.KTSendBody;
|
||||
import com.ljsd.jieling.util.MD5Util;
|
||||
import com.ljsd.jieling.util.http.HttpPool;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
|
@ -27,7 +28,7 @@ public class DataMessageUtils {
|
|||
private static final String sendUrl = "https://gskuld.receiver.extranet.kt007.com:8081/skuld/game/common/";
|
||||
private static final String sendTaskUrl37 = "http://pvt.api.m.37.com/hd/postTaskInfo/" + SDK37Constans.pid + "/" + SDK37Constans.gid;
|
||||
private static final String sendRoleUrl37 = "http://pvt.api.m.37.com/report/roleChangeReport/" + SDK37Constans.pid + "/" + SDK37Constans.gid;
|
||||
|
||||
private static final String sendChatContent37 = "http://cm3.api.37.com.cn/Content/_checkContent/";
|
||||
//入队列
|
||||
public static void addLogQueue(Object info) {
|
||||
if (info instanceof KTParam) {
|
||||
|
@ -81,4 +82,11 @@ public class DataMessageUtils {
|
|||
}
|
||||
|
||||
}
|
||||
public static JSONObject immediateSendPost(Object info){
|
||||
String s = gson.toJson(info);
|
||||
// if(info instanceof Report37CheckChat){
|
||||
JSONObject jsonObject = HttpPool.sendPost(sendChatContent37, s);
|
||||
// }
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.ljsd.jieling.dataReport.reportBeans_37;
|
||||
|
||||
public enum ChatContentType {
|
||||
WORLD_CHAT(1,"世界"),
|
||||
FAMILY(2,"公会"),
|
||||
TEAM(3,"队伍"),
|
||||
COUNTRY(4,"国家(阵容)"),
|
||||
PRIVATE_CHAT(5,"私聊"),
|
||||
SCENE(6,"场景"),
|
||||
BROADCAST(7,"喇叭"),
|
||||
OTHER(8,"其他"),
|
||||
ANCHOR(9,"主播"),
|
||||
SPAN_SERVER(10,"跨服聊天"),
|
||||
FAMILY_HEAD(11,"会长"),
|
||||
FAMILY_NAME(12,"公会名"),
|
||||
ROLE_NAME(13,"角色名"),
|
||||
ANNOUNCE(14,"公告");
|
||||
|
||||
private Integer type;
|
||||
private String text;
|
||||
|
||||
//构造方法
|
||||
private ChatContentType(Integer type,String text ){
|
||||
this.type = type;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
public Integer getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,257 @@
|
|||
package com.ljsd.jieling.dataReport.reportBeans_37;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.jieling.config.json.SDK37Constans;
|
||||
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
||||
import com.ljsd.jieling.util.MD5Util;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import com.ljsd.jieling.util.http.HttpPool;
|
||||
import org.apache.http.HttpResponse;
|
||||
|
||||
public class Report37CheckChat {
|
||||
private int time;
|
||||
private String uid="100001";
|
||||
private String gid="10111";
|
||||
private String pid="1";
|
||||
private String dsid="10153";
|
||||
private String type = "1";
|
||||
private String idfa="";
|
||||
private String idfv="";
|
||||
private String oudid="";
|
||||
private String imei="";
|
||||
private String mac="";
|
||||
private String sign="";
|
||||
private String actor_name="";
|
||||
private String actor_id="";
|
||||
private String user_ip="";
|
||||
private String chat_time="";
|
||||
private String content="你好";
|
||||
private String actor_level="1";
|
||||
private String actor_recharge_gold="1";
|
||||
private String to_uid="";
|
||||
private String to_actor_name="";
|
||||
private String to_actor_id="";
|
||||
private String to_actor_level="";
|
||||
private String to_actor_recharge_gold="";
|
||||
private String type_id="";
|
||||
|
||||
public void setTime(int time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getGid() {
|
||||
return gid;
|
||||
}
|
||||
|
||||
public void setGid(String gid) {
|
||||
this.gid = gid;
|
||||
}
|
||||
|
||||
public String getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(String pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public String getDsid() {
|
||||
return dsid;
|
||||
}
|
||||
|
||||
public void setDsid(String dsid) {
|
||||
this.dsid = dsid;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getIdfa() {
|
||||
return idfa;
|
||||
}
|
||||
|
||||
public void setIdfa(String idfa) {
|
||||
this.idfa = idfa;
|
||||
}
|
||||
|
||||
public String getIdfv() {
|
||||
return idfv;
|
||||
}
|
||||
|
||||
public void setIdfv(String idfv) {
|
||||
this.idfv = idfv;
|
||||
}
|
||||
|
||||
public String getOudid() {
|
||||
return oudid;
|
||||
}
|
||||
|
||||
public void setOudid(String oudid) {
|
||||
this.oudid = oudid;
|
||||
}
|
||||
|
||||
public String getImei() {
|
||||
return imei;
|
||||
}
|
||||
|
||||
public void setImei(String imei) {
|
||||
this.imei = imei;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
return mac;
|
||||
}
|
||||
|
||||
public void setMac(String mac) {
|
||||
this.mac = mac;
|
||||
}
|
||||
|
||||
public String getSign() {
|
||||
return sign;
|
||||
}
|
||||
|
||||
public void setSign(String sign) {
|
||||
this.sign = sign;
|
||||
}
|
||||
|
||||
public String getActor_name() {
|
||||
return actor_name;
|
||||
}
|
||||
|
||||
public void setActor_name(String actor_name) {
|
||||
this.actor_name = actor_name;
|
||||
}
|
||||
|
||||
public String getActor_id() {
|
||||
return actor_id;
|
||||
}
|
||||
|
||||
public void setActor_id(String actor_id) {
|
||||
this.actor_id = actor_id;
|
||||
}
|
||||
|
||||
public String getUser_ip() {
|
||||
return user_ip;
|
||||
}
|
||||
|
||||
public void setUser_ip(String user_ip) {
|
||||
this.user_ip = user_ip;
|
||||
}
|
||||
|
||||
public String getChat_time() {
|
||||
return chat_time;
|
||||
}
|
||||
|
||||
public void setChat_time(String chat_time) {
|
||||
this.chat_time = chat_time;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getActor_level() {
|
||||
return actor_level;
|
||||
}
|
||||
|
||||
public void setActor_level(String actor_level) {
|
||||
this.actor_level = actor_level;
|
||||
}
|
||||
|
||||
public String getActor_recharge_gold() {
|
||||
return actor_recharge_gold;
|
||||
}
|
||||
|
||||
public void setActor_recharge_gold(String actor_recharge_gold) {
|
||||
this.actor_recharge_gold = actor_recharge_gold;
|
||||
}
|
||||
|
||||
public String getTo_uid() {
|
||||
return to_uid;
|
||||
}
|
||||
|
||||
public void setTo_uid(String to_uid) {
|
||||
this.to_uid = to_uid;
|
||||
}
|
||||
|
||||
public String getTo_actor_name() {
|
||||
return to_actor_name;
|
||||
}
|
||||
|
||||
public void setTo_actor_name(String to_actor_name) {
|
||||
this.to_actor_name = to_actor_name;
|
||||
}
|
||||
|
||||
public String getTo_actor_id() {
|
||||
return to_actor_id;
|
||||
}
|
||||
|
||||
public void setTo_actor_id(String to_actor_id) {
|
||||
this.to_actor_id = to_actor_id;
|
||||
}
|
||||
|
||||
public String getTo_actor_level() {
|
||||
return to_actor_level;
|
||||
}
|
||||
|
||||
public void setTo_actor_level(String to_actor_level) {
|
||||
this.to_actor_level = to_actor_level;
|
||||
}
|
||||
|
||||
public String getTo_actor_recharge_gold() {
|
||||
return to_actor_recharge_gold;
|
||||
}
|
||||
|
||||
public void setTo_actor_recharge_gold(String to_actor_recharge_gold) {
|
||||
this.to_actor_recharge_gold = to_actor_recharge_gold;
|
||||
}
|
||||
|
||||
public String getType_id() {
|
||||
return type_id;
|
||||
}
|
||||
|
||||
public void setType_id(String type_id) {
|
||||
this.type_id = type_id;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Gson gson = new Gson();
|
||||
Report37CheckChat report37CheckChat = new Report37CheckChat();
|
||||
report37CheckChat.setTime((int)(TimeUtils.now()/1000));
|
||||
report37CheckChat.setGid(SDK37Constans.gid);
|
||||
report37CheckChat.setPid(SDK37Constans.pid);
|
||||
HttpPool.init();
|
||||
report37CheckChat.setChat_time(String.valueOf(TimeUtils.now()/1000));
|
||||
String signSt =SDK37Constans.chatKey+report37CheckChat.getUid()+report37CheckChat.getGid()+report37CheckChat.getDsid()+report37CheckChat.getTime()+report37CheckChat.getType();
|
||||
report37CheckChat.setSign(MD5Util.encrypByMd5(signSt));
|
||||
String s = gson.toJson(report37CheckChat);
|
||||
System.out.println(s);
|
||||
JSONObject jsonObject = DataMessageUtils.immediateSendPost(report37CheckChat);
|
||||
Report37Response report37Response = jsonObject.toJavaObject(Report37Response.class);
|
||||
|
||||
System.out.println(report37Response);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.ljsd.jieling.dataReport.reportBeans_37;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Report37Response {
|
||||
private int state;
|
||||
private String msg;
|
||||
private String[] data;
|
||||
|
||||
public int getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(int state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public String[] getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(String[] data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Report37Response{" +
|
||||
"state=" + state +
|
||||
", msg='" + msg + '\'' +
|
||||
", data=" + Arrays.toString(data) +
|
||||
'}';
|
||||
}
|
||||
|
||||
public Report37Response() {
|
||||
}
|
||||
|
||||
public Report37Response(int state, String msg, String[] data) {
|
||||
this.state = state;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
}
|
|
@ -1,11 +1,15 @@
|
|||
package com.ljsd.jieling.dataReport.reportBeans_37;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.json.SDK37Constans;
|
||||
import com.ljsd.jieling.config.reportData.DataMessageUtils;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.util.MD5Util;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
|
||||
import java.util.concurrent.*;
|
||||
|
||||
public class Repot37EventUtil {
|
||||
|
||||
public static void onKtEvent(User user, Report37EventType eventType, Object... parm) {
|
||||
|
@ -42,13 +46,64 @@ public class Repot37EventUtil {
|
|||
report37RoleLeveBean.setSign(MD5Util.encrypByMd5(signSt));
|
||||
DataMessageUtils.addLogQueue(report37RoleLeveBean);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public static <T> T hadResReport(Class<T> clazz,User user, Report37EventType eventType, Object... parm){
|
||||
switch (eventType) {
|
||||
case CHECK_CHAT_CONTENT:
|
||||
Report37CheckChat report37CheckChat = new Report37CheckChat();
|
||||
report37CheckChat.setTime((int)(TimeUtils.now()/1000));
|
||||
report37CheckChat.setChat_time(String.valueOf(TimeUtils.now()/1000));
|
||||
report37CheckChat.setUid(String.valueOf(user.getId()));//uid
|
||||
report37CheckChat.setGid(SDK37Constans.gid);
|
||||
report37CheckChat.setPid(SDK37Constans.pid);
|
||||
report37CheckChat.setDsid(String.valueOf(GameApplication.serverId));
|
||||
report37CheckChat.setType(parm[0].toString());//类型
|
||||
report37CheckChat.setContent(parm[1].toString());//内容
|
||||
report37CheckChat.setActor_level(String.valueOf(user.getPlayerInfoManager().getLevel()));
|
||||
report37CheckChat.setActor_recharge_gold(String.valueOf(1));//充值数
|
||||
String signChat =SDK37Constans.appkey+report37CheckChat.getUid()+report37CheckChat.getGid()+report37CheckChat.getDsid()+report37CheckChat.getTime()+report37CheckChat.getType();
|
||||
report37CheckChat.setSign(MD5Util.encrypByMd5(signChat));
|
||||
JSONObject jsonObject = DataMessageUtils.immediateSendPost(report37CheckChat);
|
||||
T t = jsonObject.toJavaObject(clazz);
|
||||
return t;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static boolean Report37Chat(User user,Object... parm){
|
||||
final ExecutorService exec = Executors.newFixedThreadPool(1);
|
||||
Callable<Report37Response> call = new Callable<Report37Response>() {
|
||||
@Override
|
||||
public Report37Response call(){
|
||||
Report37Response report37Response = hadResReport(Report37Response.class, user, Report37EventType.CHECK_CHAT_CONTENT, parm);
|
||||
return report37Response;
|
||||
}
|
||||
};
|
||||
try {
|
||||
Future<Report37Response> future = exec.submit(call);
|
||||
Report37Response response = future.get(1000*2,TimeUnit.MILLISECONDS);
|
||||
if(response.getState()!=0){
|
||||
return true;
|
||||
}
|
||||
}catch (TimeoutException ex){
|
||||
return true;
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
exec.shutdown();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public enum Report37EventType {
|
||||
ROLE_LEVEUP_EVENT,//角色升级
|
||||
TASK_FINISH_EVEMT //任务完成
|
||||
TASK_FINISH_EVEMT,//任务完成
|
||||
CHECK_CHAT_CONTENT//聊天敏感字
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -127,6 +127,8 @@ public class RedisKey {
|
|||
//公会战进攻次数缓存
|
||||
public static final String FAMILY_FIGHT_ATTACK_COUNT = "FAMILY_FIGHT_ATTACK_COUNT";
|
||||
|
||||
public static final String READY_TO_USER_MAIL = "READY_TO_USER_MAIL";
|
||||
|
||||
public static final String OPERATE_FAMILY = "OPERATE_FAMILY";
|
||||
public static final String OPERATE_FAMILY_APPLY = "OPERATE_FAMILY_APPLY";
|
||||
public static final String OPERATE_FAMILY_APPLY_JOIN = "OPERATE_FAMILY_APPLY_JOIN";
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.ljsd.jieling.handler.family;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.Family;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class FamilyChangeIconHandler extends BaseHandler<Family.ChangeIconRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.FAMILY_CHANGE_ICON_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, Family.ChangeIconRequest proto) throws Exception {
|
||||
GuildLogic.changeFamilyIcon(iSession,proto.getIconId(), MessageTypeProto.MessageType.FAMILY_CHANGE_ICON_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ import com.ljsd.jieling.core.GlobalsDef;
|
|||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -34,9 +35,11 @@ public class GuildInfo extends MongoBase {
|
|||
|
||||
private int totalMembers;
|
||||
|
||||
private Map<Integer,Integer> defendInfo;
|
||||
private Map<Integer,Integer> defendInfo = new HashMap<>();
|
||||
|
||||
private Map<Integer,Integer> fightResult;
|
||||
private Map<Integer,Integer> fightResult = new HashMap<>();
|
||||
|
||||
private int icon;
|
||||
|
||||
public GuildInfo() {
|
||||
setRootCollection(_COLLECTION_NAME);
|
||||
|
@ -146,4 +149,20 @@ public class GuildInfo extends MongoBase {
|
|||
defendInfo.remove(uid);
|
||||
removeString(getMongoKey()+".defendInfo."+uid);
|
||||
}
|
||||
|
||||
public int getIcon() {
|
||||
return icon;
|
||||
}
|
||||
public void updateIcon(int icon){
|
||||
updateString("icon",icon);
|
||||
}
|
||||
public int getResult(int type){
|
||||
return fightResult.get(type)==null?0:fightResult.get(type);
|
||||
}
|
||||
public void updateResult(int type,int value){
|
||||
//1、胜利,2、平,3、失败
|
||||
fightResult.put(type,value);
|
||||
updateString("fightResult."+type,value);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.logic.family;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.jieling.config.SGuildLevelConfig;
|
||||
import com.ljsd.jieling.config.SGuildSetting;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
@ -229,14 +230,19 @@ public class GuildFightLogic {
|
|||
Set<String> rank = redisUtil.getZset(key, 0, redisUtil.getZsetSize(key));
|
||||
SGuildSetting guildSetting = SGuildSetting.sGuildSetting;
|
||||
for (Integer gid : guildIds) {
|
||||
Map<Integer, SGuildLevelConfig> configMap = SGuildLevelConfig.sGuildLevelConfigMap;
|
||||
//匹配处理
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(gid);
|
||||
int guildTotalExp = guildInfo.getExp();
|
||||
for(int i = 1 ; i <guildInfo.getLevel();i++){
|
||||
guildTotalExp = configMap.get(i).getExp();
|
||||
}
|
||||
if (guildInfo.getDefendInfo() != null && guildInfo.getDefendInfo().size() > 0) {
|
||||
String matchingKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_MATCHING_RANK, "", false);
|
||||
int random = MathUtils.randomInt(30);
|
||||
if (!rank.contains(gid.toString())) {
|
||||
redisUtil.zsetAddOne(key, gid.toString(), 100);
|
||||
redisUtil.zsetAddOne(matchingKey, gid.toString(), 100 + random);
|
||||
redisUtil.zsetAddOne(key, gid.toString(), guildTotalExp);
|
||||
redisUtil.zsetAddOne(matchingKey, gid.toString(), guildTotalExp + random);
|
||||
} else {
|
||||
Double zSetScore = redisUtil.getZSetScore(RedisKey.FAMILY_FIGHT_RANK, "", gid.toString());
|
||||
redisUtil.zsetAddOne(matchingKey, gid.toString(), zSetScore + random);
|
||||
|
@ -538,30 +544,31 @@ public class GuildFightLogic {
|
|||
String matchingKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_MATCHING_RANK,"",false);
|
||||
//攻击次数信息
|
||||
String attackCountKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_ATTACK_COUNT, "", false);
|
||||
//布防信息
|
||||
String familyFightKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT, "", false);
|
||||
//建筑buff信息
|
||||
String familyBuffKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_MATCHING_RANK, "", false);
|
||||
//获得星数信息
|
||||
String familyFightCalStarKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_CAL_STAR, "", false);
|
||||
redisUtil.del(attackCountKey,matchingKey,familyFightKey,familyBuffKey,familyFightCalStarKey);
|
||||
// for(String index:matchingRank){
|
||||
// Map<Integer, FamilyFightInfo> fightDefend = redisUtil.getMapValues(RedisKey.FAMILY_FIGHT, index, Integer.class, FamilyFightInfo.class);
|
||||
// for (Map.Entry<Integer, FamilyFightInfo> defendEntry:fightDefend.entrySet()){
|
||||
// //删除布防信息
|
||||
// redisUtil.removeMapEntrys(RedisKey.FAMILY_FIGHT,index,defendEntry.getKey());
|
||||
// //删除公会结算
|
||||
// String starRankKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_STAR_RANK, String.valueOf(index), false);
|
||||
// redisUtil.removeZSetRangeByRank(starRankKey,0,redisUtil.getZsetSize(starRankKey));
|
||||
// }
|
||||
// for(int i = 1;i<=3;i++){
|
||||
// //删除获得星数信息
|
||||
// if(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_CAL_STAR,String.valueOf(index),String.valueOf(i),Integer.class)!=null){
|
||||
// redisUtil.removeMapEntrys(RedisKey.FAMILY_FIGHT_CAL_STAR,String.valueOf(index),i);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//删除匹配信息
|
||||
|
||||
Set<String> matchingRank = redisUtil.getZset(matchingKey, 0, redisUtil.getZsetSize(matchingKey));
|
||||
for(String index:matchingRank){
|
||||
Map<Integer, FamilyFightInfo> fightDefend = redisUtil.getMapValues(RedisKey.FAMILY_FIGHT, index, Integer.class, FamilyFightInfo.class);
|
||||
for (Map.Entry<Integer, FamilyFightInfo> defendEntry:fightDefend.entrySet()){
|
||||
//删除布防信息
|
||||
redisUtil.removeMapEntrys(RedisKey.FAMILY_FIGHT,index,defendEntry.getKey().toString());
|
||||
//删除公会结算
|
||||
String starRankKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_STAR_RANK, String.valueOf(index), false);
|
||||
redisUtil.removeZSetRangeByRank(starRankKey,0,redisUtil.getZsetSize(starRankKey));
|
||||
}
|
||||
for(int i = 1;i<=3;i++){
|
||||
//删除获得星数信息
|
||||
if(redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_CAL_STAR,String.valueOf(index),String.valueOf(i),Integer.class)!=null){
|
||||
redisUtil.removeMapEntrys(RedisKey.FAMILY_FIGHT_CAL_STAR,String.valueOf(index),String.valueOf(i));
|
||||
}
|
||||
}
|
||||
for(int i = 0 ;i<4;i++){
|
||||
//删除buff信息
|
||||
redisUtil.removeMapEntrys(RedisKey.FAMILY_FIGHT_BUFF,index,String.valueOf(i));
|
||||
}
|
||||
}
|
||||
redisUtil.del(matchingKey,attackCountKey);
|
||||
|
||||
// 删除匹配信息
|
||||
// redisUtil.removeZSetRangeByRank(matchingKey,0,redisUtil.getZsetSize(matchingKey));
|
||||
}
|
||||
/**
|
||||
|
@ -570,9 +577,7 @@ public class GuildFightLogic {
|
|||
public void accountFamilyFightResult() {
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_MATCHING_RANK,"",false);
|
||||
|
||||
int size = redisUtil.getZsetSize(key);
|
||||
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = redisUtil.getZsetreverseRangeWithScores(RedisKey.FAMILY_FIGHT_MATCHING_RANK, "", 0, size);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import com.ljsd.jieling.config.SChallengeMapConfig;
|
|||
import com.ljsd.jieling.config.SErrorCodeEerverConfig;
|
||||
import com.ljsd.jieling.config.SGuildSetting;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Repot37EventUtil;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
@ -107,6 +109,9 @@ public class GuildLogic {
|
|||
}
|
||||
|
||||
public static String checkForCreateGuild( User user,String familyName,String announce) throws Exception {
|
||||
if(!Repot37EventUtil.Report37Chat(user, ChatContentType.FAMILY_NAME.getType(),announce)){
|
||||
return "包含敏感字";
|
||||
}
|
||||
if(StringUtil.isEmpty(familyName)){
|
||||
return "名字不能为空";
|
||||
}
|
||||
|
@ -550,12 +555,16 @@ public class GuildLogic {
|
|||
return;
|
||||
}
|
||||
|
||||
if(!Repot37EventUtil.Report37Chat(user, ChatContentType.ANNOUNCE.getType(),content)){
|
||||
MessageUtil.sendErrorResponse(session, 0, msgId, "包含敏感字");
|
||||
return;
|
||||
}
|
||||
boolean result = ShieldedWordUtils.checkName(content,false);
|
||||
int resultCode = 1;
|
||||
String err = "修改成功";
|
||||
if (!result) {
|
||||
err="包含铭感字";
|
||||
resultCode = 0;
|
||||
err="包含铭感字";
|
||||
resultCode = 0;
|
||||
}
|
||||
guildInfo.setAnnounce(content);
|
||||
sendFamilyBaseUpdateIndication(guildInfo);
|
||||
|
@ -790,4 +799,15 @@ public class GuildLogic {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改公会图腾
|
||||
* @param session
|
||||
* @param iconId
|
||||
* @param messageType
|
||||
*/
|
||||
public static void changeFamilyIcon(ISession session, int iconId, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
PlayerManager playerInfoManager = UserManager.getUser(session.getUid()).getPlayerInfoManager();
|
||||
GuilidManager.guildInfoMap.get(playerInfoManager.getGuildId()).updateIcon(iconId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package com.ljsd.jieling.logic.mail;
|
||||
|
||||
public class MailCache {
|
||||
private String title;
|
||||
private String content;
|
||||
private String from;
|
||||
private String reward;
|
||||
private int time;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public void setFrom(String from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(int time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public void setReward(String reward) {
|
||||
this.reward = reward;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,8 @@ package com.ljsd.jieling.logic.mail;
|
|||
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
|
@ -266,4 +268,17 @@ public class MailLogic {
|
|||
LOGGER.info("sendMail==>uid={},title={},reward:{}",uid,title,reward);
|
||||
MessageUtil.sendRedIndication(uid, GlobalsDef.MAIL_RED_TYPE);
|
||||
}
|
||||
/**
|
||||
*每分钟检测是否有需要发的邮件
|
||||
*/
|
||||
public void checkReadyToMail() throws Exception {
|
||||
Map<String, MailCache> mails = RedisUtil.getInstence().getMapValues(RedisKey.READY_TO_USER_MAIL, "", String.class, MailCache.class);
|
||||
if (mails.size()<0){
|
||||
return;
|
||||
}
|
||||
for(Map.Entry<String, MailCache> mail:mails.entrySet()){
|
||||
sendMail(Integer.parseInt(mail.getKey()),mail.getValue().getTitle(),mail.getValue().getContent(),mail.getValue().getReward(),mail.getValue().getTime(),0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.ljsd.jieling.logic.arena.ArenaLogic;
|
|||
import com.ljsd.jieling.logic.family.GuildFightLogic;
|
||||
import com.ljsd.jieling.logic.fight.CheckFight;
|
||||
import com.ljsd.jieling.logic.fight.CombatLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -51,6 +52,7 @@ public class MinuteTask extends Thread {
|
|||
CheckFight.getInstance().luaHotFix();
|
||||
MongoUtil.getInstence().lastUpdate();
|
||||
GuildFightLogic.familyFightStatus();
|
||||
MailLogic.getInstance().checkReadyToMail();
|
||||
LOGGER.info("MinuteTask end...");
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("e",e);
|
||||
|
|
|
@ -78,7 +78,7 @@ public class HttpPool {
|
|||
return null;
|
||||
}
|
||||
|
||||
public static void sendPost(String url, String info) {
|
||||
public static JSONObject sendPost(String url, String info) {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
HttpResponse httpResponse;
|
||||
int sendTimes = 0;
|
||||
|
@ -93,13 +93,14 @@ public class HttpPool {
|
|||
|
||||
httpResponse = httpclient.execute(httpPost);
|
||||
HttpEntity responseEntity = httpResponse.getEntity();
|
||||
EntityUtils.consume(responseEntity);
|
||||
int statusCode = httpResponse.getStatusLine().getStatusCode();
|
||||
if (statusCode >= 200 && statusCode < 300) {
|
||||
needBack = false;
|
||||
|
||||
String result = EntityUtils.toString(responseEntity,"UTF-8");
|
||||
LOGGER.debug("Http Send,第" + (sendTimes + 1) + "次调用成功,返回码为:[" + statusCode + "]");
|
||||
break;
|
||||
EntityUtils.consume(responseEntity);
|
||||
return JSONObject.parseObject(result);
|
||||
// break;
|
||||
} else {
|
||||
LOGGER.error("Http Send,第" + (sendTimes + 1) + "次调用出错,返回码为:[" + statusCode + "]");
|
||||
if (sendTimes + 1 <= maxSendTimes) {
|
||||
|
@ -112,6 +113,7 @@ public class HttpPool {
|
|||
} else {
|
||||
LOGGER.debug("Http Send,达到重发最大次数,退出程序!");
|
||||
}
|
||||
EntityUtils.consume(responseEntity);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Http Send error",e);
|
||||
|
@ -122,6 +124,7 @@ public class HttpPool {
|
|||
if(needBack){
|
||||
BackErrorLog.info(info);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main (String [] args){
|
||||
|
|
Loading…
Reference in New Issue