init: radio init commit
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"sundynix-go/router/radio"
|
||||
"sundynix-go/router/system"
|
||||
)
|
||||
|
||||
@@ -9,4 +10,5 @@ var GroupApp = new(Group)
|
||||
// Group 路由组
|
||||
type Group struct {
|
||||
System system.SysRouterGroup
|
||||
Radio radio.RadioRouterGroup
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package radio
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type CategoryRouter struct{}
|
||||
|
||||
func (r *CategoryRouter) InitCategoryRouter(Router *gin.RouterGroup) {
|
||||
categoryRouter := Router.Group("/radio/category")
|
||||
{
|
||||
categoryRouter.POST("page", categoryApi.GetCategoryPage)
|
||||
categoryRouter.POST("list", categoryApi.GetCategoryList)
|
||||
categoryRouter.GET("detail", categoryApi.GetCategoryDetail)
|
||||
categoryRouter.POST("save", categoryApi.SaveCategory)
|
||||
categoryRouter.POST("update", categoryApi.UpdateCategory)
|
||||
categoryRouter.POST("delete", categoryApi.DeleteCategory)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package radio
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ChannelRouter struct{}
|
||||
|
||||
func (r *ChannelRouter) InitChannelRouter(Router *gin.RouterGroup) {
|
||||
channelRouter := Router.Group("/radio/channel")
|
||||
{
|
||||
channelRouter.POST("list", channelApi.GetChannelList)
|
||||
channelRouter.GET("detail", channelApi.GetChannelDetail)
|
||||
channelRouter.POST("save", channelApi.SaveChannel)
|
||||
channelRouter.POST("update", channelApi.UpdateChannel)
|
||||
channelRouter.POST("delete", channelApi.DeleteChannel)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package radio
|
||||
|
||||
import v1 "sundynix-go/api/v1"
|
||||
|
||||
type RadioRouterGroup struct {
|
||||
CategoryRouter
|
||||
ChannelRouter
|
||||
ProgramRouter
|
||||
SubscriptionRouter
|
||||
InteractionRouter
|
||||
}
|
||||
|
||||
var GroupApp = new(RadioRouterGroup)
|
||||
|
||||
var (
|
||||
categoryApi = v1.ApiGroupApp.RadioApiGroup.CategoryApi
|
||||
channelApi = v1.ApiGroupApp.RadioApiGroup.ChannelApi
|
||||
programApi = v1.ApiGroupApp.RadioApiGroup.ProgramApi
|
||||
subscriptionApi = v1.ApiGroupApp.RadioApiGroup.SubscriptionApi
|
||||
interactionApi = v1.ApiGroupApp.RadioApiGroup.InteractionApi
|
||||
)
|
||||
@@ -0,0 +1,38 @@
|
||||
package radio
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type InteractionRouter struct{}
|
||||
|
||||
func (r *InteractionRouter) InitInteractionRouter(Router *gin.RouterGroup) {
|
||||
// 收听历史
|
||||
historyRouter := Router.Group("history")
|
||||
{
|
||||
historyRouter.POST("list", interactionApi.GetHistoryList)
|
||||
historyRouter.POST("add", interactionApi.AddHistory)
|
||||
}
|
||||
|
||||
// 点赞
|
||||
likeRouter := Router.Group("like")
|
||||
{
|
||||
likeRouter.POST("toggle", interactionApi.ToggleLike)
|
||||
}
|
||||
|
||||
// 收藏
|
||||
favoriteRouter := Router.Group("favorite")
|
||||
{
|
||||
favoriteRouter.POST("list", interactionApi.GetFavoriteList)
|
||||
favoriteRouter.POST("add", interactionApi.AddFavorite)
|
||||
favoriteRouter.POST("remove", interactionApi.RemoveFavorite)
|
||||
}
|
||||
|
||||
// 评论
|
||||
commentRouter := Router.Group("comment")
|
||||
{
|
||||
commentRouter.POST("list", interactionApi.GetCommentList)
|
||||
commentRouter.POST("add", interactionApi.AddComment)
|
||||
commentRouter.POST("delete", interactionApi.DeleteComment)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package radio
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ProgramRouter struct{}
|
||||
|
||||
func (r *ProgramRouter) InitProgramRouter(Router *gin.RouterGroup) {
|
||||
programRouter := Router.Group("/radio/program")
|
||||
{
|
||||
programRouter.POST("list", programApi.GetProgramList)
|
||||
programRouter.GET("detail", programApi.GetProgramDetail)
|
||||
programRouter.POST("save", programApi.SaveProgram)
|
||||
programRouter.POST("update", programApi.UpdateProgram)
|
||||
programRouter.POST("delete", programApi.DeleteProgram)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package radio
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type SubscriptionRouter struct{}
|
||||
|
||||
func (r *SubscriptionRouter) InitSubscriptionRouter(Router *gin.RouterGroup) {
|
||||
subscriptionRouter := Router.Group("radio/subscription")
|
||||
{
|
||||
subscriptionRouter.POST("list", subscriptionApi.GetSubscriptionList)
|
||||
subscriptionRouter.POST("can-subscribe", subscriptionApi.CanSubscribe)
|
||||
subscriptionRouter.POST("subscribe", subscriptionApi.Subscribe)
|
||||
subscriptionRouter.POST("unsubscribe", subscriptionApi.Unsubscribe)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user