排行榜问题,和发奖时间日志
parent
36e07bc438
commit
a7b964ffcc
|
@ -1272,8 +1272,7 @@ public class TimeUtils {
|
|||
public static int getHourOfDay() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
||||
return hour;
|
||||
return calendar.get(Calendar.HOUR_OF_DAY);
|
||||
}
|
||||
/**
|
||||
* 获得当前时间是今天的几点(整点)
|
||||
|
@ -1283,8 +1282,7 @@ public class TimeUtils {
|
|||
public static int getMiunte() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||
int minute = calendar.get(Calendar.MINUTE);
|
||||
return minute;
|
||||
return calendar.get(Calendar.MINUTE);
|
||||
}
|
||||
/**
|
||||
* 获得当前时间是今天的几点(整点)
|
||||
|
@ -1294,8 +1292,7 @@ public class TimeUtils {
|
|||
public static int getMiunte(long time) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(time);
|
||||
int minute = calendar.get(Calendar.MINUTE);
|
||||
return minute;
|
||||
return calendar.get(Calendar.MINUTE);
|
||||
}
|
||||
|
||||
// /**
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
|
@ -24,7 +25,7 @@ public class CrossRank extends AbstractRank {
|
|||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
return data[0];
|
||||
return data[0]+ TimeUtils.getDoubleTime();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -433,39 +433,38 @@ public class SevenWorldLogic {
|
|||
* 结束发送奖励
|
||||
*/
|
||||
public void sendRankReward(){
|
||||
if (!isTime()){
|
||||
return;
|
||||
}
|
||||
// 排行榜
|
||||
String crossRedisKey = RankContext.getRankEnum(RankEnum.CROSS_SEVEN_WORLD_RANK.getType()).getCrossRedisKey();
|
||||
Set<ZSetOperations.TypedTuple<String>> range = RedisUtil.getInstence().getZsetreverseRangeWithScores(crossRedisKey,"",0,-1,false);
|
||||
// 排名
|
||||
int rank = 1;
|
||||
for (ZSetOperations.TypedTuple<String> tuple : range) {
|
||||
User user = UserManager.getUserNotCache(Integer.parseInt(tuple.getValue()));
|
||||
if (user == null){
|
||||
return;
|
||||
}
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("Qijie_mail_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("Qijie_mail_txt", new Object[]{rank},new int[0],"#");
|
||||
// 排行奖励
|
||||
Map<Integer, SQijieRanking> config = STableManager.getConfig(SQijieRanking.class);
|
||||
for (SQijieRanking value : config.values()) {
|
||||
// 排名区间
|
||||
if (rank >= value.getMinRank() && rank <= value.getMaxRank()){
|
||||
// 发邮件奖励
|
||||
String reward = StringUtil.parseArrayToString(value.getRankingReward());
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
// 清除道具
|
||||
ItemLogic.getInstance().functionEndClearItem(user.getId(),FunctionIdEnum.CrossSevenWorld.getFunctionType(),BIReason.SEVEN_WORLD_FUNCTION_END);
|
||||
LOGGER.info("七界结束,发送邮件并删除道具,uid:{},奖励:{},",user.getId(),reward);
|
||||
break;
|
||||
if (isTime()){
|
||||
// 排行榜
|
||||
String crossRedisKey = RankContext.getRankEnum(RankEnum.CROSS_SEVEN_WORLD_RANK.getType()).getCrossRedisKey();
|
||||
Set<ZSetOperations.TypedTuple<String>> range = RedisUtil.getInstence().getZsetreverseRangeWithScores(crossRedisKey,"",0,-1,false);
|
||||
// 排名
|
||||
int rank = 1;
|
||||
for (ZSetOperations.TypedTuple<String> tuple : range) {
|
||||
User user = UserManager.getUserNotCache(Integer.parseInt(tuple.getValue()));
|
||||
if (user == null){
|
||||
return;
|
||||
}
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("Qijie_mail_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("Qijie_mail_txt", new Object[]{rank},new int[0],"#");
|
||||
// 排行奖励
|
||||
Map<Integer, SQijieRanking> config = STableManager.getConfig(SQijieRanking.class);
|
||||
for (SQijieRanking value : config.values()) {
|
||||
// 排名区间
|
||||
if (rank >= value.getMinRank() && rank <= value.getMaxRank()){
|
||||
// 发邮件奖励
|
||||
String reward = StringUtil.parseArrayToString(value.getRankingReward());
|
||||
MailLogic.getInstance().sendMail(user.getId(),title,content,reward,TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
// 清除道具
|
||||
ItemLogic.getInstance().functionEndClearItem(user.getId(),FunctionIdEnum.CrossSevenWorld.getFunctionType(),BIReason.SEVEN_WORLD_FUNCTION_END);
|
||||
LOGGER.info("七界结束,发送邮件并删除道具,uid:{},奖励:{},",user.getId(),reward);
|
||||
break;
|
||||
}
|
||||
}
|
||||
rank++;
|
||||
}
|
||||
rank++;
|
||||
SevenWorldLogic.setEnd(true);
|
||||
System.out.print("七界试炼活动结束,发奖完成...\n");
|
||||
}
|
||||
SevenWorldLogic.setEnd(true);
|
||||
System.out.print("七界试炼活动结束,发奖完成...\n");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -476,7 +475,9 @@ public class SevenWorldLogic {
|
|||
int week = TimeUtils.getDayOfWeek();
|
||||
int hour = TimeUtils.getHourOfDay();
|
||||
int minute = TimeUtils.getMiunte();
|
||||
return week == 7 && hour == 23 && minute == 30;
|
||||
boolean b = week == 7 && hour == 23 && minute == 30;
|
||||
LOGGER.info("当前时间:week:{},hour:{},minute:{},result:{}",week,hour,minute,b);
|
||||
return b;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue