聊天室历史数据问题

This commit is contained in:
heavyrain lee
2019-07-05 08:47:44 +08:00
parent 9365807f47
commit 576c985d8f
@@ -54,10 +54,15 @@ public class MessageShardingUtil {
return "t_messages";
}
mid >>= (nodeIdWidth + rotateIdWidth);
Date date = new Date(mid + T201801010000);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
if (mid != Long.MAX_VALUE) {
mid >>= (nodeIdWidth + rotateIdWidth);
Date date = new Date(mid + T201801010000);
calendar.setTime(date);
} else {
Date date = new Date(System.currentTimeMillis());
calendar.setTime(date);
}
int month = calendar.get(Calendar.MONTH);
int year = calendar.get(Calendar.YEAR);
year %= 3;