发送分组邮件,删除无用代码
parent
e47eaeb8bd
commit
90af84ac12
|
@ -196,14 +196,10 @@ public class RedisKey {
|
|||
|
||||
//问卷调查
|
||||
public static final String QUESTION_FROMBACK = "QUESTION_FROMBACK";
|
||||
public static final String BLOODY_RANK = "BLOODY_RANK";
|
||||
|
||||
public static final String MATCH_UID_KEY = "MATCH_UID_KEY";
|
||||
public static final String BLOODY_TEAM = "BLOODY_TEAM";
|
||||
public static final String BLOODY_PERSON_BATTLE_INFO = "BLOODY_PERSON_BATTLE_INFO";
|
||||
public static final String MATCH_SERVER_INFO = "MATCH_SERVER_INFO";
|
||||
public static final String LOGIC_SERVER_INFO = "LOGIC_SERVER_INFO";
|
||||
public static final String BLOODY_SERVER_INFO = "BLOODY_SERVER_INFO";
|
||||
|
||||
public static final String AUTOOPENTIME = "AUTOOPENTIME";
|
||||
|
||||
|
@ -320,6 +316,8 @@ public class RedisKey {
|
|||
|
||||
public static final String SERVER_SPLIT_INFO = "SERVER_SPLIT_INFO";
|
||||
|
||||
public static final String SERVER_SPLIT_MAIL_INFO = "SERVER_SPLIT_MAIL_INFO";
|
||||
|
||||
|
||||
public static Set<String> familyKey = new HashSet<>();
|
||||
|
||||
|
|
|
@ -1249,8 +1249,7 @@ public class RedisUtil {
|
|||
|
||||
public String getKey(String type,String key){
|
||||
|
||||
if(RedisKey.BLOODY_RANK.equals(type) || RedisKey.BLOODY_TEAM.equals(type) || RedisKey.PLAYER_INFO_CACHE.equals(type) || RedisKey.BLOODY_PERSON_BATTLE_INFO.equals(type)
|
||||
||RedisKey.FAMILY_INFO.equals(type)||RedisKey.PIDGIDTEMP.equals(type)||RedisKey.SERVER_WORLDLEVE_INFO.equals(type)|| RedisKey.GUILD_INFO_CACHE.equals(type)||RedisKey.SERVER_SPLIT_INFO.equals(type)) {
|
||||
if(RedisKey.PLAYER_INFO_CACHE.equals(type) ||RedisKey.FAMILY_INFO.equals(type)||RedisKey.PIDGIDTEMP.equals(type)||RedisKey.SERVER_WORLDLEVE_INFO.equals(type)|| RedisKey.GUILD_INFO_CACHE.equals(type)||RedisKey.SERVER_SPLIT_INFO.equals(type)||RedisKey.SERVER_SPLIT_MAIL_INFO.equals(type)) {
|
||||
return type + RedisKey.Delimiter_colon + key;
|
||||
}
|
||||
// if(RedisKey.familyKey.contains(type)){
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.jieling.logic.blood.BloodLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class BloodRankHandler extends BaseHandler{
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.BLOOD_RANK_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession iSession, PacketNetData netData) throws Exception {
|
||||
BloodLogic.getInstance().getBloodRank(iSession, MessageTypeProto.MessageType.BLOOD_RANK_RESPONSE);
|
||||
}
|
||||
}
|
|
@ -129,8 +129,6 @@ public class RoomMatchRequestHandler extends BaseHandler{
|
|||
maxHp += familyHeroInfo.getAttribute().get(HeroAttributeEnum.Hp.getPropertyId());
|
||||
}
|
||||
userBloodySnpInfo.setMaxHp(maxHp);
|
||||
String key = RedisUtil.getInstence().getKey(RedisKey.BLOODY_TEAM, Integer.toString(mine.getId()));
|
||||
RedisUtil.getInstence().set(key,gson.toJson(userBloodySnpInfo));
|
||||
}
|
||||
|
||||
private boolean isEnter(){
|
||||
|
|
|
@ -257,13 +257,12 @@ public class GlobleSystemLogic implements IEventHandler {
|
|||
index++;
|
||||
}
|
||||
redisUtil.putMapEntrys(RedisKey.SERVER_SPLIT_INFO,"",split);
|
||||
//todo 发分组邮件
|
||||
// sendMail(split.keySet());
|
||||
//发分组邮件
|
||||
split.keySet().forEach(server->redisUtil.putMapEntry(RedisKey.SERVER_SPLIT_MAIL_INFO,"",server,0));
|
||||
}
|
||||
LOGGER.info("Global分组结束");
|
||||
// splitInfo = RedisUtil.getInstence().getMapValues(RedisKey.SERVER_SPLIT_INFO,"",String.class,Integer.class);
|
||||
}
|
||||
|
||||
//获取当前区服的跨服区组 -1为未在分组内
|
||||
public int getCrossGroup(){
|
||||
if(crossGroup==0){
|
||||
|
|
|
@ -143,65 +143,6 @@ public class BloodLogic {
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* 获取血战排行榜
|
||||
* @param session
|
||||
* @param messageType
|
||||
*/
|
||||
public void getBloodRank(ISession session, MessageTypeProto.MessageType messageType){
|
||||
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.BLOODY_RANK, "1", 0, 100);
|
||||
Map<Integer, PlayerInfoCache> playerInfoCacheMap = RedisUtil.getInstence().getMapValues(RedisKey.PLAYER_INFO_CACHE, "", Integer.class, PlayerInfoCache.class);
|
||||
int rank = 0;
|
||||
RoomProto.BloodRankResponse.Builder response = RoomProto.BloodRankResponse.newBuilder();
|
||||
for(ZSetOperations.TypedTuple<String> blood:zsetreverseRangeWithScores){
|
||||
rank++;
|
||||
PlayerInfoCache cache = playerInfoCacheMap.get(Integer.parseInt(blood.getValue()));
|
||||
CommonProto.BloodPersonInfo info = CommonProto.BloodPersonInfo.newBuilder()
|
||||
.setHead(cache.getHead())
|
||||
.setId(Integer.parseInt(blood.getValue()))
|
||||
.setHeadFrame(cache.getHeadFrame())
|
||||
.setLevel(cache.getLevel())
|
||||
.setServerId(cache.getServerId())
|
||||
.setScore(blood.getScore().intValue())
|
||||
.setRank(rank)
|
||||
.setName(cache.getName())
|
||||
.build();
|
||||
response.addInfos(info);
|
||||
}
|
||||
int myRank= RedisUtil.getInstence().getZSetreverseRank(RedisKey.BLOODY_RANK,"1",Integer.toString(session.getUid())).intValue();
|
||||
response.setMyRank(myRank);
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
public void bloodSeasonReward() throws Exception {
|
||||
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.BLOODY_RANK, "1", 0, RedisUtil.getInstence().getZsetSize(RedisKey.getKey(RedisKey.BLOODY_RANK, "1", true)));
|
||||
Map<Integer, PlayerInfoCache> players = RedisUtil.getInstence().getMapValues(RedisKey.PLAYER_INFO_CACHE, "", Integer.class, PlayerInfoCache.class);
|
||||
Map<Integer, SBloodyRankConfig> sBloodyRankConfigMap = STableManager.getConfig(SBloodyRankConfig.class);
|
||||
int floor = 0 ;
|
||||
for(ZSetOperations.TypedTuple<String> rank:zsetreverseRangeWithScores){
|
||||
//是否为本服玩家
|
||||
if(players.get(Integer.parseInt(rank.getValue())).getServerId()!= GameApplication.serverId){
|
||||
continue;
|
||||
}
|
||||
int[][] reward;
|
||||
for(Map.Entry<Integer, SBloodyRankConfig> entry:sBloodyRankConfigMap.entrySet()){
|
||||
SBloodyRankConfig value = entry.getValue();
|
||||
if(rank.getScore()>value.getScore()){
|
||||
floor = entry.getKey();
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(floor==0){
|
||||
continue;
|
||||
}else{
|
||||
reward = sBloodyRankConfigMap.get(floor).getReward();
|
||||
MailLogic.getInstance().sendMail(Integer.parseInt(rank.getValue()),"血战排行奖励","恭喜",StringUtil.parseArrayToString(reward), (int)(TimeUtils.now()/1000),10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//获取血战积分以及领取状态信息
|
||||
public void getBloodySsoreInfo(ISession session) throws Exception {
|
||||
|
|
|
@ -18,6 +18,9 @@ public class ServerConfig extends MongoBase {
|
|||
@Field(value = "n_world_level")
|
||||
private int new_worldLevel;// 新的世界等级计算 等级前50的玩家
|
||||
|
||||
@Field(value = "groupCount")
|
||||
private int groupCount;
|
||||
|
||||
@Transient
|
||||
private long cacheOpenTime;
|
||||
|
||||
|
@ -44,4 +47,12 @@ public class ServerConfig extends MongoBase {
|
|||
public void setCacheOpenTime(long cacheOpenTime) {
|
||||
this.cacheOpenTime = cacheOpenTime;
|
||||
}
|
||||
|
||||
public int getGroupCount() {
|
||||
return groupCount;
|
||||
}
|
||||
|
||||
public void setGroupCount(int groupCount) {
|
||||
this.groupCount = groupCount;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.logic.mail;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
|
@ -16,6 +17,7 @@ import com.ljsd.jieling.logic.dao.root.MailingSystem;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import org.luaj.vm2.ast.Str;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
@ -288,7 +290,8 @@ public class MailLogic {
|
|||
AutoIncrementManager autoIncrementManager = mailingSystem.getcAutoIncrementManager();
|
||||
autoIncrementManager.addAutoIncrement(new AutoIncrement(name));
|
||||
SystemMailManager systemMailManager = mailingSystem.getSystemMailManager();
|
||||
int id = getSystemMailId(autoIncrementManager,name);
|
||||
// getSystemMailId(autoIncrementManager,name);
|
||||
int id = TimeUtils.nowInt();
|
||||
systemMailManager.addSystemMail(new SystemMail(id,title,userList,content,sendTime,reward,effectiveTime,sendName,registerEndTime,version));
|
||||
MongoUtil.getInstence().lastUpdate();
|
||||
}
|
||||
|
@ -366,6 +369,12 @@ public class MailLogic {
|
|||
}
|
||||
redisUtil.del(RedisKey.getKey(RedisKey.MAIL_RED_POINT,"",false));
|
||||
}
|
||||
//检测跨服分组邮件
|
||||
Integer split = redisUtil.getMapValue(RedisKey.SERVER_SPLIT_MAIL_INFO, "", String.valueOf(GameApplication.serverId), Integer.class);
|
||||
if(split!=null){
|
||||
sendServerSplitMail();
|
||||
redisUtil.removeMapEntrys(RedisKey.SERVER_SPLIT_MAIL_INFO, "", String.valueOf(GameApplication.serverId));
|
||||
}
|
||||
//检测个人邮件
|
||||
Map<String, MailCache> mails =redisUtil.getMapValues(RedisKey.READY_TO_USER_MAIL, "", String.class, MailCache.class);
|
||||
if (mails.size()<1){
|
||||
|
@ -376,12 +385,34 @@ public class MailLogic {
|
|||
}
|
||||
redisUtil.del(RedisKey.getKey(RedisKey.READY_TO_USER_MAIL,"",false));
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
|
||||
}catch(Exception e){
|
||||
LOGGER.info("发送邮件异常{}",e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void sendServerSplitMail() throws Exception {
|
||||
int nowTime = TimeUtils.nowInt();
|
||||
String title ;
|
||||
String content ;
|
||||
//todo 发邮件
|
||||
|
||||
ServerConfig serverConfigTmp = MongoUtil.getInstence().getMyMongoTemplate().findById(1, ServerConfig.class);
|
||||
if(serverConfigTmp.getGroupCount()==0){
|
||||
//首次
|
||||
title = SErrorCodeEerverConfig.getI18NMessage("mserverarena_join_group_mail_title");
|
||||
content = SErrorCodeEerverConfig.getI18NMessage("mserverarena_join_group_mail_content");
|
||||
}else{
|
||||
title = SErrorCodeEerverConfig.getI18NMessage("mserverarena_change_group_mail_title");
|
||||
content = SErrorCodeEerverConfig.getI18NMessage("mserverarena_change_group_mail_content");
|
||||
}
|
||||
serverConfigTmp.setGroupCount(serverConfigTmp.getGroupCount()+1);
|
||||
MongoUtil.getInstence().getMyMongoTemplate().saveWithoutMongoRoot(serverConfigTmp);
|
||||
|
||||
MailLogic.getInstance().sendSystemMail(title,new ArrayList<>(),content,nowTime,"",30*24*60*60,"system",TimeUtils.now(),"0");
|
||||
}
|
||||
|
||||
/**
|
||||
*手动删除邮件
|
||||
*/
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
package com.ljsd.jieling.thread.task;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.bloody.SortDataBean;
|
||||
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||
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.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.blood.BloodLogic;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.util.AyncWorkerRunnable;
|
||||
import com.ljsd.jieling.util.AyyncWorker;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class FetchBloodyEndDataThread extends Thread{
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FetchBloodyEndDataThread.class);
|
||||
|
||||
public FetchBloodyEndDataThread(){
|
||||
this.setName("FetchBloodyEndDataThread");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Map<Integer, SortDataBean> mapValues = RedisUtil.getInstence().getMapValues(RedisKey.BLOODY_PERSON_BATTLE_INFO, Integer.toString(GameApplication.serverId), Integer.class, SortDataBean.class);
|
||||
for(SortDataBean sortDataBean : mapValues.values()){
|
||||
int uid = sortDataBean.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
AyyncWorker ayyncWorker = new AyyncWorker(user, true,(user1) ->
|
||||
BloodLogic.getInstance().calBloodyMissionInfo(user1,sortDataBean)
|
||||
);
|
||||
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
|
||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.BLOODY_PERSON_BATTLE_INFO, Integer.toString(GameApplication.serverId),Integer.toString(uid));
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
LOGGER.error("e->",e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue