Exemple #1
0
 /// <summary>
 /// 矿工身份验证
 /// </summary>
 /// <param name="address"></param>
 /// <param name="sn"></param>
 /// <returns></returns>
 public static bool ValidateMiner(string address, string sn)
 {
     try
     {
         MinersComponent component = new MinersComponent();
         var             miner     = component.GetMinerByAddress(address);
         if (miner == null || miner.SN != sn || miner.Status != 0)
         {
             bool isValidate = component.MinerLogin(address, sn);
             return(isValidate);
         }
         return(true);
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex.Message, ex);
         return(false);
     }
 }
Exemple #2
0
 public CommonResponse GetMinerInfoByAddress([FromBody] string address)
 {
     try
     {
         MinersComponent component = new MinersComponent();
         Miners          entity    = component.GetMinerByAddress(address);
         return(OK(entity));
     }
     catch (ApiCustomException ce)
     {
         LogHelper.Error(ce.Message);
         return(Error(ce.ErrorCode, ce.ErrorMessage));
     }
     catch (Exception ex)
     {
         LogHelper.Error(ex.Message, ex);
         return(Error(ex.HResult, ex.Message));
     }
 }