Add load history message function

This commit is contained in:
heavyrain lee
2019-04-19 08:15:27 +08:00
parent b82f7dea3d
commit 0f05d63a3b
7 changed files with 848 additions and 3 deletions
@@ -67,4 +67,6 @@ public interface IMTopic {
String ChannelPullTopic = "CHP";
String GetTokenTopic = "GETTOKEN";
String LoadRemoteMessagesTopic = "LRM";
}
@@ -60,4 +60,22 @@ public class MessageShardingUtil {
year %= 3;
return "t_messages_" + (year * 12 + month);
}
public static String getPreviousMessageTable(long mid) {
if (DBUtil.IsEmbedDB) {
return null;
}
mid >>= (nodeIdWidth + rotateIdWidth);
Date date = new Date(mid + T201801010000);
int month = date.getMonth();
int year = date.getYear();
year %= 3;
month = month + 1;
if (month == 12) {
month = 0;
year = (year + 3 -1)%3;
}
return "t_messages_" + (year * 12 + month);
}
}