Exemple #1
0
 public ResponseBase RemoveMinerGroup([FromBody] DataRequest <Guid> request)
 {
     if (request == null || request.Data == Guid.Empty)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         if (!request.IsValid(User, Sign, Timestamp, base.ClientIp, out ResponseBase response))
         {
             return(response);
         }
         IMinerGroup minerGroup = HostRoot.Instance.MinerGroupSet.GetMinerGroup(request.Data);
         if (minerGroup == null)
         {
             return(ResponseBase.Ok());
         }
         if (HostRoot.Instance.ClientSet.IsAnyClientInGroup(request.Data))
         {
             return(ResponseBase.ClientError($"组{minerGroup.Name}下有矿机,请先移除矿机再做删除操作"));
         }
         HostRoot.Instance.MinerGroupSet.Remove(request.Data);
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(ResponseBase.ServerError(e.Message));
     }
 }
Exemple #2
0
        public bool TryGetMinerGroup(Guid id, out IMinerGroup group)
        {
            InitOnece();
            var r = _dicById.TryGetValue(id, out MinerGroupData g);

            group = g;
            return(r);
        }
Exemple #3
0
 public MinerGroupViewModel(IMinerGroup data) : this(data.GetId())
 {
     _name        = data.Name;
     _description = data.Description;
 }