/// <summary> /// 根据OpenId获取用户实体 /// </summary> /// <param name="openId"></param> /// <returns></returns> public BaseUserEntity GetEntityByOpenId(string openId) { BaseUserEntity userEntity = null; // 用户没有找到状态 StatusCode = Status.UserNotFound.ToString(); StatusMessage = GetStateMessage(StatusCode); // 检查是否有效的合法的参数 if (!string.IsNullOrEmpty(openId)) { var userLogonManager = new BaseUserLogonManager(); var parameters = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>(BaseUserLogonEntity.FieldOpenId, openId) }; var id = userLogonManager.GetId(parameters); if (!string.IsNullOrEmpty(id)) { parameters = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>(BaseUserEntity.FieldId, id), new KeyValuePair <string, object>(BaseUserEntity.FieldDeleted, 0), new KeyValuePair <string, object>(BaseUserEntity.FieldEnabled, 1) }; var dt = GetDataTable(parameters); if (dt != null && dt.Rows.Count == 1) { userEntity = BaseEntity.Create <BaseUserEntity>(dt); } } } return(userEntity); }