123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- namespace JiaZhiQuan.Common
- {
- public static partial class CacheKeys
- {
- public const int PushMsgThumbsupCacheSecs = 60 * 60 * 24;
- /// <summary>
- /// 点赞消息推送缓存,对于同一目标点赞,一天只收一次通知
- /// </summary>
- /// <param name="fromUserId">点赞的用户Id</param>
- /// <param name="type">点赞目标类型</param>
- /// <param name="targetId">目标编号</param>
- /// <returns></returns>
- public static string PushMsgThumbsupRepeatability(long fromUserId, ThumbsupTargetType type, long targetId)
- {
- return GenerateKey($"push_thumbsup:{fromUserId}:{(int)type}:{targetId}");
- }
- public const int PushMsgThumbsupReceivePerMinCacheSecs = 60;
- /// <summary>
- /// 同一用户一分钟内只收到1次点赞推送
- /// </summary>
- public static string PushMsgThumbsupReceivePerMin(long toUserId)
- {
- return GenerateKey($"push_thumbsup:m1:{toUserId}");
- }
- public const int PushMsgThumbsupReceivePerHourCacheSecs = 60 * 60;
- /// <summary>
- /// 同一用户一小时内只收到2次点赞推送
- /// </summary>
- public static string PushMsgThumbsupReceivePerHour(long toUserId)
- {
- return GenerateKey($"push_thumbsup:h1:{toUserId}");
- }
- public const int PushMsgThumbsupReceivePerDayCacheSecs = 24 * 60 * 60;
- /// <summary>
- /// 同一用户一天内只收到3次点赞推送
- /// </summary>
- public static string PushMsgThumbsupReceivePerDay(long toUserId)
- {
- return GenerateKey($"push_thumbsup:d1:{toUserId}");
- }
- public const int PushMsgFocusUserCacheSecs = 60 * 60 * 24;
- /// <summary>
- /// 关注消息推送缓存,对于同一目标关注,一天只收一次通知
- /// </summary>
- public static string PushMsgFocusRepeatability(long fromUserId, long toUserId)
- {
- return GenerateKey($"push_focus:{fromUserId}:{toUserId}");
- }
- /// <summary>
- /// 用户一个小时内收到的关注通知数量
- /// </summary>
- public static string PushMsgFocusReceivePerHour(long toUserId)
- {
- return GenerateKey($"push_focus_count:h1:{toUserId}");
- }
- /// <summary>
- /// 用户一天内收到的关注通知数量
- /// </summary>
- public static string PushMsgFocusReceivePerDay(long toUserId)
- {
- return GenerateKey($"push_focus_count:d1:{toUserId}");
- }
- public const int PushMsgCommentPerDayCacheSecs = 60 * 60 * 24;
- /// <summary>
- /// 同一ID对另一ID用户,一天最多3次评论,除非楼主回复了后,再进行提醒(清除逻辑放在了评论通知中)
- /// </summary>
- public static string PushMsgCommentPertDay(long fromUserId, long toUserId)
- {
- return GenerateKey($"push_comment:d1:{fromUserId}:{toUserId}");
- }
- public const int PushMsgCommentReceivePerHourCacheSecs = 60 * 60 * 24;
- /// <summary>
- /// 用户一个小时内收到的评论通知数量
- /// </summary>
- public static string PushMsgCommentReceivePerHour(long toUserId)
- {
- return GenerateKey($"push_comment_count:h1:{toUserId}");
- }
- public const int PushMsgCommentReceivePerDayCacheSecs = 24 * 60 * 60;
- /// <summary>
- /// 用户一天内收到的评论通知数量
- /// </summary>
- public static string PushMsgCommentReceivePerDay(long toUserId)
- {
- return GenerateKey($"push_comment_count:d1:{toUserId}");
- }
- public const int PushMsgUserConfigCacheSecs = 60 * 30;
- /// <summary>
- /// 推送用户配置
- /// </summary>
- public static string PushMsgUserConfig(long userId)
- {
- return GenerateKey($"push_userconfig:{userId}");
- }
- }
- }
|