排行榜问题,和发奖时间日志
parent
36e07bc438
commit
a7b964ffcc
|
@ -1272,8 +1272,7 @@ public class TimeUtils {
|
||||||
public static int getHourOfDay() {
|
public static int getHourOfDay() {
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
int hour = calendar.get(Calendar.HOUR_OF_DAY);
|
return calendar.get(Calendar.HOUR_OF_DAY);
|
||||||
return hour;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 获得当前时间是今天的几点(整点)
|
* 获得当前时间是今天的几点(整点)
|
||||||
|
@ -1283,8 +1282,7 @@ public class TimeUtils {
|
||||||
public static int getMiunte() {
|
public static int getMiunte() {
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
int minute = calendar.get(Calendar.MINUTE);
|
return calendar.get(Calendar.MINUTE);
|
||||||
return minute;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 获得当前时间是今天的几点(整点)
|
* 获得当前时间是今天的几点(整点)
|
||||||
|
@ -1294,8 +1292,7 @@ public class TimeUtils {
|
||||||
public static int getMiunte(long time) {
|
public static int getMiunte(long time) {
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTimeInMillis(time);
|
calendar.setTimeInMillis(time);
|
||||||
int minute = calendar.get(Calendar.MINUTE);
|
return calendar.get(Calendar.MINUTE);
|
||||||
return minute;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ljsd.jieling.logic.rank.rankImpl;
|
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||||
|
|
||||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||||
|
import util.TimeUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hj
|
* @author hj
|
||||||
|
@ -24,7 +25,7 @@ public class CrossRank extends AbstractRank {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getScore(double... data) {
|
public double getScore(double... data) {
|
||||||
return data[0];
|
return data[0]+ TimeUtils.getDoubleTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -433,39 +433,38 @@ public class SevenWorldLogic {
|
||||||
* 结束发送奖励
|
* 结束发送奖励
|
||||||
*/
|
*/
|
||||||
public void sendRankReward(){
|
public void sendRankReward(){
|
||||||
if (!isTime()){
|
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);
|
||||||
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) {
|
||||||
int rank = 1;
|
User user = UserManager.getUserNotCache(Integer.parseInt(tuple.getValue()));
|
||||||
for (ZSetOperations.TypedTuple<String> tuple : range) {
|
if (user == null){
|
||||||
User user = UserManager.getUserNotCache(Integer.parseInt(tuple.getValue()));
|
return;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
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 week = TimeUtils.getDayOfWeek();
|
||||||
int hour = TimeUtils.getHourOfDay();
|
int hour = TimeUtils.getHourOfDay();
|
||||||
int minute = TimeUtils.getMiunte();
|
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