实现基本管理员数据访问接口

This commit is contained in:
2025-12-30 19:24:03 +08:00
parent 1262a8dae4
commit f638baec64
8 changed files with 311 additions and 102 deletions

View File

@@ -10,7 +10,23 @@ import (
func ApplyRouters(app *fiber.App) {
api := app.Group("/api")
userRouter(api)
adminRouter(api)
// 回调
callbacks := app.Group("/callback")
callbacks.Get("/identify", handlers.IdentifyCallbackNew)
// 临时
if env.RunMode == env.RunModeDev {
debug := app.Group("/debug")
debug.Get("/sms/:phone", handlers.DebugGetSmsCode)
debug.Get("/proxy/register", handlers.DebugRegisterProxyBaiYin)
}
}
// 用户接口路由
func userRouter(api fiber.Router) {
// 认证
auth := api.Group("/auth")
auth.Get("/authorize", auth2.AuthorizeGet)
@@ -37,8 +53,8 @@ func ApplyRouters(app *fiber.App) {
// 套餐
resource := api.Group("/resource")
resource.Post("/all", handlers.AllActiveResource)
resource.Post("/list/short", handlers.ListResourceShort)
resource.Post("/list/long", handlers.ListResourceLong)
resource.Post("/list/short", handlers.PageResourceShort)
resource.Post("/list/long", handlers.PageResourceLong)
resource.Post("/create", handlers.CreateResource)
resource.Post("/price", handlers.ResourcePrice)
resource.Post("/statistics/free", handlers.StatisticResourceFree)
@@ -74,7 +90,7 @@ func ApplyRouters(app *fiber.App) {
proxy.Post("/online", handlers.ProxyReportOnline)
proxy.Post("/offline", handlers.ProxyReportOffline)
proxy.Post("/update", handlers.ProxyReportUpdate)
proxy.Post("/register", handlers.ProxyRegisterBaiYin)
proxy.Post("/register/baidyin", handlers.ProxyRegisterBaiYin)
// 节点
edge := api.Group("/edge")
@@ -84,15 +100,34 @@ func ApplyRouters(app *fiber.App) {
// 前台
inquiry := api.Group("/inquiry")
inquiry.Post("/create", handlers.CreateInquiry)
// 回调
callbacks := app.Group("/callback")
callbacks.Get("/identify", handlers.IdentifyCallbackNew)
// 临时
if env.RunMode == env.RunModeDev {
debug := app.Group("/debug")
debug.Get("/sms/:phone", handlers.DebugGetSmsCode)
debug.Get("/proxy/register", handlers.DebugRegisterProxyBaiYin)
}
}
// 管理员接口路由
func adminRouter(api fiber.Router) {
api = api.Group("/admin")
// user 用户
var user = api.Group("/user")
user.Post("/page", handlers.PageUserByAdmin)
// resource 套餐
var resource = api.Group("/resource")
resource.Post("/short/page", handlers.PageResourceShortByAdmin)
resource.Post("/long/page", handlers.PageResourceLongByAdmin)
// batch 批次
var usage = api.Group("batch")
usage.Post("/page", handlers.PageBatchByAdmin)
// channel 通道
var channel = api.Group("/channel")
channel.Post("/page", handlers.PageChannelsByAdmin)
// trade 交易
var trade = api.Group("trade")
trade.Post("/page", handlers.PageTradeByAdmin)
// bill 账单
var bill = api.Group("/bill")
bill.Post("/page", handlers.PageBillByAdmin)
}