我正在研究beego应用程序。我试图在两台不同的机器上运行相同的代码。两者都是ubuntu。在一台机器上,它运行没有任何问题,但在其他机器上我得到了以下错误日志。我对两者都有相同的文件组织,你认为为什么会发生这种情况?
controllers/EventController.go:18: this.ServeJson undefined (type *EventController has no field or method ServeJson)
controllers/EventController.go:24: this.ServeJson undefined (type *EventController has no field or method ServeJson)
controllers/EventController.go:30: this.ServeJson undefined (type *EventController has no field or method ServeJson)
controllers/default.go:14: c.TplNames undefined (type *MainController has no field or method TplNames)
偶数控制器:
package controllers
import (
"github.com/astaxie/beego"
"solardatabase/models"
"solardatabase/dao"
"solardatabase/services"
)
type EventController struct {
beego.Controller
}
func (this *EventController) ListEvents() {
res := struct{ Tasks []*models.Event }{dao.GetAllEvents()}
this.Data["json"] = res
this.ServeJson()
}
func (this *EventController) ListEventsByRange() {
request, _ := models.CreateEventByTimeRangeRequest(this.Ctx.Input)
this.Data["json"] = dao.EventsByTimeRange(request)
this.ServeJson()
}
func (this *EventController) TemporalQuery() {
request, _ := models.CreateTemporalRequest(this.Ctx.Input)
this.Data["json"] = services.EventsByTimeFilter(request)
this.ServeJson()
}