fix version 1

This commit is contained in:
2026-09-22 21:15:34 +08:00
parent 9f86366638
commit d63d7e8b3a
277 changed files with 9959 additions and 1514 deletions

View File

@@ -6,25 +6,33 @@ import (
"bsm/full/module/base/logs/internal/logic/hello"
"bsm/full/module/base/logs/internal/logic/log"
"git.apinb.com/bsm-sdk/core/middleware"
"github.com/gin-gonic/gin"
)
func Register(srvKey string, engine *gin.Engine) {
v1_key := fmt.Sprintf("/rest/%s", srvKey)
registerAnonymous(v1_key, engine)
registerAuth(v1_key, engine)
}
// registerAnonymous 不需要auth的接口
func registerAnonymous(v1_key string, engine *gin.Engine) {
// Anonymous router.
fmt.Println(v1_key)
anonymous := engine.Group(v1_key)
{
// anonymous.Use(middleware.JwtAuth(impl.RedisCache))
anonymous.GET("/ping", hello.Ping)
anonymous.POST("/create", log.Create)
anonymous.POST("/fetch", log.LogFetch)
anonymous.POST("/total", log.Total)
}
}
// registerAuth 需要JWT鉴权的业务接口
func registerAuth(v1_key string, engine *gin.Engine) {
// Authorized router.
auth := engine.Group(v1_key)
auth.Use(middleware.JwtAuth(true))
{
auth.POST("/create", log.Create)
auth.POST("/fetch", log.LogFetch)
auth.POST("/total", log.Total)
}
}