Example #1
0
        public static QueryClientsResponse QueryClientsForWs(QueryClientsForWsRequest request)
        {
            QueryClientsResponse response;

            if (request == null)
            {
                response = ResponseBase.InvalidInput <QueryClientsResponse>("参数错误");
            }
            else
            {
                request.PagingTrim();
                try {
                    var user = UserSet.GetUser(UserId.CreateLoginNameUserId(request.LoginName));
                    if (user == null)
                    {
                        response = ResponseBase.InvalidInput <QueryClientsResponse>("用户不存在");
                    }
                    else
                    {
                        var data = ClientDataSet.QueryClients(
                            user,
                            request,
                            out int total,
                            out CoinSnapshotData[] latestSnapshots,
                            out int totalOnlineCount,
                            out int totalMiningCount) ?? new List <ClientData>();
                        response = QueryClientsResponse.Ok(data, total, latestSnapshots, totalMiningCount, totalOnlineCount);
                    }
                }
                catch (Exception e) {
                    Logger.ErrorDebugLine(e);
                    response = ResponseBase.ServerError <QueryClientsResponse>(e.Message);
                }
            }
            return(response);
        }