func (this *RelEndpointGroupController) Delete() { jsonResult := g.JsonResult{} id, _ := this.GetInt64("Id") item := models.RelEndpointGroup{Id: id} result, err := item.DeleteByPK() if nil != err { jsonResult.Message = err.Error() } else if result > 0 { jsonResult.Success = true } else { jsonResult.Message = "更新失败,数据不存在" } this.Data["json"] = &jsonResult this.ServeJSON() }
func (this *AgentController) Delete() { jsonResult := g.JsonResult{} id, _ := this.GetInt64("Id") item := models.Agent{Id: id, Name: this.GetString("name")} result, err := item.DeleteByPK() if nil != err { jsonResult.Message = err.Error() } else if result > 0 { store.DesiredAgentsMap.Delete(item.Name) jsonResult.Success = true } else { jsonResult.Message = "更新失败,数据不存在" } this.Data["json"] = &jsonResult this.ServeJSON() }
func (this *EndpointController) Delete() { jsonResult := g.JsonResult{} id, _ := this.GetInt64("Id") hostname := this.GetString("Hostname") item := models.Endpoint{Id: id} result, err := item.DeleteByPK() if nil != err { jsonResult.Message = err.Error() } else if result > 0 { store.HostAgents.Delete(hostname) jsonResult.Success = true } else { jsonResult.Message = "更新失败,数据不存在" } this.Data["json"] = &jsonResult this.ServeJSON() }
func (this *AgentController) Save() { jsonResult := g.JsonResult{} item := models.Agent{} if err := this.ParseForm(&item); nil != err { logger.Errorln("parseForm error", err) jsonResult.Message = err.Error() } else { if 0 >= item.Id { item.GmtCreate = time.Now() } result, err := item.Insert() if nil != err { jsonResult.Message = err.Error() } else if 0 < result { jsonResult.Success = true } else { jsonResult.Message = "保存失败,未知错误" } } this.Data["json"] = &jsonResult this.ServeJSON() }