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.

75 lines
2.1 KiB

5 years ago
package router
import (
"github.com/gin-gonic/gin"
"live/app/controller/goods"
"live/app/controller/topic"
"live/app/controller/user"
"live/app/controller/user/grend"
"live/app/controller/ws"
5 years ago
"live/app/router/middleware"
)
func Router(router *gin.Engine) {
liveRouter := router.Group("/api/v1/live")
// websocket
wsC := &ws.Ws{}
liveRouter.GET("ws", wsC.Ws)
5 years ago
liveRouter.Use(middleware.Decrypt())
{
// 橱柜
cupboardR := liveRouter.Group("/cupboard")
cupboardR.Use(middleware.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) // 品牌商品列表
5 years ago
}
// 会员
userR := liveRouter.Group("/user")
{
followC := &user.Follow{}
userR.POST("follow/list", middleware.BothAuth(), followC.List) // 会员关注列表
followR := userR.Group("follow")
followR.Use(middleware.Auth())
{
followR.POST("add", followC.Add) // 添加关注
followR.POST("cancel", followC.Cancel) // 取消关注
}
trendC := &user.Trend{}
userR.POST("trend/list", trendC.List) // 会员动态列表
commentC := &grend.Comment{}
userR.POST("trend/comment/list", commentC.List) // 评论列表
userR.POST("trend/comment/add", middleware.Auth(), commentC.Add) // 评论列表
praiseC := &grend.Praise{}
userR.POST("trend/praise/add", middleware.Auth(), praiseC.Add) // 点赞
userR.POST("trend/praise/cancel", middleware.Auth(), praiseC.Cancel) // 取消点赞
}
// 话题
topicR := liveRouter.Group("/topic")
{
topicC := &topic.Topic{}
topicR.POST("list", topicC.List) // 话题列表
topicR.POST("hot", topicC.Hot) // 热门话题
followC := &topic.Follow{}
topicR.POST("follow/list", middleware.BothAuth(), followC.List)
}
5 years ago
}
}