整体优化完善接口与数据权限检查
This commit is contained in:
@@ -15,6 +15,7 @@ func ApplyRouters(app *fiber.App) {
|
||||
api := app.Group("/api")
|
||||
userRouter(api)
|
||||
adminRouter(api)
|
||||
clientRouter(api)
|
||||
|
||||
// 回调
|
||||
callbacks := app.Group("/callback")
|
||||
@@ -45,7 +46,6 @@ func userRouter(api fiber.Router) {
|
||||
auth.Post("/token", auth2.Token)
|
||||
auth.Post("/revoke", auth2.Revoke)
|
||||
auth.Post("/introspect", auth2.Introspect)
|
||||
auth.Post("/verify/sms", handlers.SmsCode)
|
||||
|
||||
// 用户
|
||||
user := api.Group("/user")
|
||||
@@ -67,19 +67,18 @@ func userRouter(api fiber.Router) {
|
||||
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)
|
||||
resource.Post("/statistics/usage", handlers.StatisticResourceUsage)
|
||||
|
||||
// 批次
|
||||
batch := api.Group("/batch")
|
||||
batch.Post("/page", handlers.PageResourceBatch)
|
||||
batch.Post("/page", handlers.PageBatch)
|
||||
|
||||
// 通道
|
||||
channel := api.Group("/channel")
|
||||
channel.Post("/list", handlers.ListChannels)
|
||||
channel.Post("/list", handlers.ListChannel)
|
||||
channel.Post("/create", handlers.CreateChannel)
|
||||
channel.Post("/remove", handlers.RemoveChannels)
|
||||
|
||||
// 交易
|
||||
trade := api.Group("/trade")
|
||||
@@ -101,7 +100,6 @@ func userRouter(api fiber.Router) {
|
||||
proxy.Post("/online", handlers.ProxyReportOnline)
|
||||
proxy.Post("/offline", handlers.ProxyReportOffline)
|
||||
proxy.Post("/update", handlers.ProxyReportUpdate)
|
||||
proxy.Post("/register/baidyin", handlers.ProxyRegisterBaiYin)
|
||||
|
||||
// 节点
|
||||
edge := api.Group("/edge")
|
||||
@@ -113,39 +111,60 @@ func userRouter(api fiber.Router) {
|
||||
inquiry.Post("/create", handlers.CreateInquiry)
|
||||
}
|
||||
|
||||
// 客户端接口路由
|
||||
func clientRouter(api fiber.Router) {
|
||||
client := api
|
||||
|
||||
// 验证短信令牌
|
||||
client.Post("/sms/verify", handlers.SmsCode)
|
||||
|
||||
// 套餐定价查询
|
||||
resource := client.Group("/resource")
|
||||
resource.Post("/price", handlers.ResourcePrice)
|
||||
|
||||
// 通道管理
|
||||
channel := client.Group("/channel")
|
||||
channel.Post("/remove", handlers.RemoveChannels)
|
||||
|
||||
// 代理网关注册
|
||||
proxy := client.Group("/proxy")
|
||||
proxy.Post("/register/baidyin", handlers.ProxyRegisterBaiYin)
|
||||
}
|
||||
|
||||
// 管理员接口路由
|
||||
func adminRouter(api fiber.Router) {
|
||||
api = api.Group("/admin")
|
||||
|
||||
// permission 权限
|
||||
var permission = api.Group("/permission")
|
||||
permission.Post("/list", handlers.ListPermissionsByAdmin)
|
||||
permission.Post("/page", handlers.PagePermissionByAdmin)
|
||||
|
||||
// admin-role 管理员角色
|
||||
var adminRole = api.Group("/admin-role")
|
||||
adminRole.Post("/list", handlers.ListAdminRolesByAdmin)
|
||||
adminRole.Post("/page", handlers.PageAdminRolesByAdmin)
|
||||
adminRole.Post("/create", handlers.CreateAdminRole)
|
||||
adminRole.Post("/update", handlers.UpdateAdminRole)
|
||||
adminRole.Post("/remove", handlers.RemoveAdminRole)
|
||||
|
||||
// admin 管理员账户
|
||||
// admin 管理员
|
||||
var admin = api.Group("/admin")
|
||||
admin.Post("/page", handlers.PageAdminsByAdmin)
|
||||
admin.Post("/all", handlers.ListAdminsByAdmin)
|
||||
admin.Post("/all", handlers.AllAdminByAdmin)
|
||||
admin.Post("/page", handlers.PageAdminByAdmin)
|
||||
admin.Post("/create", handlers.CreateAdmin)
|
||||
admin.Post("/update", handlers.UpdateAdmin)
|
||||
admin.Post("/remove", handlers.RemoveAdmin)
|
||||
|
||||
// admin-role 管理员角色
|
||||
var adminRole = api.Group("/admin-role")
|
||||
adminRole.Post("/list", handlers.AllAdminRoleByAdmin)
|
||||
adminRole.Post("/page", handlers.PageAdminRoleByAdmin)
|
||||
adminRole.Post("/create", handlers.CreateAdminRole)
|
||||
adminRole.Post("/update", handlers.UpdateAdminRole)
|
||||
adminRole.Post("/remove", handlers.RemoveAdminRole)
|
||||
|
||||
// permission 权限
|
||||
var permission = api.Group("/permission")
|
||||
permission.Post("/list", handlers.AllPermissionByAdmin)
|
||||
permission.Post("/page", handlers.PagePermissionByAdmin)
|
||||
|
||||
// user 用户
|
||||
var user = api.Group("/user")
|
||||
user.Post("/page", handlers.PageUserByAdmin)
|
||||
user.Post("/bind", handlers.BindAdmin)
|
||||
user.Post("/create", handlers.CreateUserByAdmin)
|
||||
user.Post("/update", handlers.UpdateUserByAdmin)
|
||||
user.Post("/remove", handlers.RemoveUserByAdmin)
|
||||
|
||||
user.Post("/bind", handlers.BindAdmin)
|
||||
|
||||
// resource 套餐
|
||||
var resource = api.Group("/resource")
|
||||
resource.Post("/short/page", handlers.PageResourceShortByAdmin)
|
||||
@@ -153,15 +172,15 @@ func adminRouter(api fiber.Router) {
|
||||
resource.Post("/update", handlers.UpdateResourceByAdmin)
|
||||
|
||||
// batch 批次
|
||||
var usage = api.Group("batch")
|
||||
usage.Post("/page", handlers.PageBatchByAdmin)
|
||||
var batch = api.Group("/batch")
|
||||
batch.Post("/page", handlers.PageBatchByAdmin)
|
||||
|
||||
// channel 通道
|
||||
var channel = api.Group("/channel")
|
||||
channel.Post("/page", handlers.PageChannelsByAdmin)
|
||||
channel.Post("/page", handlers.PageChannelByAdmin)
|
||||
|
||||
// trade 交易
|
||||
var trade = api.Group("trade")
|
||||
var trade = api.Group("/trade")
|
||||
trade.Post("/page", handlers.PageTradeByAdmin)
|
||||
|
||||
// bill 账单
|
||||
@@ -170,29 +189,31 @@ func adminRouter(api fiber.Router) {
|
||||
|
||||
// product 产品
|
||||
var product = api.Group("/product")
|
||||
product.Post("/all", handlers.AllProductsByAdmin)
|
||||
product.Post("/all", handlers.AllProductByAdmin)
|
||||
product.Post("/create", handlers.CreateProduct)
|
||||
product.Post("/update", handlers.UpdateProduct)
|
||||
product.Post("/remove", handlers.DeleteProduct)
|
||||
|
||||
product.Post("/sku/all", handlers.AllProductSkuByAdmin)
|
||||
product.Post("/sku/page", handlers.PageProductSkuByAdmin)
|
||||
product.Post("/sku/create", handlers.CreateProductSku)
|
||||
product.Post("/sku/update", handlers.UpdateProductSku)
|
||||
product.Post("/sku/update/discount/batch", handlers.BatchUpdateProductSkuDiscount)
|
||||
product.Post("/sku/remove", handlers.DeleteProductSku)
|
||||
|
||||
product.Post("/sku/update/discount/batch", handlers.BatchUpdateProductSkuDiscount)
|
||||
|
||||
// discount 折扣
|
||||
var discount = api.Group("/discount")
|
||||
discount.Post("/page", handlers.PageProductDiscountByAdmin)
|
||||
discount.Post("/all", handlers.AllProductDiscountsByAdmin)
|
||||
discount.Post("/create", handlers.CreateProductDiscount)
|
||||
discount.Post("/update", handlers.UpdateProductDiscount)
|
||||
discount.Post("/remove", handlers.DeleteProductDiscount)
|
||||
discount.Post("/all", handlers.AllDiscountByAdmin)
|
||||
discount.Post("/page", handlers.PageDiscountByAdmin)
|
||||
discount.Post("/create", handlers.CreateDiscount)
|
||||
discount.Post("/update", handlers.UpdateDiscount)
|
||||
discount.Post("/remove", handlers.DeleteDiscount)
|
||||
|
||||
// coupon 优惠券
|
||||
var coupon = api.Group("/coupon")
|
||||
coupon.Post("/all", handlers.AllCouponByAdmin)
|
||||
coupon.Post("/page", handlers.PageCouponByAdmin)
|
||||
coupon.Post("/all", handlers.AllCouponsByAdmin)
|
||||
coupon.Post("/create", handlers.CreateCoupon)
|
||||
coupon.Post("/update", handlers.UpdateCoupon)
|
||||
coupon.Post("/remove", handlers.DeleteCoupon)
|
||||
|
||||
Reference in New Issue
Block a user