public UserAccountDto Login(UserAccountDto account) { UserAccountDto dto = userService.GetUserDto(account.Account, account.Password); if (dto == null) { throw new Exception("用户不存在"); } dto.Modules = userService.GetUserRolePermission(account.Id); if (!string.IsNullOrEmpty(RedisHelper.GetString(dto.WebToken))) { return(dto); } if (account.IsRemain) { dto.ExpireTime = DateTime.Now.AddDays(7); } else { dto.ExpireTime = DateTime.Now.AddDays(1); } RedisHelper.SetString(dto.WebToken, dto.ToJson(), Convert.ToInt32((dto.ExpireTime - DateTime.Now).TotalSeconds)); return(dto); }