Example #1
0
//批量移动
func (c Content) Remove(article *models.Article) revel.Result {

	if c.Request.Method == "GET" {
		title := "内容--批量移动"

		c.Render(title)
		return c.RenderTemplate("Content/Manage/Remove.html")
	} else {
		var ids string = c.Params.Get("ids")
		var cid string = c.Params.Get("cid")

		data := make(map[string]string)

		if len(ids) <= 0 {
			data["status"] = "1"
			data["url"] = "/Message/"
			data["message"] = "请选择至少选择一个!"
		} else if len(cid) <= 0 {
			data["status"] = "1"
			data["url"] = "/Message/"
			data["message"] = "请选择要移动的栏目!"
		} else {
			Cid, err := strconv.ParseInt(cid, 10, 64)
			if err != nil {
				revel.WARN.Println(err)
			}

			is_remove := article.Remove(Cid, ids)

			if is_remove {
				data["status"] = "1"
				data["url"] = "/Message/"
				data["message"] = "移动成功!"
			} else {
				data["status"] = "1"
				data["url"] = "/Message/"
				data["message"] = "移动失败!"
			}
		}

		return c.RenderJson(data)
	}
}