有几处代码可能由于历史API原因编译不通过需要更改
有几处代码可能由于历史API原因编译不通过需要更改。
This commit is contained in:
14
zh/13.5.md
14
zh/13.5.md
@@ -62,7 +62,7 @@ type IndexController struct {
|
||||
func (this *IndexController) Get() {
|
||||
this.Data["blogs"] = models.GetAll()
|
||||
this.Layout = "layout.tpl"
|
||||
this.TplNames = "index.tpl"
|
||||
this.TplName = "index.tpl"
|
||||
}
|
||||
```
|
||||
ViewController:
|
||||
@@ -74,10 +74,10 @@ type ViewController struct {
|
||||
}
|
||||
|
||||
func (this *ViewController) Get() {
|
||||
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
|
||||
id, _ := strconv.Atoi(this.Ctx.Input.Params()[":id"])
|
||||
this.Data["Post"] = models.GetBlog(id)
|
||||
this.Layout = "layout.tpl"
|
||||
this.TplNames = "view.tpl"
|
||||
this.TplName = "view.tpl"
|
||||
}
|
||||
```
|
||||
NewController
|
||||
@@ -89,7 +89,7 @@ type NewController struct {
|
||||
|
||||
func (this *NewController) Get() {
|
||||
this.Layout = "layout.tpl"
|
||||
this.TplNames = "new.tpl"
|
||||
this.TplName = "new.tpl"
|
||||
}
|
||||
|
||||
func (this *NewController) Post() {
|
||||
@@ -110,10 +110,10 @@ type EditController struct {
|
||||
}
|
||||
|
||||
func (this *EditController) Get() {
|
||||
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
|
||||
id, _ := strconv.Atoi(this.Ctx.Input.Params()[":id"])
|
||||
this.Data["Post"] = models.GetBlog(id)
|
||||
this.Layout = "layout.tpl"
|
||||
this.TplNames = "edit.tpl"
|
||||
this.TplName = "edit.tpl"
|
||||
}
|
||||
|
||||
func (this *EditController) Post() {
|
||||
@@ -135,7 +135,7 @@ type DeleteController struct {
|
||||
}
|
||||
|
||||
func (this *DeleteController) Get() {
|
||||
id, _ := strconv.Atoi(this.Ctx.Input.Params[":id"])
|
||||
id, _ := strconv.Atoi(this.Ctx.Input.Params()[":id"])
|
||||
blog := models.GetBlog(id)
|
||||
this.Data["Post"] = blog
|
||||
models.DelBlog(blog)
|
||||
|
||||
Reference in New Issue
Block a user