开服冲榜优化
parent
2e8ee8398a
commit
26fed76685
|
@ -9,7 +9,9 @@ import com.ljsd.jieling.logic.dao.root.User;
|
||||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||||
import com.ljsd.jieling.logic.rank.RankContext;
|
import com.ljsd.jieling.logic.rank.RankContext;
|
||||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||||
|
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||||
import com.ljsd.jieling.thread.ThreadManager;
|
import com.ljsd.jieling.thread.ThreadManager;
|
||||||
|
import com.ljsd.jieling.util.AyyncWorker;
|
||||||
import com.ljsd.jieling.util.ItemUtil;
|
import com.ljsd.jieling.util.ItemUtil;
|
||||||
import com.ljsd.jieling.util.ToolsUtil;
|
import com.ljsd.jieling.util.ToolsUtil;
|
||||||
import config.*;
|
import config.*;
|
||||||
|
@ -165,32 +167,38 @@ public class OpenServerCompeteRankActivity extends AbstractActivity {
|
||||||
LOGGER.error("开服冲榜id为{}的玩家,{}活动,{}排行奖励发送失败,原因玩家不存在", uid, id, rankType);
|
LOGGER.error("开服冲榜id为{}的玩家,{}活动,{}排行奖励发送失败,原因玩家不存在", uid, id, rankType);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
|
||||||
if (mission == null){
|
|
||||||
LOGGER.error("开服冲榜id为{}的玩家,{}活动,{}排行奖励发送失败,原因活动不存在", uid, id, rankType);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ActivityProgressInfo progressInfo = mission.getActivityMissionMap().get(rankType);
|
|
||||||
if (progressInfo != null && progressInfo.getState() == 2){
|
|
||||||
LOGGER.error("开服冲榜id为{}的玩家,{}活动,{}排行奖励发送失败,奖励已发送,{}-{}", uid, id, rankType, progressInfo.getProgrss(),progressInfo.getState());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//sendmail
|
|
||||||
String title = getMailTitle(rankType);
|
|
||||||
String content = getMailContent(rankType, score.longValue(), rank);
|
|
||||||
int[][] reward = getMailReward(rankType, rank);
|
|
||||||
if (reward == null){
|
|
||||||
LOGGER.error("冲榜发奖,玩家排名不发奖励,uid:{},rankid:{}, score:{}",user.getId(),rank,score.longValue());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String mailReward = ItemUtil.getMailReward(reward);
|
|
||||||
MailLogic.getInstance().sendMail(uid, title, content, mailReward, TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
|
||||||
//update activity
|
|
||||||
ActivityProgressInfo info = new ActivityProgressInfo();
|
|
||||||
info.setState(2);
|
|
||||||
info.setProgrss(TimeUtils.nowInt());
|
|
||||||
mission.getActivityMissionMap().put(rankType, info);
|
|
||||||
LOGGER.info("冲榜发奖中:{}-{}-{}",id,rankType,uid);
|
LOGGER.info("冲榜发奖中:{}-{}-{}",id,rankType,uid);
|
||||||
|
|
||||||
|
final int rankId = rank;
|
||||||
|
long value = score.longValue();
|
||||||
|
AyyncWorker ayyncWorker = new AyyncWorker(user, true, user1 -> {
|
||||||
|
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||||
|
if (mission == null){
|
||||||
|
LOGGER.error("开服冲榜id为{}的玩家,{}活动,{}排行奖励发送失败,原因活动不存在", uid, id, rankType);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ActivityProgressInfo progressInfo = mission.getActivityMissionMap().get(rankType);
|
||||||
|
if (progressInfo != null && progressInfo.getState() == 2){
|
||||||
|
LOGGER.error("开服冲榜id为{}的玩家,{}活动,{}排行奖励发送失败,奖励已发送,{}-{}", uid, id, rankType, progressInfo.getProgrss(),progressInfo.getState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//sendmail
|
||||||
|
String title = getMailTitle(rankType);
|
||||||
|
String content = getMailContent(rankType, value, rankId);
|
||||||
|
int[][] reward = getMailReward(rankType, rankId);
|
||||||
|
if (reward == null){
|
||||||
|
LOGGER.error("冲榜发奖,玩家排名不发奖励,uid:{},rankid:{}, score:{}",user.getId(),rankId, value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String mailReward = ItemUtil.getMailReward(reward);
|
||||||
|
MailLogic.getInstance().sendMail(uid, title, content, mailReward, TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||||
|
//update activity
|
||||||
|
ActivityProgressInfo info = new ActivityProgressInfo();
|
||||||
|
info.setState(2);
|
||||||
|
info.setProgrss(TimeUtils.nowInt());
|
||||||
|
mission.getActivityMissionMap().put(rankType, info);
|
||||||
|
});
|
||||||
|
ProtocolsManager.getInstance().updateAyncWorker(ayyncWorker);
|
||||||
rank++;
|
rank++;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOGGER.error("冲榜id为{}的玩家,{}活动,{}排行奖励发送失败e={}", uid, id, rankType, e);
|
LOGGER.error("冲榜id为{}的玩家,{}活动,{}排行奖励发送失败e={}", uid, id, rankType, e);
|
||||||
|
|
Loading…
Reference in New Issue