public async Task SetUserAsync(string token) { if (string.IsNullOrEmpty(_currentUser.UserId)) { //TODO: 固定一个测试用户Token if (token == TEST_TOKEN) { var user = new LoginUser { UserId = Guid.NewGuid().ToString("N"), Mobile = "13012345678", UserName = "******", TenantId = DateTime.Now.ToString() }; user.CopyTo(_currentUser); } else { var user = await(from t in _passportDbContext.SysUserTokens.AsNoTracking() join u in _passportDbContext.Users.AsNoTracking() on t.UserId equals u.UserId where t.Token == token select new LoginUser { UserId = u.UserId, Mobile = u.Mobile, UserName = u.Username, TenantId = u.TenantId }).FirstOrDefaultAsync(); user?.CopyTo(_currentUser); } } }