Example #1
0
 public Task SetLoginCheckInfo(string account, AccountInfo info)
 {
     _redis.SetStringNoWait <LoginCheckInfo>(KeyGenHelper.GenKey(account, typeof(LoginCheckInfo).Name),
                                             new LoginCheckInfo(info.Id, info.PlatformAccount, info.Type),
                                             TimeSpan.FromDays(7));
     return(Task.CompletedTask);
 }
        public async Task <List <long> > GetInviter(string platform, int type)
        {
            var allInviter = await _redis.GetZsetAllKeyAsync(KeyGenHelper.GenKey
                                                                 (platform, "Invited"));

            return(allInviter.ConvertAll <long>(x => Convert.ToInt64(x)));
        }
        public Task RemovInviteFriend(List <long> allInviter, string platform, int type)
        {
            List <Task> allTasks = new List <Task>();

            allTasks.Add(_redis.DeleteKeyAsync(KeyGenHelper.GenKey
                                                   (platform, "Invited")));
            foreach (var oneInviter in allInviter)
            {
                allTasks.Add(_redis.DeleteZsetValueAsync(KeyGenHelper.GenUserKey
                                                             (oneInviter, "Inviter"), platform));
            }
            return(Task.WhenAll(allTasks));
        }
        public Task SetInviteFriend(long id, string platform, int type)
        {
            var t1 = _redis.AddZsetValueAsync(KeyGenHelper.GenKey
                                                  (platform, "Invited"), id.ToString(),
                                              DateTime.Now.ToTimeStamp(), TimeSpan.FromDays(30));
            var t2 = _redis.DeleteZsetValueRangeAsync(KeyGenHelper.GenKey
                                                          (platform, "Invited"), 0, DateTime.Now.ToTimeStamp() - TimeSpan.FromDays(30).TotalSeconds);
            var t3 = _redis.AddZsetValueAsync(KeyGenHelper.GenUserKey
                                                  (id, "Inviter"), platform,
                                              DateTime.Now.ToTimeStamp(), TimeSpan.FromDays(30));
            var t4 = _redis.DeleteZsetValueRangeAsync(KeyGenHelper.GenUserKey
                                                          (id, "Inviter"), 0, DateTime.Now.ToTimeStamp() - TimeSpan.FromDays(30).TotalSeconds);

            return(Task.WhenAll(t1, t2, t3, t4));
        }
Example #5
0
 public Task <LoginCheckInfo> GetLoginCheckInfo(string platformAccount)
 {
     return(_redis.GetStringAsync <LoginCheckInfo>(KeyGenHelper.GenKey(platformAccount,
                                                                       typeof(LoginCheckInfo).Name)));
 }
Example #6
0
 public Task <bool> IsPlatformDealed(string platform)
 {
     return(_redis.IsSetContainsAsync(KeyGenHelper.GenKey("FriendPlatform"), platform));
 }