示例#1
0
        public ResponseBase RemoveClients([FromBody] MinerIdsRequest request)
        {
            if (request == null || request.ObjectIds == null)
            {
                return(ResponseBase.InvalidInput("参数错误"));
            }

            try {
                if (!request.IsValid(User, Sign, Timestamp, base.ClientIp, out ResponseBase response))
                {
                    return(response);
                }

                foreach (var objectId in request.ObjectIds)
                {
                    HostRoot.Instance.ClientSet.Remove(objectId);
                }
                return(ResponseBase.Ok());
            }
            catch (Exception e) {
                Logger.ErrorDebugLine(e);
                return(ResponseBase.ServerError(e.Message));
            }
        }
示例#2
0
        public DataResponse <List <ClientData> > RefreshClients([FromBody] MinerIdsRequest request)
        {
            if (request == null || request.ObjectIds == null)
            {
                return(ResponseBase.InvalidInput <DataResponse <List <ClientData> > >("参数错误"));
            }
            if (!HostRoot.Instance.HostConfig.IsPull)
            {
                return(ResponseBase.InvalidInput <DataResponse <List <ClientData> > >("服务端配置为不支持刷新"));
            }
            try {
                if (!request.IsValid(User, Sign, Timestamp, base.ClientIp, out DataResponse <List <ClientData> > response))
                {
                    return(response);
                }

                var data = HostRoot.Instance.ClientSet.RefreshClients(request.ObjectIds);
                return(DataResponse <List <ClientData> > .Ok(data));
            }
            catch (Exception e) {
                Logger.ErrorDebugLine(e);
                return(ResponseBase.ServerError <DataResponse <List <ClientData> > >(e.Message));
            }
        }