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() }