Exemple #1
0
        public object Execute(object[] parameters)
        {
            var user = JsonConvert.DeserializeObject <UserInfo>(Convert.ToString(parameters[0]));

            //CookieHelper.SetCookie(SystemConfig.CookiesKey, user.AccountId, DateTime.Now.AddSeconds(-1));
            CookieHelper.SetCookie(SystemConfig.CookiesKey, user.AccountId, DateTime.Now.AddHours(3), SystemConfig.GetDomain());
            Task.Run(async() =>
            {
                var _sessionId = parameters[1];
                var redisDb    = _connectionMultiplexer.GetDatabase();
                //Microsoft.JScript.GlobalObject.escape(
                //await redisDb.KeyExpireAsync(_sessionId + "_" + SystemConfig.Channel, TimeSpan.FromSeconds(0));
                await redisDb.HashSetAsync(_sessionId + "_" + SystemConfig.Channel, user.AccountId, JsonConvert.SerializeObject(user));
                await redisDb.KeyExpireAsync(_sessionId + "_" + SystemConfig.Channel, DateTime.Now.AddMinutes(130));
            }).Wait();
            return(null);
        }