Exemple #1
0
//移动
func (c *User) Move(user *models.User) revel.Result {

	var groupid string = c.Params.Get("groupid")
	var ids string = c.Params.Get("ids")

	data := make(map[string]string)

	if len(ids) <= 0 {
		data["status"] = "0"
		data["message"] = "请至少选择一个!"
		return c.RenderJson(data)
	}

	if len(groupid) <= 0 {
		data["status"] = "0"
		data["message"] = "请选择会员组!"
		return c.RenderJson(data)
	}

	Groupid, err := strconv.ParseInt(groupid, 10, 64)
	if err != nil {
		revel.WARN.Println(err)
	}

	if user.Move(Groupid, ids) {
		data["status"] = "1"
		data["message"] = "移动成功!"
		return c.RenderJson(data)
	} else {
		data["status"] = "0"
		data["message"] = "移动失败!"
		return c.RenderJson(data)
	}
}