/// <summary> /// 找到用户 /// </summary> /// <param name="key_manager"></param> /// <param name="_cache"></param> /// <param name="_context"></param> /// <param name="user_uid"></param> /// <returns></returns> async Task <_ <WCloudUserInfo> > FindUserOrThrow( ICacheKeyManager key_manager, ICacheProvider _cache, HttpContext _context, string user_uid) { var key = key_manager.UserInfo(user_uid); var data = await _cache.GetOrSetAsync_(key, async() => { var res = new _ <WCloudUserInfo>(); var _user = _context.RequestServices.Resolve_ <ILoginService <UserEntity> >(); var model = await _user.GetUserByUID(user_uid); if (model == null) { return(res.SetErrorMsg("用户不存在")); } var principal = model.ToPrincipal(ConfigSet.Identity.UserLoginScheme); //var loginuser = principal.ToWCloudUserInfo(); var loginuser = new WCloudUserInfo() { }; loginuser.UserID.Should().NotBeNullOrEmpty("没有填充上面的数据"); return(res.SetSuccessData(loginuser)); }, TimeSpan.FromMinutes(10)); if (data == null) { throw new ArgumentNullException("读取用户缓存错误"); } if (data.Error) { throw new MsgException(data.ErrorMsg); } return(data); }
public OrgRepository(IServiceProvider provider, WCloudUserInfo user) : base(provider) { this.OrgUID = user.Org?.UID; if (ValidateHelper.IsEmpty(this.OrgUID)) { throw new ArgumentException("租户仓储无法获取当前租户上下文"); } }
public OrgRepository__(IServiceProvider provider, WCloudUserInfo user) : base(provider) { this.OrgUID = user.Org?.Id; this.OrgUID.Should().NotBeNullOrEmpty("租户仓储无法获取当前租户上下文"); }
public OperationLogMessage(WCloudUserInfo loginuser) { this.UserUID = loginuser.UserID; this.UserName = string.Join("-", new[] { loginuser.UserName, loginuser.NickName }); this.AccountType = (int)AccountTypeEnum.User; }