public LoadClientsResponse LoadClients(LoadClientsRequest request) { if (request == null) { return(LoadClientsResponse.InvalidInput(Guid.Empty, "参数错误")); } try { if (string.IsNullOrEmpty(request.LoginName)) { return(LoadClientsResponse.InvalidInput(request.MessageId, "登录名不能为空")); } if (!HostRoot.Current.UserSet.TryGetKey(request.LoginName, out IUser key)) { return(LoadClientsResponse.Forbidden(request.MessageId)); } if (!request.Timestamp.IsInTime()) { return(LoadClientsResponse.Expired(request.MessageId)); } if (request.ClientIds == null || request.ClientIds.Count == 0) { return(LoadClientsResponse.InvalidInput(request.MessageId, "clientIds为空")); } if (request.Sign != request.GetSign(key.Password)) { return(LoadClientsResponse.Forbidden(request.MessageId, "签名验证未通过")); } var data = HostRoot.Current.ClientSet.LoadClients(request.ClientIds) ?? new List <ClientData>(); return(new LoadClientsResponse(data)); } catch (Exception e) { Global.Logger.ErrorDebugLine(e.Message, e); return(LoadClientsResponse.ServerError(request.MessageId, e.Message)); } }
public ResponseBase LoginControlCenter(LoginControlCenterRequest request) { if (request == null) { return(LoadClientsResponse.InvalidInput(Guid.Empty, "参数错误")); } try { if (string.IsNullOrEmpty(request.LoginName)) { return(ResponseBase.Forbidden(request.MessageId, "登录名不能为空")); } if (!HostRoot.Current.UserSet.TryGetKey(request.LoginName, out IUser key)) { return(ResponseBase.Forbidden(request.MessageId, "登录名不存在")); } if (!request.Timestamp.IsInTime()) { return(ResponseBase.Expired(request.MessageId)); } if (request.Sign != request.GetSign(key.Password)) { return(ResponseBase.Forbidden(request.MessageId, "密码错误")); } return(ResponseBase.Ok(request.MessageId)); } catch (Exception e) { Global.Logger.ErrorDebugLine(e.Message, e); return(ResponseBase.ServerError(request.MessageId, e.Message)); } }