2025-03-15 16:07:45 +08:00
|
|
|
package web
|
|
|
|
|
|
2025-03-18 10:13:57 +08:00
|
|
|
import (
|
2025-03-18 17:57:07 +08:00
|
|
|
"platform/web/handlers"
|
2025-03-29 11:13:10 +08:00
|
|
|
"platform/web/services"
|
2025-03-18 17:57:07 +08:00
|
|
|
|
2025-03-18 10:13:57 +08:00
|
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
|
)
|
2025-03-15 16:07:45 +08:00
|
|
|
|
2025-03-18 17:57:07 +08:00
|
|
|
func ApplyRouters(app *fiber.App) {
|
|
|
|
|
api := app.Group("/api")
|
|
|
|
|
|
2025-03-26 14:57:44 +08:00
|
|
|
// 认证
|
2025-03-18 17:57:07 +08:00
|
|
|
auth := api.Group("/auth")
|
2025-03-28 15:01:30 +08:00
|
|
|
auth.Post("/verify/sms", PermitDevice(), handlers.SmsCode)
|
|
|
|
|
auth.Post("/login/sms", PermitDevice(), handlers.Login)
|
2025-03-18 17:57:07 +08:00
|
|
|
auth.Post("/token", handlers.Token)
|
2025-03-15 16:07:45 +08:00
|
|
|
|
2025-03-26 14:57:44 +08:00
|
|
|
// 通道
|
2025-03-28 18:15:03 +08:00
|
|
|
channel := api.Group("/channel")
|
2025-03-29 11:13:10 +08:00
|
|
|
channel.Post("/create", Permit([]services.PayloadType{
|
|
|
|
|
services.PayloadClientConfidential,
|
|
|
|
|
services.PayloadClientPublic,
|
|
|
|
|
services.PayloadUser,
|
|
|
|
|
services.PayloadAdmin,
|
|
|
|
|
}), handlers.CreateChannel)
|
2025-03-15 16:07:45 +08:00
|
|
|
}
|