Some checks failed
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Has been cancelled
F-1: 佣金链断裂时创建 status=99 零额待审记录,新增修正接口 POST /commission-records/:id/resolve F-4: C端订单查询从 Handler 迁移至 Service 层,移除 SkipPermissionCtx J-1: 富友支付 JSAPI/MiniApp 预下单实现,回调补全签名验证 J-2: 平台钱包代购支持(buyerType 为空时使用资产所属代理钱包) J-3: 套餐激活后自动更新卡/设备 status=3,最后套餐过期后更新 status=4 支付抽象: 引入 PaymentProvider 接口 + 微信/富友适配器,CreateOrder 支持多支付渠道 修复: 设备/IoT卡响应 DTO 移除 omitempty,空值字段返回 null 而非省略
115 lines
3.8 KiB
Go
115 lines
3.8 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 registerShopRoleRoutes(router fiber.Router, handler *admin.ShopRoleHandler, doc *openapi.Generator, basePath string) {
|
|
shops := router.Group("/shops")
|
|
groupPath := basePath + "/shops"
|
|
|
|
Register(shops, doc, groupPath, "POST", "/:shop_id/roles", handler.AssignShopRoles, RouteSpec{
|
|
Summary: "分配店铺默认角色",
|
|
Tags: []string{"店铺管理"},
|
|
Input: new(dto.AssignShopRolesRequest),
|
|
Output: new(dto.ShopRolesResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shops, doc, groupPath, "GET", "/:shop_id/roles", handler.GetShopRoles, RouteSpec{
|
|
Summary: "查询店铺默认角色",
|
|
Tags: []string{"店铺管理"},
|
|
Input: new(dto.GetShopRolesRequest),
|
|
Output: new(dto.ShopRolesResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(shops, doc, groupPath, "DELETE", "/:shop_id/roles/:role_id", handler.DeleteShopRole, RouteSpec{
|
|
Summary: "删除店铺默认角色",
|
|
Tags: []string{"店铺管理"},
|
|
Input: new(dto.DeleteShopRoleRequest),
|
|
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,
|
|
})
|
|
|
|
commissionRecords := router.Group("/commission-records")
|
|
crPath := basePath + "/commission-records"
|
|
|
|
Register(commissionRecords, doc, crPath, "POST", "/:id/resolve", handler.ResolveCommissionRecord, RouteSpec{
|
|
Summary: "修正待审佣金记录",
|
|
Tags: []string{"代理商佣金管理"},
|
|
Input: new(dto.CommissionRecordResolveRequest),
|
|
Auth: true,
|
|
})
|
|
}
|