//删除 func (c Menu) Delete(menu *models.Menu) revel.Result { var id string = c.Params.Get("id") data := make(map[string]string) if len(id) <= 0 { data["status"] = "0" data["message"] = "参数错误!" } Id, err := strconv.ParseInt(id, 10, 64) if err != nil { revel.WARN.Println(err) } if menu.DelByID(Id) { data["status"] = "1" data["message"] = "删除成功!" } else { data["status"] = "0" data["message"] = "删除失败!" } return c.RenderJson(data) }
//删除 func (c Menu) Delete(menu *models.Menu) revel.Result { var id string = c.Params.Get("id") data := make(map[string]string) if len(id) <= 0 { data["status"] = "0" data["message"] = "参数错误!" } Id, err := strconv.ParseInt(id, 10, 64) if err != nil { revel.WARN.Println(err) } if menu.DelByID(Id) { //****************************************** //管理员日志 if UserID, ok := c.Session["UserID"]; ok { UserID, err := strconv.ParseInt(UserID, 10, 64) if err != nil { revel.WARN.Println(err) } admin := new(models.Admin) admin_info := admin.GetById(UserID) logs := new(models.Logs) desc := "删除菜单|^|ID:" + id logs.Save(admin_info, c.Controller, desc) } //***************************************** data["status"] = "1" data["message"] = "删除成功!" } else { data["status"] = "0" data["message"] = "删除失败!" } return c.RenderJson(data) }