package controllers import ( "cc-officialweb/service" beego "github.com/beego/beego/v2/server/web" "strconv" ) type DetailController struct { beego.Controller } func (d *DetailController) Get() { id := d.Ctx.Input.Param(":id") atoi, err := strconv.Atoi(id) if err != nil { d.Redirect("/", 302) } detail := service.GetProductDetail(atoi) d.Data["detail"] = detail d.Data["showSection"] = true d.TplName = "product-detail.html" }