feat: 新增系列授权 Handler 和路由(/shop-series-grants)

Handler 实现 POST /shop-series-grants(创建)、GET /shop-series-grants(列表)、GET /shop-series-grants/:id(详情)、PUT /shop-series-grants/:id(更新佣金和强充配置)、PUT /shop-series-grants/:id/packages(管理授权内套餐)、DELETE /shop-series-grants/:id(删除)六个接口。

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-03-04 11:36:20 +08:00
parent ad3a7a770a
commit c5018f110f
2 changed files with 193 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
package routes
import (
"github.com/gofiber/fiber/v2"
"github.com/break/junhong_cmp_fiber/internal/handler/admin"
"github.com/break/junhong_cmp_fiber/internal/model/dto"
"github.com/break/junhong_cmp_fiber/pkg/openapi"
)
func registerShopSeriesGrantRoutes(router fiber.Router, handler *admin.ShopSeriesGrantHandler, doc *openapi.Generator, basePath string) {
grants := router.Group("/shop-series-grants")
groupPath := basePath + "/shop-series-grants"
Register(grants, doc, groupPath, "GET", "", handler.List, RouteSpec{
Summary: "查询代理系列授权列表",
Tags: []string{"代理系列授权"},
Input: new(dto.ShopSeriesGrantListRequest),
Output: new(dto.ShopSeriesGrantPageResult),
Auth: true,
})
Register(grants, doc, groupPath, "POST", "", handler.Create, RouteSpec{
Summary: "创建代理系列授权",
Tags: []string{"代理系列授权"},
Input: new(dto.CreateShopSeriesGrantRequest),
Output: new(dto.ShopSeriesGrantResponse),
Auth: true,
})
Register(grants, doc, groupPath, "GET", "/:id", handler.Get, RouteSpec{
Summary: "查询代理系列授权详情",
Tags: []string{"代理系列授权"},
Input: new(dto.IDReq),
Output: new(dto.ShopSeriesGrantResponse),
Auth: true,
})
Register(grants, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{
Summary: "更新代理系列授权",
Tags: []string{"代理系列授权"},
Input: new(dto.UpdateShopSeriesGrantParams),
Output: new(dto.ShopSeriesGrantResponse),
Auth: true,
})
Register(grants, doc, groupPath, "DELETE", "/:id", handler.Delete, RouteSpec{
Summary: "删除代理系列授权",
Tags: []string{"代理系列授权"},
Input: new(dto.IDReq),
Output: nil,
Auth: true,
})
Register(grants, doc, groupPath, "PUT", "/:id/packages", handler.ManagePackages, RouteSpec{
Summary: "管理授权套餐(新增/更新/删除)",
Tags: []string{"代理系列授权"},
Input: new(dto.ManageGrantPackagesParams),
Output: new(dto.ShopSeriesGrantResponse),
Auth: true,
})
}