package web import ( "platform/web/handlers" "github.com/gofiber/fiber/v2" ) func ApplyRouters(app *fiber.App) { api := app.Group("/api") // 认证 auth := api.Group("/auth") auth.Post("/token", handlers.Token) auth.Post("/revoke", handlers.Revoke) auth.Post("/introspect", handlers.Introspect) auth.Post("/verify/sms", handlers.SmsCode) // 用户 user := api.Group("/user") user.Post("/update", handlers.UpdateUser) user.Post("/update/account", handlers.UpdateAccount) user.Post("/update/password", handlers.UpdatePassword) user.Post("/identify", handlers.Identify) user.Post("/identify/callback", handlers.IdentifyCallback) user.Post("/recharge/prepare/alipay", handlers.RechargePrepareAlipay) user.Post("/recharge/confirm/alipay", handlers.RechargeConfirmAlipay) user.Post("/recharge/prepare/wechat", handlers.RechargePrepareWechat) user.Post("/recharge/confirm/wechat", handlers.RechargeConfirmWechat) // 白名单 whitelist := api.Group("/whitelist") whitelist.Post("/list", handlers.ListWhitelist) whitelist.Post("/create", handlers.CreateWhitelist) whitelist.Post("/update", handlers.UpdateWhitelist) whitelist.Post("/remove", handlers.RemoveWhitelist) // 套餐 resource := api.Group("/resource") resource.Post("/list/short", handlers.ListResourceShort) resource.Post("/all", handlers.AllResource) resource.Post("/create", handlers.CreateResource) resource.Post("/create/prepare", handlers.PrepareCreateResource) resource.Post("/create/complete", handlers.CompleteCreateResource) resource.Post("/price", handlers.ResourcePrice) // 通道 channel := api.Group("/channel") channel.Post("/list", handlers.ListChannels) channel.Post("/create", handlers.CreateChannel) channel.Post("/remove", handlers.RemoveChannels) // 交易 trade := api.Group("/trade") trade.Post("/callback/alipay", handlers.AlipayCallback) // 账单 bill := api.Group("/bill") bill.Post("/list", handlers.ListBill) // 公告 announcement := api.Group("/announcement") announcement.Post("/list", handlers.ListAnnouncements) // 网关 proxy := api.Group("/proxy") proxy.Post("/online", handlers.OnlineProxy) proxy.Post("/offline", handlers.OfflineProxy) proxy.Post("/assign", handlers.AssignProxyFwdPort) // 节点 edge := api.Group("/edge") edge.Post("/online", handlers.OnlineEdge) edge.Post("/offline", handlers.OfflineEdge) // 临时 app.Get("/test", func(c *fiber.Ctx) error { return c.JSON(c.GetReqHeaders()) }) }