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:
@ -1192,7 +1192,7 @@ func (c *{{ctrlName}}Controller) Post() {
|
||||
// @Failure 403 :id is empty
|
||||
// @router /:id [get]
|
||||
func (c *{{ctrlName}}Controller) GetOne() {
|
||||
idStr := c.Ctx.Input.Params[":id"]
|
||||
idStr := c.Ctx.Input.Param(":id")
|
||||
id, _ := strconv.Atoi(idStr)
|
||||
v, err := models.Get{{ctrlName}}ById(id)
|
||||
if err != nil {
|
||||
@ -1273,7 +1273,7 @@ func (c *{{ctrlName}}Controller) GetAll() {
|
||||
// @Failure 403 :id is not int
|
||||
// @router /:id [put]
|
||||
func (c *{{ctrlName}}Controller) Put() {
|
||||
idStr := c.Ctx.Input.Params[":id"]
|
||||
idStr := c.Ctx.Input.Param(":id")
|
||||
id, _ := strconv.Atoi(idStr)
|
||||
v := models.{{ctrlName}}{Id: id}
|
||||
if err := json.Unmarshal(c.Ctx.Input.RequestBody, &v); err == nil {
|
||||
@ -1295,7 +1295,7 @@ func (c *{{ctrlName}}Controller) Put() {
|
||||
// @Failure 403 id is empty
|
||||
// @router /:id [delete]
|
||||
func (c *{{ctrlName}}Controller) Delete() {
|
||||
idStr := c.Ctx.Input.Params[":id"]
|
||||
idStr := c.Ctx.Input.Param(":id")
|
||||
id, _ := strconv.Atoi(idStr)
|
||||
if err := models.Delete{{ctrlName}}(id); err == nil {
|
||||
c.Data["json"] = "OK"
|
||||
|
Reference in New Issue
Block a user