All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 4m22s
- 移动 17 个 DTO 文件到 internal/model/dto/ 目录 - 更新所有 DTO 文件的 package 声明从 model 改为 dto - 更新所有引用文件的 import 和类型引用 - Handler 层:admin 和 h5 所有处理器 - Service 层:所有业务服务 - Routes 层:所有路由定义 - Tests 层:单元测试和集成测试 - 清理未使用的 import 语句 - 验证:项目构建成功,测试编译通过,LSP 无错误
121 lines
3.9 KiB
Go
121 lines
3.9 KiB
Go
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 registerShopRoutes(router fiber.Router, handler *admin.ShopHandler, doc *openapi.Generator, basePath string) {
|
|
shops := router.Group("/shops")
|
|
groupPath := basePath + "/shops"
|
|
|
|
Register(shops, doc, groupPath, "GET", "", handler.List, RouteSpec{
|
|
Summary: "店铺列表",
|
|
Tags: []string{"店铺管理"},
|
|
Input: new(dto.ShopListRequest),
|
|
Output: new(dto.ShopPageResult),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shops, doc, groupPath, "POST", "", handler.Create, RouteSpec{
|
|
Summary: "创建店铺",
|
|
Tags: []string{"店铺管理"},
|
|
Input: new(dto.CreateShopRequest),
|
|
Output: new(dto.ShopResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shops, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{
|
|
Summary: "更新店铺",
|
|
Tags: []string{"店铺管理"},
|
|
Input: new(dto.UpdateShopParams),
|
|
Output: new(dto.ShopResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shops, doc, groupPath, "DELETE", "/:id", handler.Delete, RouteSpec{
|
|
Summary: "删除店铺",
|
|
Tags: []string{"店铺管理"},
|
|
Input: new(dto.IDReq),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
}
|
|
|
|
func registerShopAccountRoutes(router fiber.Router, handler *admin.ShopAccountHandler, doc *openapi.Generator, basePath string) {
|
|
shopAccounts := router.Group("/shop-accounts")
|
|
groupPath := basePath + "/shop-accounts"
|
|
|
|
Register(shopAccounts, doc, groupPath, "GET", "", handler.List, RouteSpec{
|
|
Summary: "代理账号列表",
|
|
Tags: []string{"代理账号管理"},
|
|
Input: new(dto.ShopAccountListRequest),
|
|
Output: new(dto.ShopAccountPageResult),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shopAccounts, doc, groupPath, "POST", "", handler.Create, RouteSpec{
|
|
Summary: "创建代理账号",
|
|
Tags: []string{"代理账号管理"},
|
|
Input: new(dto.CreateShopAccountRequest),
|
|
Output: new(dto.ShopAccountResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shopAccounts, doc, groupPath, "PUT", "/:id", handler.Update, RouteSpec{
|
|
Summary: "更新代理账号",
|
|
Tags: []string{"代理账号管理"},
|
|
Input: new(dto.UpdateShopAccountParams),
|
|
Output: new(dto.ShopAccountResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shopAccounts, doc, groupPath, "PUT", "/:id/password", handler.UpdatePassword, RouteSpec{
|
|
Summary: "重置代理账号密码",
|
|
Tags: []string{"代理账号管理"},
|
|
Input: new(dto.UpdateShopAccountPasswordParams),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shopAccounts, doc, groupPath, "PUT", "/:id/status", handler.UpdateStatus, RouteSpec{
|
|
Summary: "启用/禁用代理账号",
|
|
Tags: []string{"代理账号管理"},
|
|
Input: new(dto.UpdateShopAccountStatusParams),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
}
|
|
|
|
func registerShopCommissionRoutes(router fiber.Router, handler *admin.ShopCommissionHandler, doc *openapi.Generator, basePath string) {
|
|
shops := router.Group("/shops")
|
|
groupPath := basePath + "/shops"
|
|
|
|
Register(shops, doc, groupPath, "GET", "/commission-summary", handler.ListCommissionSummary, RouteSpec{
|
|
Summary: "代理商佣金列表",
|
|
Tags: []string{"代理商佣金管理"},
|
|
Input: new(dto.ShopCommissionSummaryListReq),
|
|
Output: new(dto.ShopCommissionSummaryPageResult),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shops, doc, groupPath, "GET", "/:shop_id/withdrawal-requests", handler.ListWithdrawalRequests, RouteSpec{
|
|
Summary: "代理商提现记录",
|
|
Tags: []string{"代理商佣金管理"},
|
|
Input: new(dto.ShopWithdrawalRequestListReq),
|
|
Output: new(dto.ShopWithdrawalRequestPageResult),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shops, doc, groupPath, "GET", "/:shop_id/commission-records", handler.ListCommissionRecords, RouteSpec{
|
|
Summary: "代理商佣金明细",
|
|
Tags: []string{"代理商佣金管理"},
|
|
Input: new(dto.ShopCommissionRecordListReq),
|
|
Output: new(dto.ShopCommissionRecordPageResult),
|
|
Auth: true,
|
|
})
|
|
}
|