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));
     }
 }
Ejemplo n.º 2
0
 public ResponseBase ExportMineWork([FromBody] ExportMineWorkRequest request)
 {
     if (request == null)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         IUserMineWork mineWork = WebApiRoot.MineWorkSet.GetById(request.MineWorkId);
         if (mineWork == null)
         {
             return(ResponseBase.NotExist());
         }
         if (mineWork.LoginName != User.LoginName)
         {
             return(ResponseBase.Forbidden("无权操作"));
         }
         string localJsonFileFullName  = SpecialPath.GetMineWorkLocalJsonFileFullName(request.MineWorkId);
         string serverJsonFileFullName = SpecialPath.GetMineWorkServerJsonFileFullName(request.MineWorkId);
         File.WriteAllText(localJsonFileFullName, request.LocalJson);
         File.WriteAllText(serverJsonFileFullName, request.ServerJson);
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(ResponseBase.ServerError <ResponseBase>(e.Message));
     }
 }
 public ResponseBase SetCoinKernelProfileProperty(SetCoinKernelProfilePropertyRequest request)
 {
     if (request == null)
     {
         return(LoadClientResponse.InvalidInput(Guid.Empty, "参数错误"));
     }
     try {
         if (string.IsNullOrEmpty(request.LoginName))
         {
             return(ResponseBase.InvalidInput(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 (!HostRoot.Current.MineWorkSet.Contains(request.WorkId))
         {
             return(ResponseBase.InvalidInput(request.MessageId, "给定的workId不存在"));
         }
         if (request.Sign != request.GetSign(key.Password))
         {
             return(ResponseBase.Forbidden(request.MessageId, "签名验证未通过"));
         }
         HostRoot.Current.MineProfileManager.SetCoinKernelProfileProperty(request.WorkId, request.CoinKernelId, request.PropertyName, request.Value);
         return(ResponseBase.Ok(request.MessageId));
     }
     catch (Exception e) {
         Global.Logger.ErrorDebugLine(e.Message, e);
         return(ResponseBase.ServerError(request.MessageId, e.Message));
     }
 }
Ejemplo n.º 4
0
        public ResponseBase SetLocalIps(List <LocalIpInput> data)
        {
            ResponseBase response;

            if (data == null || data.Count == 0)
            {
                response = ResponseBase.InvalidInput("参数错误");
            }
            else
            {
                try {
                    foreach (var localIpInput in data)
                    {
                        VirtualRoot.Execute(new SetLocalIpCommand(localIpInput, localIpInput.IsAutoDNSServer));
                    }
                    response = ResponseBase.Ok("设置矿机IP,可能会掉线,通常过一会儿能恢复。");
                }
                catch (Exception e) {
                    Logger.ErrorDebugLine(e);
                    response = ResponseBase.ServerError(e.Message);
                }
            }
            VirtualRoot.OperationResultSet.Add(response.ToOperationResult());
            return(response);
        }
Ejemplo n.º 5
0
        public ResponseBase StartMine(WorkRequest request)
        {
            ResponseBase response;

            if (request == null)
            {
                response = ResponseBase.InvalidInput("参数错误");
            }
            else
            {
                try {
                    // 单机作业的localJson和serverJson是在编辑单机作业时提前传递到挖矿端的所以不需要在开始挖矿时再传递
                    if (request.WorkId != Guid.Empty && !request.WorkId.IsSelfMineWorkId())
                    {
                        SpecialPath.WriteMineWorkLocalJsonFile(request.LocalJson);
                        SpecialPath.WriteMineWorkServerJsonFile(request.ServerJson);
                    }
                    if (IsNTMinerOpened())
                    {
                        WorkRequest innerRequest = new WorkRequest {
                            WorkId     = request.WorkId,
                            WorkerName = request.WorkerName
                        };
                        JsonRpcRoot.PostAsync <ResponseBase>(NTKeyword.Localhost, NTKeyword.MinerClientPort, _minerClientControllerName, nameof(IMinerClientController.StartMine), innerRequest, callback: null, timeountMilliseconds: 3000);
                        response = ResponseBase.Ok("开始挖矿");
                    }
                    else
                    {
                        string location = NTMinerRegistry.GetLocation(NTMinerAppType.MinerClient);
                        if (!string.IsNullOrEmpty(location) && File.Exists(location))
                        {
                            string arguments = NTKeyword.AutoStartCmdParameterName;
                            if (request.WorkId != Guid.Empty)
                            {
                                if (request.WorkId.IsSelfMineWorkId())
                                {
                                    arguments = "--selfWork " + arguments;
                                }
                                else
                                {
                                    arguments = "--work " + arguments;
                                }
                            }
                            Windows.Cmd.RunClose(location, arguments);
                            response = ResponseBase.Ok("开始挖矿");
                        }
                        else
                        {
                            response = ResponseBase.ServerError("开始挖矿,未找到挖矿端程序");
                        }
                    }
                }
                catch (Exception e) {
                    Logger.ErrorDebugLine(e);
                    response = ResponseBase.ServerError(e.Message);
                }
            }
            VirtualRoot.OperationResultSet.Add(response.ToOperationResult());
            return(response);
        }
Ejemplo n.º 6
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));
     }
 }
Ejemplo n.º 7
0
        public ResponseBase UpgradeNTMiner(UpgradeNTMinerRequest request)
        {
            ResponseBase response;

            if (request == null || string.IsNullOrEmpty(request.NTMinerFileName))
            {
                response = ResponseBase.InvalidInput("参数错误");
            }
            else
            {
                Task.Factory.StartNew(() => {
                    try {
                        string location = NTMinerRegistry.GetLocation(NTMinerAppType.MinerClient);
                        if (!string.IsNullOrEmpty(location) && File.Exists(location))
                        {
                            string arguments = NTKeyword.UpgradeCmdParameterName + request.NTMinerFileName;
                            Windows.Cmd.RunClose(location, arguments);
                        }
                    }
                    catch (Exception e) {
                        Logger.ErrorDebugLine(e);
                    }
                });
                response = ResponseBase.Ok("升级挖矿端");
            }
            VirtualRoot.OperationResultSet.Add(response.ToOperationResult());
            return(response);
        }
Ejemplo n.º 8
0
 public ResponseBase RemoveMinerGroup([FromBody] DataRequest <Guid> request)
 {
     if (request == null || request.Data == Guid.Empty)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         if (!IsValidUser(request, out ResponseBase response, out UserData user))
         {
             return(response);
         }
         IUserMinerGroup minerGroup = WebApiRoot.MinerGroupSet.GetById(request.Data);
         if (minerGroup == null)
         {
             return(ResponseBase.Ok());
         }
         if (minerGroup.LoginName != user.LoginName)
         {
             return(ResponseBase.Forbidden("无权操作"));
         }
         if (WebApiRoot.ClientDataSet.IsAnyClientInGroup(request.Data))
         {
             return(ResponseBase.ClientError($"组{minerGroup.Name}下有矿机,请先移除矿机再做删除操作"));
         }
         WebApiRoot.MinerGroupSet.RemoveById(request.Data);
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(ResponseBase.ServerError(e.Message));
     }
 }
Ejemplo n.º 9
0
 public ResponseBase RemoveNTMinerFile(RemoveNTMinerFileRequest request)
 {
     if (request == null)
     {
         return(LoadClientResponse.InvalidInput(Guid.Empty, "参数错误"));
     }
     try {
         if (string.IsNullOrEmpty(request.LoginName))
         {
             return(ResponseBase.InvalidInput(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.GetSign(key.Password) != request.Sign)
         {
             return(ResponseBase.Forbidden(request.MessageId, "签名验证未通过"));
         }
         HostRoot.Current.NTMinerFileSet.Remove(request.NTMinerId);
         return(ResponseBase.Ok(request.MessageId));
     }
     catch (Exception e) {
         Global.Logger.Error(e.Message, e);
         return(ResponseBase.ServerError(request.MessageId, e.Message));
     }
 }
Ejemplo n.º 10
0
        public ResponseBase UpdateUser([FromBody] DataRequest <UserUpdateInput> request)
        {
            if (request == null || request.Data == null)
            {
                return(ResponseBase.InvalidInput <DataResponse <string> >("参数错误"));
            }
            if (request.Data.ActionCaptchaId == Guid.Empty ||
                string.IsNullOrEmpty(request.Data.ActionCaptcha) ||
                !AppRoot.CaptchaSet.IsValid(request.Data.ActionCaptchaId, base.RemoteIp, request.Data.ActionCaptcha))
            {
                return(ResponseBase.InvalidInput("验证码错误"));
            }

            // TODO:验证邮箱验证码,注册时如果填了邮箱则验证邮箱的验证码,更新用户信息时如果变动了邮箱则验证邮箱验证码。
            // 验证验证码的存在性以及邮箱地址和验证码的对应关系的正确性而不是只验证验证码的存在性。
            // TODO:如果未填写邮箱使用数据库记录的邮箱填充request.Data.Email确保下层不会误将邮箱更新为空

            // TODO:验证手机验证码,注册时如果填写了手机则验证手机验证码,更新用户信息时如果变动了手机则验证手机验证码。
            // 验证验证码的存在性以及手机和验证码的对应关系的正确性而不是只验证验证码的存在性。
            // TODO:如果未填写手机使用数据库记录的手机填充request.Data.Email确保下层不会误将手机更新为空
            try {
                AppRoot.UserSet.Update(request.Data);
                return(ResponseBase.Ok("更新成功"));
            }
            catch (Exception e) {
                return(ResponseBase.ServerError(e.Message));
            }
        }
Ejemplo n.º 11
0
 public ResponseBase RemoveMineWork([FromBody] DataRequest <Guid> request)
 {
     if (request == null || request.Data == Guid.Empty)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         IUserMineWork mineWork = WebApiRoot.MineWorkSet.GetById(request.Data);
         if (mineWork == null)
         {
             return(ResponseBase.Ok());
         }
         if (mineWork.LoginName != User.LoginName)
         {
             return(ResponseBase.Forbidden("无权操作"));
         }
         if (WebApiRoot.ClientDataSet.IsAnyClientInWork(request.Data))
         {
             return(ResponseBase.ClientError($"作业{mineWork.Name}下有矿机,请先移除矿机再做删除操作"));
         }
         WebApiRoot.MineWorkSet.RemoveById(request.Data);
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(ResponseBase.ServerError(e.Message));
     }
 }
Ejemplo n.º 12
0
 public ResponseBase ChangePassword([FromBody] ChangePasswordRequest request)
 {
     if (request == null || string.IsNullOrEmpty(request.LoginName) ||
         string.IsNullOrEmpty(request.OldPassword) ||
         string.IsNullOrEmpty(request.NewPassword))
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         IUser user = HostRoot.Instance.UserSet.GetUser(request.LoginName);
         if (user == null)
         {
             return(ResponseBase.ClientError($"登录名不存在"));
         }
         if (user.Password == request.NewPassword)
         {
             return(ResponseBase.Ok());
         }
         if (user.Password != request.OldPassword)
         {
             return(ResponseBase.ClientError($"旧密码不正确"));
         }
         VirtualRoot.Execute(new ChangePasswordCommand(request.LoginName, request.OldPassword, request.NewPassword, request.Description));
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(ResponseBase.ServerError(e.Message));
     }
 }
Ejemplo n.º 13
0
 public ResponseBase UpdateClients([FromBody] UpdateClientsRequest request)
 {
     if (request == null)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         List <string> toRemoveKeys = new List <string>();
         foreach (var key in request.Values.Keys)
         {
             var minerData = WebApiRoot.ClientDataSet.GetByObjectId(key);
             if (minerData == null && !minerData.IsOwnerBy(User))
             {
                 toRemoveKeys.Add(key);
             }
         }
         foreach (var key in toRemoveKeys)
         {
             request.Values.Remove(key);
         }
         WebApiRoot.ClientDataSet.UpdateClients(request.PropertyName, request.Values);
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(ResponseBase.ServerError(e.Message));
     }
 }
Ejemplo n.º 14
0
        public ResponseBase RemoveClients([FromBody] MinerIdsRequest request)
        {
            if (request == null || request.ObjectIds == null)
            {
                return(ResponseBase.InvalidInput("参数错误"));
            }

            try {
                if (!IsValidUser(request, out ResponseBase response, out UserData user))
                {
                    return(response);
                }

                foreach (var objectId in request.ObjectIds)
                {
                    var minerData = WebApiRoot.ClientDataSet.GetByObjectId(objectId);
                    if (minerData != null && minerData.IsOwnerBy(user))
                    {
                        WebApiRoot.ClientDataSet.RemoveByObjectId(objectId);
                    }
                }
                return(ResponseBase.Ok());
            }
            catch (Exception e) {
                Logger.ErrorDebugLine(e);
                return(ResponseBase.ServerError(e.Message));
            }
        }
Ejemplo n.º 15
0
 public ResponseBase RemoveMineWork([FromBody] DataRequest <Guid> request)
 {
     if (request == null || request.Data == Guid.Empty)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         if (!request.IsValid(HostRoot.Current.UserSet.GetUser, ClientIp, out ResponseBase response))
         {
             return(response);
         }
         IMineWork mineWork = HostRoot.Current.MineWorkSet.GetMineWork(request.Data);
         if (mineWork == null)
         {
             return(ResponseBase.Ok());
         }
         if (HostRoot.Current.ClientSet.IsAnyClientInWork(request.Data))
         {
             return(ResponseBase.ClientError($"作业{mineWork.Name}下有矿机,请先移除矿机再做删除操作"));
         }
         HostRoot.Current.MineWorkSet.Remove(request.Data);
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e.Message, e);
         return(ResponseBase.ServerError(e.Message));
     }
 }
Ejemplo n.º 16
0
 public ResponseBase RemoveGpuName([FromBody] DataRequest <GpuName> request)
 {
     if (request == null || request.Data == null)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     WebApiRoot.GpuNameSet.Remove(request.Data);
     return(ResponseBase.Ok("移除成功"));
 }
Ejemplo n.º 17
0
 public void UpdateClientAsync(string objectId, string propertyName, object value, Action <ResponseBase, Exception> callback)
 {
     try {
         _clientDataSet.UpdateClient(objectId, propertyName, value);
         callback?.Invoke(ResponseBase.Ok(), null);
     }
     catch (Exception e) {
         callback?.Invoke(ResponseBase.ServerError(e.Message), e);
     }
 }
Ejemplo n.º 18
0
 public void UpdateClientsAsync(string propertyName, Dictionary <string, object> values, Action <ResponseBase, Exception> callback)
 {
     try {
         _clientDataSet.UpdateClients(propertyName, values);
         callback?.Invoke(ResponseBase.Ok(), null);
     }
     catch (Exception e) {
         callback?.Invoke(ResponseBase.ServerError(e.Message), e);
     }
 }
Ejemplo n.º 19
0
        public ResponseBase AtikmdagPatcher()
        {
            if (TryGetMinerClientLocation(out string location))
            {
                Windows.Cmd.RunClose(location, $"{NTKeyword.ActionCmdParameterName}{MinerClient.MinerClientActionType.AtikmdagPatcher.ToString()}");
            }
            ResponseBase response = ResponseBase.Ok("A卡驱动签名,如果本机不是A卡将被忽略");

            VirtualRoot.OperationResultSet.Add(response.ToOperationResult());
            return(response);
        }
Ejemplo n.º 20
0
        public ResponseBase BlockWAU()
        {
            if (TryGetMinerClientLocation(out string location))
            {
                Windows.Cmd.RunClose(location, $"{NTKeyword.ActionCmdParameterName}{MinerClient.MinerClientActionType.BlockWAU.ToString()}");
            }
            ResponseBase response = ResponseBase.Ok("禁用windows系统更新");

            VirtualRoot.OperationResultSet.Add(response.ToOperationResult());
            return(response);
        }
Ejemplo n.º 21
0
 public void RemoveClientsAsync(List <string> objectIds, Action <ResponseBase, Exception> callback)
 {
     try {
         foreach (var objectId in objectIds)
         {
             _clientDataSet.RemoveByObjectId(objectId);
         }
         callback?.Invoke(ResponseBase.Ok(), null);
     }
     catch (Exception e) {
         callback?.Invoke(ResponseBase.ServerError(e.Message), e);
     }
 }
Ejemplo n.º 22
0
 public ResponseBase ChangePassword([FromBody] ChangePasswordRequest request)
 {
     if (request == null)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     if (string.IsNullOrEmpty(request.NewPassword))
     {
         return(ResponseBase.InvalidInput("密码不能为空"));
     }
     AppRoot.UserSet.ChangePassword(User.LoginName, request.NewPassword);
     return(ResponseBase.Ok("密码修改成功"));
 }
Ejemplo n.º 23
0
        public ResponseBase StartMine(WorkRequest request)
        {
            ResponseBase response;

            if (request == null)
            {
                response = ResponseBase.InvalidInput("参数错误");
            }
            else
            {
                try {
                    if (request.WorkId != Guid.Empty)
                    {
                        File.WriteAllText(SpecialPath.NTMinerLocalJsonFileFullName, request.LocalJson);
                        File.WriteAllText(SpecialPath.NTMinerServerJsonFileFullName, request.ServerJson);
                    }
                    string location = NTMinerRegistry.GetLocation(NTMinerAppType.MinerClient);
                    if (IsNTMinerOpened())
                    {
                        WorkRequest innerRequest = new WorkRequest {
                            WorkId = request.WorkId
                        };
                        response             = RpcRoot.Post <ResponseBase>(NTKeyword.Localhost, NTKeyword.MinerClientPort, _minerClientControllerName, nameof(IMinerClientController.StartMine), innerRequest);
                        response.Description = "开始挖矿";
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(location) && File.Exists(location))
                        {
                            string arguments = NTKeyword.AutoStartCmdParameterName;
                            if (request.WorkId != Guid.Empty)
                            {
                                arguments += " --work";
                            }
                            Windows.Cmd.RunClose(location, arguments);
                            response = ResponseBase.Ok("开始挖矿");
                        }
                        else
                        {
                            response = ResponseBase.ServerError("开始挖矿,未找到挖矿端程序");
                        }
                    }
                }
                catch (Exception e) {
                    Logger.ErrorDebugLine(e);
                    response = ResponseBase.ServerError(e.Message);
                }
            }
            VirtualRoot.OperationResultSet.Add(response.ToOperationResult());
            return(response);
        }
Ejemplo n.º 24
0
 public ResponseBase ReportNodeState([FromBody] WsServerNodeState state)
 {
     if (state == null)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         WebApiRoot.WsServerNodeSet.SetNodeState(state);
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         return(ResponseBase.ServerError(e.Message));
     }
 }
Ejemplo n.º 25
0
 public ResponseBase SaveCalcConfigs([FromBody] SaveCalcConfigsRequest request)
 {
     if (request == null || request.Data == null)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         AppRoot.CalcConfigSet.SaveCalcConfigs(request.Data);
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(ResponseBase.ServerError(e.Message));
     }
 }
Ejemplo n.º 26
0
 public ResponseBase SetAppSetting([FromBody] DataRequest <UserAppSettingData> request)
 {
     if (request == null || request.Data == null)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         AppRoot.UserAppSettingSet.SetAppSetting(request.Data);
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(ResponseBase.ServerError(e.Message));
     }
 }
Ejemplo n.º 27
0
        public ResponseBase ShutdownWindows()
        {
            ResponseBase response;

            try {
                CloseNTMiner();
                response = ResponseBase.Ok("关闭矿机");
            }
            catch (Exception e) {
                Logger.ErrorDebugLine(e);
                response = ResponseBase.ServerError(e.Message);
            }
            VirtualRoot.OperationResultSet.Add(response.ToOperationResult());
            return(response);
        }
Ejemplo n.º 28
0
 public ResponseBase RemoveNTMinerFile([FromBody] DataRequest <Guid> request)
 {
     if (request == null)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         WebApiRoot.NTMinerFileSet.RemoveById(request.Data);
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(ResponseBase.ServerError(e.Message));
     }
 }
Ejemplo n.º 29
0
 public ResponseBase AddOrUpdateNTMinerFile([FromBody] DataRequest <NTMinerFileData> request)
 {
     if (request == null || request.Data == null)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         WebApiRoot.NTMinerFileSet.AddOrUpdate(request.Data);
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(ResponseBase.ServerError(e.Message));
     }
 }
Ejemplo n.º 30
0
 public ResponseBase AddOrUpdateMineWork([FromBody] DataRequest <MineWorkData> request)
 {
     if (request == null || request.Data == null)
     {
         return(ResponseBase.InvalidInput("参数错误"));
     }
     try {
         WebApiRoot.MineWorkSet.AddOrUpdate(request.Data.ToUserMineWork(User.LoginName));
         return(ResponseBase.Ok());
     }
     catch (Exception e) {
         Logger.ErrorDebugLine(e);
         return(ResponseBase.ServerError(e.Message));
     }
 }