router.go 1.21 KB
Newer Older
chenweijian's avatar
chenweijian committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
package route

import (
	"github.com/gin-gonic/gin"
	ginSwagger "github.com/swaggo/gin-swagger"
	"github.com/swaggo/gin-swagger/swaggerFiles"
	_ "hilo-user/docs"
	"hilo-user/route/user_r"
)

func InitRouter() *gin.Engine {
	var r = gin.Default()

	r.GET("/user-swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))

	needLogin := r.Group("")
	needLogin.Use(ExceptionHandle, LoggerHandle, JWTApiHandle)
	v1 := needLogin.Group("/v1")
	user := v1.Group("/user")
	{
		user.GET("/nameplate", wrapper(user_r.UserNameplate))
hujiebin's avatar
hujiebin committed
22
		user.GET("/bag/:resType", wrapper(user_r.UserBag))
chenweijian's avatar
chenweijian committed
23
	}
hujiebin's avatar
hujiebin committed
24 25 26 27 28
	inner := r.Group("/inner")
	inner.Use(ExceptionHandle, LoggerHandle)
	innerUser := inner.Group("/user")
	{
		innerUser.GET("/levels", wrapper(user_r.MGetUserLevels))
hujiebin's avatar
hujiebin committed
29
		innerUser.GET("/bag/id", wrapper(user_r.GetUserBagId))
hujiebin's avatar
hujiebin committed
30 31 32 33 34 35 36 37
	}
	// 道具相关
	innerProp := inner.Group("/prop")
	{
		innerProp.POST("/bag/send", wrapper(user_r.SendUserBag))           // 下发背包道具,暂礼物
		innerProp.POST("/noble/send", wrapper(user_r.SendUserNoble))       // 下发贵族
		innerProp.POST("/headwear/send", wrapper(user_r.SendUserHeadwear)) // 下发头饰
		innerProp.POST("/ride/send", wrapper(user_r.SendUserRide))         // 下发座驾
hujiebin's avatar
hujiebin committed
38
	}
chenweijian's avatar
chenweijian committed
39 40
	return r
}