2026-07-26 18:24:13 +08:00
|
|
|
// Package routers 注册与 sample/server 一致的匿名和 JWT 受保护路由组。
|
|
|
|
|
package routers
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
|
|
"git.apinb.com/bsm-sdk/core/middleware"
|
2026-07-26 18:29:36 +08:00
|
|
|
"git.apinb.com/heqiapp/platforms/backend/api/internal/logic/platform"
|
2026-07-26 18:24:13 +08:00
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Register 注册路由,请求地址格式: /{serviceKey}/v1/{domain}/{resource}。
|
|
|
|
|
func Register(srvKey string, engine *gin.Engine) {
|
|
|
|
|
v1Key := fmt.Sprintf("/%s/%s", srvKey, "v1")
|
|
|
|
|
anonymous := engine.Group(v1Key)
|
2026-07-26 18:29:36 +08:00
|
|
|
anonymous.GET("/ping/hello", platform.PingHello)
|
2026-07-26 18:24:13 +08:00
|
|
|
|
|
|
|
|
protected := engine.Group(v1Key)
|
|
|
|
|
protected.Use(middleware.JwtAuth(true))
|
|
|
|
|
{
|
2026-07-26 18:29:36 +08:00
|
|
|
protected.GET("/dashboard/overview", platform.DashboardOverview)
|
2026-07-26 18:24:13 +08:00
|
|
|
gasStationGroup := protected.Group("/organization/org_gas_station")
|
2026-07-26 18:29:36 +08:00
|
|
|
gasStationGroup.POST("", platform.CreateOrgGasStation)
|
|
|
|
|
gasStationGroup.GET("", platform.ListOrgGasStation)
|
|
|
|
|
protected.GET("/organization/org_delivery_point", platform.ListOrgDeliveryPoint)
|
|
|
|
|
protected.GET("/organization/org_service_person", platform.ListOrgServicePerson)
|
|
|
|
|
protected.GET("/identity/idn_account", platform.ListIdnAccount)
|
|
|
|
|
protected.GET("/safety/saf_event", platform.ListSafEvent)
|
2026-07-26 18:24:13 +08:00
|
|
|
}
|
|
|
|
|
}
|