/// <summary> /// 更新节点信息 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExcutedResult UpdateNode(UpdateNodeRequestModel model) { try { var user = CurrentUser; if (model == null) { throw new BusinessException(BusinessResultCode.ArgumentError, "参数错误或无效"); } model.Vefity(); var node = Repository.GetSingle(model.Id); var oldNode = node; if (!String.IsNullOrEmpty(model.Name)) { node.Name = model.Name; } if (!String.IsNullOrEmpty(model.HttpAddress)) { node.HttpAddress = model.HttpAddress; } node.IsSuper = model.IsSuper; if (model.TimeOut == default(int)) { node.TimeOut = model.TimeOut; } if (model.Priority == default(int)) { node.Priority = model.Priority; } node.QueryAlternative = model.QueryAlternative; node.PlayerAlternative = model.PlayerAlternative; node.ServerAlternative = model.ServerAlternative; if (!String.IsNullOrEmpty(model.Address)) { node.Address = model.Address; } Repository.Update(node); OperateLog log = new OperateLog(); log.Id = Guid.NewGuid(); log.ClientIp = user.ClientIP; log.CreateTime = DateTime.UtcNow; log.ManagerAccount = user.Mobile; log.ManagerId = user.Id; log.OriginalValue = JsonConvert.SerializeObject(oldNode); log.NewValue = JsonConvert.SerializeObject(node); log.Operate = "Update"; log.Function = "更新节点信息"; _operateLogRepository.Insert(log); return(ExcutedResult.SuccessResult()); } catch (BusinessException businessException) { return(ExcutedResult.FailedResult(businessException.ErrorCode, businessException.Message)); } }
public ExcutedResult UpdateNode([FromBody] UpdateNodeRequestModel model) { return(_nodeLogic.UpdateNode(model)); }