protected virtual AdminInfo GetAdminInfo() { string key = HttpContext.Request.Headers["token"]; if (string.IsNullOrEmpty(key)) { return(null); //throw new AuthNotFoundException(ResponseApi.Create((GetLanguage(), Code.AuthFail).Message); } //string value = key.AesDecrypt(Core.AesKey, Core.AesIv); //string account = value.Split('_')[0]; var data = this.Cache.Get <AdminInfo>(key); if (data == null) { var tokenStr = RedisCache.GetString(key); if (string.IsNullOrEmpty(tokenStr)) { throw new AuthNotFoundException(ResponseApi.Create(GetLanguage(), Code.AuthFail).Message); } data = tokenStr.ToObject <AdminInfo>(); if (data.LoginDate.Value.AddHours(24) < DateTime.Now.AddMinutes(-5)) { throw new AuthNotFoundException(ResponseApi.Create(GetLanguage(), Code.TokenExpires).Message); } Cache.Set <AdminInfo>(key, data, data.LoginDate.Value.AddHours(24)); } return(data); }