beego路由不生效原因

// GetVideoEpisodes 获取视频集数
func (c *VideoController) GetVideoEpisodes() {
    videoId, _ := c.GetInt("video_id")
    if videoId == 0 {
        c.Data["json"] = utils.Fail(50000, "必须选择视频ID")
        c.ServeJSON()
    }

    rows, episodes, err := models.GetVideoEpisodes(videoId)
    if err == nil {
        c.Data["json"] = utils.Success(0, "获取成功", episodes, rows)
        c.ServeJSON()
    }
    c.Data["json"] = utils.Fail(40004, "请求失败")
    c.ServeJSON()
}

// GetUserVideos 获取用户视频
func (c *VideoController) GetUserVideos() {
    uid, _ := c.GetInt("uid")
    if uid == 0 {
        c.Data["json"] = utils.Fail(40001, "请选择用户")
        c.ServeJSON()
    }

    rows, videos, err := models.GetUserVideos(uid)
    if err == nil {
        c.Data["json"] = utils.Success(0, "获取成功", videos, rows)
        c.ServeJSON()
    }
    c.Data["json"] = utils.Fail(40004, "请求失败")
    c.ServeJSON()
}

beego.NSRouter("/video/GetChannelHotList", &api.VideoController{}, "get:GetChannelHotList"),
beego.NSRouter("/video/GetChannelRegionRecommendList", &api.VideoController{}, "get:GetChannelRegionRecommendList"),
beego.NSRouter("/video/GetChannelTypeRecommendList", &api.VideoController{}, "get:GetChannelTypeRecommendList"),
beego.NSRouter("/video/GetVideoList", &api.VideoController{}, "get:GetVideoList"),
beego.NSRouter("/video/GetVideoInfo", &api.VideoController{}, "get:GetVideoInfo"),
beego.NSRouter("/video/GetVideoEpisodes", &api.VideoController{}, "get:GetVideoEpisodes"),
# 为什么这个路由不生效?
beego.NSRouter("/video/GetUserVideos", &api.VideoController{}, "get:GetUserVideos"),

其他路由都生效 VideoController 的

beego.NSRouter("/video/GetUserVideos", &api.VideoController{}, "get:GetUserVideos"),

这个之后的路由都没用,之前的都有用,是什么原因

最佳答案

怎么个失效法

2年前 评论
王大牛 (楼主) 2年前
deatil (作者) 2年前
王大牛 (楼主) 2年前
王大牛 (楼主) 2年前
deatil (作者) 2年前
讨论数量: 10

怎么个失效法

2年前 评论
王大牛 (楼主) 2年前
deatil (作者) 2年前
王大牛 (楼主) 2年前
王大牛 (楼主) 2年前
deatil (作者) 2年前

有报错?有日志?访问URL?有acceslog?404还是500?

2年前 评论
王大牛 (楼主) 2年前
wangchunbo 2年前
王大牛 (楼主) 2年前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!