1
0
mirror of https://github.com/beego/bee.git synced 2025-07-05 18:20:18 +00:00

fix issue with new version

This commit is contained in:
astaxie
2016-01-06 11:55:56 +08:00
parent 20d77d9979
commit 807c3de8a7
6 changed files with 36 additions and 16 deletions

View File

@ -192,7 +192,7 @@ func (c *{{controllerName}}Controller) Post() {
// @Failure 403 :id is empty
// @router /:id [get]
func (c *{{controllerName}}Controller) GetOne() {
idStr := c.Ctx.Input.Params[":id"]
idStr := c.Ctx.Input.Param(":id")
id, _ := strconv.ParseInt(idStr, 0, 64)
v, err := models.Get{{controllerName}}ById(id)
if err != nil {
@ -273,7 +273,7 @@ func (c *{{controllerName}}Controller) GetAll() {
// @Failure 403 :id is not int
// @router /:id [put]
func (c *{{controllerName}}Controller) Put() {
idStr := c.Ctx.Input.Params[":id"]
idStr := c.Ctx.Input.Param(":id")
id, _ := strconv.ParseInt(idStr, 0, 64)
v := models.{{controllerName}}{Id: id}
json.Unmarshal(c.Ctx.Input.RequestBody, &v)
@ -292,7 +292,7 @@ func (c *{{controllerName}}Controller) Put() {
// @Failure 403 id is empty
// @router /:id [delete]
func (c *{{controllerName}}Controller) Delete() {
idStr := c.Ctx.Input.Params[":id"]
idStr := c.Ctx.Input.Param(":id")
id, _ := strconv.ParseInt(idStr, 0, 64)
if err := models.Delete{{controllerName}}(id); err == nil {
c.Data["json"] = "OK"