| | |
| | | try |
| | | { |
| | | var User = HttpContext.Current.Session["User"].ToString(); |
| | | User loginUser = JsonConvert.DeserializeObject<User>(User); |
| | | User loginUser = JsonConvert.DeserializeObject<User>(User); |
| | | base.OnActionExecuting(actionContext); |
| | | //如果存在 |
| | | if (redis.Get<User>("LoginUserIDPC" + loginUser.userid, 0).userid.ToString() != "") |
| | | if (redis.Get<User>("LoginUserID"+loginUser.usertype + loginUser.userid, 0).userid.ToString() != "") |
| | | { |
| | | //获取redis中当前用户信息 |
| | | User r_loginUser = redis.Get<User>("LoginUserIDPC" + loginUser.userid, 0); |
| | | //如果session中的用户usercode和redis中的用户usercode匹配 |
| | | if (r_loginUser.usercode.Equals(loginUser.usercode)) |
| | | User r_loginUser = redis.Get<User>("LoginUserID"+ loginUser.usertype + loginUser.userid, 0); |
| | | //如果session中的用户guid和redis中的用户guid匹配 |
| | | if (r_loginUser.guid.Equals(loginUser.guid)) |
| | | { |
| | | //重置过期时间 |
| | | redis.Set<User>("LoginUserIDPC" + loginUser.userid, loginUser, redis.secondsTimeOut, 0); |
| | | redis.Set<User>("LoginUserID"+ loginUser.usertype + loginUser.userid, loginUser, redis.secondsTimeOut, 0); |
| | | } |
| | | else |
| | | { |