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-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")
|
|
|
|
|
auth.Post("/token", handlers.Token)
|
2025-04-24 10:52:13 +08:00
|
|
|
auth.Post("/revoke", handlers.Revoke)
|
2025-04-26 17:59:34 +08:00
|
|
|
auth.Post("/introspect", handlers.Introspect)
|
2025-04-24 10:52:13 +08:00
|
|
|
auth.Post("/verify/sms", handlers.SmsCode)
|
2025-03-15 16:07:45 +08:00
|
|
|
|
2025-04-26 17:59:34 +08:00
|
|
|
// 用户
|
|
|
|
|
user := api.Group("/user")
|
2025-04-29 18:48:14 +08:00
|
|
|
user.Post("/update", handlers.UpdateUser)
|
|
|
|
|
user.Post("/update/account", handlers.UpdateAccount)
|
|
|
|
|
user.Post("/update/password", handlers.UpdatePassword)
|
2025-04-26 17:59:34 +08:00
|
|
|
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)
|
|
|
|
|
|
2025-03-26 14:57:44 +08:00
|
|
|
// 通道
|
2025-03-28 18:15:03 +08:00
|
|
|
channel := api.Group("/channel")
|
2025-04-28 11:44:54 +08:00
|
|
|
channel.Post("/list", handlers.ListChannels)
|
2025-04-15 14:30:24 +08:00
|
|
|
channel.Post("/create", handlers.CreateChannel)
|
2025-04-28 10:05:44 +08:00
|
|
|
channel.Post("/remove", handlers.RemoveChannels)
|
2025-04-08 09:35:19 +08:00
|
|
|
|
|
|
|
|
// 白名单
|
|
|
|
|
whitelist := api.Group("/whitelist")
|
|
|
|
|
whitelist.Post("/list", handlers.ListWhitelist)
|
|
|
|
|
whitelist.Post("/create", handlers.CreateWhitelist)
|
|
|
|
|
whitelist.Post("/update", handlers.UpdateWhitelist)
|
|
|
|
|
whitelist.Post("/remove", handlers.RemoveWhitelist)
|
2025-04-01 10:51:32 +08:00
|
|
|
|
2025-04-12 18:03:44 +08:00
|
|
|
// 套餐
|
2025-04-09 16:34:41 +08:00
|
|
|
resource := api.Group("/resource")
|
2025-05-17 15:54:42 +08:00
|
|
|
resource.Post("/list/short", handlers.ListResourceShort)
|
2025-04-12 18:03:44 +08:00
|
|
|
resource.Post("/all", handlers.AllResource)
|
2025-04-09 16:34:41 +08:00
|
|
|
resource.Post("/create/balance", handlers.CreateResourceByBalance)
|
2025-04-16 18:50:55 +08:00
|
|
|
resource.Post("/prepare/alipay", handlers.PrepareResourceByAlipay)
|
|
|
|
|
resource.Post("/create/alipay", handlers.CreateResourceByAlipay)
|
|
|
|
|
resource.Post("/prepare/wechat", handlers.PrepareResourceByWechat)
|
|
|
|
|
resource.Post("/create/wechat", handlers.CreateResourceByWechat)
|
2025-04-09 16:34:41 +08:00
|
|
|
|
2025-04-11 17:36:34 +08:00
|
|
|
// 账单
|
|
|
|
|
bill := api.Group("/bill")
|
|
|
|
|
bill.Post("/list", handlers.ListBill)
|
|
|
|
|
|
2025-04-17 18:29:44 +08:00
|
|
|
// 交易
|
|
|
|
|
trade := api.Group("/trade")
|
|
|
|
|
trade.Post("/callback/alipay", handlers.AlipayCallback)
|
2025-05-07 16:48:02 +08:00
|
|
|
|
|
|
|
|
// 公告
|
|
|
|
|
announcement := api.Group("/announcement")
|
|
|
|
|
announcement.Post("/list", handlers.ListAnnouncements)
|
2025-05-13 09:29:13 +08:00
|
|
|
|
|
|
|
|
// 网关
|
|
|
|
|
proxy := api.Group("/proxy")
|
|
|
|
|
proxy.Post("/online", handlers.OnlineProxy)
|
2025-05-13 15:26:40 +08:00
|
|
|
proxy.Post("/offline", handlers.OfflineProxy)
|
2025-05-14 17:45:14 +08:00
|
|
|
proxy.Post("/assign", handlers.AssignProxyFwdPort)
|
2025-05-13 09:29:13 +08:00
|
|
|
|
|
|
|
|
// 节点
|
|
|
|
|
edge := api.Group("/edge")
|
|
|
|
|
edge.Post("/online", handlers.OnlineEdge)
|
2025-05-14 17:45:14 +08:00
|
|
|
edge.Post("/offline", handlers.OfflineEdge)
|
2025-05-13 18:47:30 +08:00
|
|
|
|
|
|
|
|
// 临时
|
|
|
|
|
app.Get("/test", func(c *fiber.Ctx) error {
|
|
|
|
|
return c.JSON(c.GetReqHeaders())
|
|
|
|
|
})
|
2025-03-15 16:07:45 +08:00
|
|
|
}
|