You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
175 lines
5.7 KiB
175 lines
5.7 KiB
package router
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"live/app/controller/callback"
|
|
"live/app/controller/goods"
|
|
"live/app/controller/live"
|
|
"live/app/controller/order"
|
|
"live/app/controller/short"
|
|
"live/app/controller/topic"
|
|
"live/app/controller/user"
|
|
"live/app/controller/user/trend"
|
|
grend2 "live/app/controller/user/trend/comment"
|
|
"live/app/router/middleware"
|
|
)
|
|
|
|
func Router(router *gin.Engine) {
|
|
router.Use(middleware.CORS())
|
|
liveRouter := router.Group("/api/v1/live")
|
|
auth := middleware.Auth()
|
|
bothAuth := middleware.BothAuth()
|
|
|
|
// websocket
|
|
//wsC := &ws.Ws{}
|
|
//liveRouter.GET("ws", wsC.Ws)
|
|
|
|
liveRouter.Use(middleware.Decrypt())
|
|
{
|
|
// 橱柜
|
|
cupboardR := liveRouter.Group("/cupboard")
|
|
cupboardR.Use(auth)
|
|
{
|
|
cupboard := &goods.Cupboard{}
|
|
cupboardR.POST("list", cupboard.List) // 会员橱柜列表
|
|
cupboardR.POST("delete", cupboard.Delete) // 会员橱柜商品删除
|
|
}
|
|
// 商品
|
|
goodsR := liveRouter.Group("/goods")
|
|
{
|
|
goodsC := &goods.Goods{}
|
|
goodsR.POST("list", goodsC.List) // 商品列表
|
|
goodsR.POST("brandlist", goodsC.BrandList) // 品牌列表
|
|
goodsR.POST("brandgoodslist", goodsC.BrandGoodsList) // 品牌商品列表
|
|
}
|
|
// 会员
|
|
userR := liveRouter.Group("/user")
|
|
{
|
|
userC := &user.User{}
|
|
{
|
|
userR.POST("baseinfo", userC.BaseInfo) // 会员基础信息
|
|
}
|
|
|
|
followC := &user.Follow{}
|
|
|
|
userR.POST("follow/list", bothAuth, followC.List) // 会员关注列表
|
|
followR := userR.Group("follow")
|
|
followR.Use(auth)
|
|
{
|
|
followR.POST("add", followC.Add) // 添加关注
|
|
followR.POST("cancel", followC.Cancel) // 取消关注
|
|
}
|
|
|
|
trendC := &user.Trend{}
|
|
userR.POST("trend/list", bothAuth, trendC.List) // 会员动态列表
|
|
|
|
commentC := &trend.Comment{}
|
|
userR.POST("trend/comment/list", bothAuth, commentC.List) // 评论列表
|
|
userR.POST("trend/comment/add", auth, commentC.Add) // 评论列表
|
|
// 评论点赞
|
|
commentPraiseC := grend2.Praise{}
|
|
userR.POST("trend/comment/praise/add", auth, commentPraiseC.Add) // 评论点赞
|
|
userR.POST("trend/comment/praise/cancel", auth, commentPraiseC.Cancel) // 评论取消点赞
|
|
|
|
praiseC := &trend.Praise{}
|
|
userR.POST("trend/praise/add", auth, praiseC.Add) // 动态点赞
|
|
userR.POST("trend/praise/cancel", auth, praiseC.Cancel) // 动态取消点赞
|
|
|
|
liveC := user.Live{}
|
|
userR.POST("live/list", liveC.UserList) // 会员直播列表
|
|
}
|
|
// 订单
|
|
orderR := liveRouter.Group("/order")
|
|
{
|
|
orderGoodsC := &order.Goods{}
|
|
orderR.POST("history", auth, orderGoodsC.Histroy)
|
|
}
|
|
// 话题
|
|
topicR := liveRouter.Group("/topic")
|
|
{
|
|
topicC := &topic.Topic{}
|
|
topicR.POST("list", topicC.List) // 话题列表
|
|
topicR.POST("hot", topicC.Hot) // 热门话题
|
|
|
|
topicR.POST("info", bothAuth, topicC.Info) // 话题基础信息
|
|
topicR.POST("content/list", bothAuth, topicC.ContentList) // 话题内容列表
|
|
|
|
followC := &topic.Follow{}
|
|
topicR.POST("follow/list", bothAuth, followC.List)
|
|
topicR.POST("follow/add", bothAuth, followC.Add)
|
|
topicR.POST("follow/cancel", bothAuth, followC.Cancel)
|
|
}
|
|
|
|
// 短视频
|
|
shortR := liveRouter.Group("/short")
|
|
{
|
|
shortC := &short.Short{}
|
|
shortR.POST("list", bothAuth, shortC.List) // 短视频列表
|
|
shortR.POST("upload_sign", auth, shortC.UploadSign) // 短视频列表
|
|
shortR.POST("publish", auth, shortC.Publish) // 短视频列表
|
|
shortR.POST("info", shortC.Info) // 短视频列表
|
|
}
|
|
|
|
// 直播
|
|
liveR := liveRouter.Group("/live")
|
|
{
|
|
liveC := &live.Live{}
|
|
{
|
|
liveR.POST("license", liveC.License) // 直播列表
|
|
liveR.POST("list", liveC.List) // 直播列表
|
|
liveR.POST("info", auth, liveC.Info) // 当前用户直播信息获取
|
|
liveR.POST("agree", auth, liveC.Agree) // 同意协议
|
|
liveR.POST("follow_list", auth, liveC.FollowList) // 关注主播直播列表
|
|
liveR.POST("start", auth, liveC.Start) // 开始直播
|
|
liveR.POST("stop", auth, liveC.Stop) // 结束直播
|
|
liveR.POST("transcribe", auth, liveC.Transcribe) // 确认录制视频
|
|
liveR.POST("live_info", bothAuth, liveC.LiveInfo) // 获取直播间信息
|
|
liveR.POST("video_info", bothAuth, liveC.VideoInfo) // 录播信息
|
|
liveR.POST("explain", auth, liveC.Explain) // 讲解
|
|
liveR.POST("un_explain", auth, liveC.UnExplain) // 取消讲解
|
|
liveR.POST("user_data", bothAuth, liveC.UserData) // 获取用户数据
|
|
|
|
dataC := live.Data{}
|
|
{
|
|
liveR.POST("data/list", auth, dataC.List) // 直播场次列表
|
|
liveR.POST("data/info", auth, dataC.Info) // 直播统计详情
|
|
liveR.POST("data/count", auth, dataC.Count) // 统计数据
|
|
}
|
|
|
|
praiseC := &live.Praise{}
|
|
liveR.POST("praise/add", auth, praiseC.Add) // 直播点赞
|
|
|
|
reportC := live.Report{}
|
|
{
|
|
liveR.POST("report/types", reportC.Types) // 举报类型
|
|
liveR.POST("report/submit", auth, reportC.Submit) // 举报类型
|
|
}
|
|
}
|
|
imR := liveR.Group("im")
|
|
imC := &live.Im{}
|
|
{
|
|
imR.POST("login_info", auth, imC.LoginInfo) // 获取当前账号im账号信息
|
|
imR.POST("no_login_info", imC.NoLoginInfo) // 获取游客im账号信息
|
|
imR.POST("buy_goods", auth, imC.BuyGoods) // 获取游客im账号信息
|
|
}
|
|
}
|
|
// 回调
|
|
callbackR := liveRouter.Group("callback")
|
|
{
|
|
liveC := &callback.Live{}
|
|
{
|
|
callbackR.POST("push", liveC.Push)
|
|
callbackR.POST("cutout", liveC.Cutout)
|
|
callbackR.POST("identify", liveC.Identify)
|
|
callbackR.POST("screenshot", liveC.ScreenShot)
|
|
callbackR.POST("transcribe", liveC.Transcribe)
|
|
}
|
|
|
|
shortC := &callback.Short{}
|
|
{
|
|
callbackR.POST("short", shortC.Callback)
|
|
}
|
|
}
|
|
}
|
|
}
|