示例#1
0
文件: c_system.go 项目: yubo/falcon
// @Title Get
// @Description get system by id
// @Param	id		path 	int	true		"The key for staticblock"
// @Success {code:200, data:object} models.System
// @Failure {code:int, msg:string}
// @router /:id [get]
func (c *SystemController) GetSystem() {
	id, err := c.GetInt(":id")
	if err != nil {
		c.SendMsg(403, err.Error())
	} else {
		system, err := models.GetSystem(id)
		if err != nil {
			c.SendMsg(403, err.Error())
		} else {
			c.SendObj(200, system)
		}
	}
}
示例#2
0
文件: c_system.go 项目: yubo/falcon
func (c *MainController) EditSystem() {
	var system *models.System

	id, err := c.GetInt(":id")
	if err != nil {
		goto out
	}

	system, err = models.GetSystem(id)
	if err != nil {
		goto out
	}

	c.Data["Me"], _ = c.Ctx.Input.GetData("me").(*models.User)
	c.Data["System"] = system
	c.Data["H1"] = "edit system"
	c.Data["Method"] = "put"
	c.TplName = "system/edit.tpl"
	return
out:
	c.SendMsg(400, err.Error())
}