第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Beego 找不到控制器

Beego 找不到控制器

Go
不負(fù)相思意 2021-12-07 16:16:48
我正在研究 beego 應(yīng)用程序。我試圖在兩臺(tái)不同的機(jī)器上運(yùn)行相同的代碼。兩者都是ubuntu。在一臺(tái)機(jī)器上,它運(yùn)行沒(méi)有任何問(wèn)題,但在另一臺(tái)機(jī)器上我得到了以下錯(cuò)誤日志。我對(duì)兩者都有相同的文件組織,您認(rèn)為為什么會(huì)發(fā)生這種情況?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 controllersimport (    "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()}
查看完整描述

2 回答

?
絕地?zé)o雙

TA貢獻(xiàn)1946條經(jīng)驗(yàn) 獲得超4個(gè)贊

我發(fā)現(xiàn)了問(wèn)題。Beego 在我安裝機(jī)器之間發(fā)布了新版本。我以為它看不到整個(gè)控制器,但它只是函數(shù)的名稱(chēng)。

在新版本中:

serveJson() -> serveJSON()

配置也改變了。

Beego.HttpPort -> beego.BConfig.Listen.HTTPPort


查看完整回答
反對(duì) 回復(fù) 2021-12-07
?
德瑪西亞99

TA貢獻(xiàn)1770條經(jīng)驗(yàn) 獲得超3個(gè)贊

Beego 1.11.1 版本

這是區(qū)分大小寫(xiě)的。

改變

this.ServeJson()

this.ServeJSON()


查看完整回答
反對(duì) 回復(fù) 2021-12-07
  • 2 回答
  • 0 關(guān)注
  • 178 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)