签到刷新

zhangshanxue 2019-10-01 05:01:31 +08:00
parent dd0cab498d
commit 56017c2dee
2 changed files with 18 additions and 1 deletions

View File

@ -41,7 +41,7 @@ public class ActivityLogic {
public void flushEveryDay(User user, PlayerInfoProto.FivePlayerUpdateIndication.Builder fBuilder) throws Exception { public void flushEveryDay(User user, PlayerInfoProto.FivePlayerUpdateIndication.Builder fBuilder) throws Exception {
//跟新签到天数 //跟新签到天数
if (!TimeUtils.isSameMonthWithNow(user.getPlayerInfoManager().getOffLineTime())) { if (!TimeUtils.isSameMonthFiveWithNow(user.getPlayerInfoManager().getOffLineTime())) {
user.getPlayerInfoManager().setSign(0); user.getPlayerInfoManager().setSign(0);
user.getPlayerInfoManager().setSignTotay(0); user.getPlayerInfoManager().setSignTotay(0);
} else if (user.getPlayerInfoManager().getSignTotay() == 1) { } else if (user.getPlayerInfoManager().getSignTotay() == 1) {

View File

@ -828,6 +828,23 @@ public class TimeUtils {
return (y1 == y2) && (m1 == m2); return (y1 == y2) && (m1 == m2);
} }
// 是否5点月刷新
public static boolean isSameMonthFiveWithNow(long r1) {
Calendar c1 = Calendar.getInstance();
c1.setTimeInMillis(r1-5*60*60*1000);
int y1 = c1.get(Calendar.YEAR);
int m1 = c1.get(Calendar.MONTH) + 1;
Calendar c2 = Calendar.getInstance();
c2.setTimeInMillis(now()-5*60*60*1000);
int y2 = c2.get(Calendar.YEAR);
int m2 = c2.get(Calendar.MONTH) + 1;
// int d2 = c2.get(Calendar.DAY_OF_MONTH);
return (y1 == y2) && (m1 == m2);
}
/** /**
* *