Exemplo n.º 1
0
 /// <summary>
 /// 通过token 获取用户信息
 /// </summary>
 /// <param name="token">tokenID</param>
 /// <returns></returns>
 public static bool getUserByToken(string token, out UserInfo user)
 {
     bool isok = false;
     user = null;
     if (!string.IsNullOrEmpty(token) && RedisCommon.getInstance.Exist<UserInfo>(RedisHashEnum.userinfo, token))
     {
         user = RedisCommon.getInstance.Get<UserInfo>(RedisHashEnum.userinfo, token);
         isok = true;
     }
     return isok;
 }
Exemplo n.º 2
0
 public static RedisOpearteResult RefreshLoginTokenData(String tokenID, UserInfo val)
 {
     RedisOpearteResult result = new RedisOpearteResult
     {
         isok = RedisCommon.getInstance.Set<UserInfo>(RedisHashEnum.userinfo, tokenID, val),
         token = tokenID,
         result = JsonConvert.SerializeObject(val)
     };
     RedisCommon.getInstance.SetExpire(tokenID, DateTime.Now.AddMinutes(30));
     return result;
 }
Exemplo n.º 3
0
 public static RedisOpearteResult getToken(UserInfo val)
 {
     string tokenID = Guid.NewGuid().ToString();
     RedisOpearteResult result = new RedisOpearteResult
     {
         isok = RedisCommon.getInstance.Set<UserInfo>(RedisHashEnum.userinfo, tokenID, val),
         token = tokenID,
         result = JsonConvert.SerializeObject(val)
     };
     RedisCommon.getInstance.SetExpire(tokenID, DateTime.Now.AddMinutes(30));
     return result;
 }