暂存一下,防止丢失

This commit is contained in:
2026-07-24 16:07:18 +08:00
parent 5d6e23f1a5
commit a18ed8bc8d
180 changed files with 13597 additions and 1986 deletions

View File

@@ -33,6 +33,15 @@ func registerShopRoutes(router fiber.Router, handler *admin.ShopHandler, doc *op
Auth: true,
})
Register(shops, doc, groupPath, "GET", "/business-owner-candidates", coreShopManagement(handler.BusinessOwnerCandidates), RouteSpec{
Summary: "查询店铺业务员候选",
Description: "仅超级管理员和平台账号可查询;只返回当前启用、未删除的平台账号最小摘要。",
Tags: []string{"店铺管理"},
Input: new(dto.ShopBusinessOwnerCandidateRequest),
Output: new(dto.ShopBusinessOwnerCandidatePageResult),
Auth: true,
})
Register(shops, doc, groupPath, "PUT", "/:id", coreShopManagement(handler.Update), RouteSpec{
Summary: "更新店铺",
Description: constants.ShopManagementAccessDescription,
@@ -42,6 +51,15 @@ func registerShopRoutes(router fiber.Router, handler *admin.ShopHandler, doc *op
Auth: true,
})
Register(shops, doc, groupPath, "PUT", "/:id/credit-limit", handler.UpdateCreditLimit, RouteSpec{
Summary: "调整既有店铺实际信用额度",
Description: "后端不校验按钮权限shop:credit-limit:manage 仅供前端控制按钮显示。",
Tags: []string{"代理商资金管理"},
Input: new(dto.UpdateShopCreditLimitParams),
Output: new(dto.ShopCreditLimitResponse),
Auth: true,
})
Register(shops, doc, groupPath, "DELETE", "/:id", coreShopManagement(handler.Delete), RouteSpec{
Summary: "删除店铺",
Description: constants.ShopManagementAccessDescription,
@@ -61,6 +79,19 @@ func registerShopRoutes(router fiber.Router, handler *admin.ShopHandler, doc *op
})
}
func registerShopDetailRoute(router fiber.Router, handler *admin.ShopHandler, doc *openapi.Generator, basePath string) {
shops := router.Group("/shops")
groupPath := basePath + "/shops"
Register(shops, doc, groupPath, "GET", "/:id", coreShopManagement(handler.Detail), RouteSpec{
Summary: "查询店铺详情",
Description: constants.ShopManagementAccessDescription + " 返回与店铺列表一致的业务员归属摘要。",
Tags: []string{"店铺管理"},
Input: new(dto.IDReq),
Output: new(dto.ShopResponse),
Auth: true,
})
}
func coreShopManagement(handler fiber.Handler) fiber.Handler {
return func(c *fiber.Ctx) error {
if middleware.GetUserTypeFromContext(c.UserContext()) == constants.UserTypeEnterprise {
@@ -103,12 +134,13 @@ func registerShopCommissionRoutes(router fiber.Router, handler *admin.ShopCommis
shops := router.Group("/shops")
groupPath := basePath + "/shops"
Register(shops, doc, groupPath, "GET", "/fund-summary", handler.ListFundSummary, RouteSpec{
Summary: "代理商资金概况",
Tags: []string{"代理商资金管理"},
Input: new(dto.ShopFundSummaryListReq),
Output: new(dto.ShopFundSummaryPageResult),
Auth: true,
Register(shops, doc, groupPath, "GET", "/fund-summary", agentFundManagement(handler.ListFundSummary), RouteSpec{
Summary: "代理商资金概况",
Description: "按当前店铺数据范围分页返回主钱包、佣金及信用资金事实;现金可用、总可用和欠款均由服务端计算,读取不代表具有调额权限。",
Tags: []string{"代理商资金管理"},
Input: new(dto.ShopFundSummaryListReq),
Output: new(dto.ShopFundSummaryPageResult),
Auth: true,
})
Register(shops, doc, groupPath, "GET", "/:shop_id/withdrawal-requests", handler.ListWithdrawalRequests, RouteSpec{
@@ -169,3 +201,12 @@ func registerShopCommissionRoutes(router fiber.Router, handler *admin.ShopCommis
Auth: true,
})
}
func agentFundManagement(handler fiber.Handler) fiber.Handler {
return func(c *fiber.Ctx) error {
if middleware.GetUserTypeFromContext(c.UserContext()) == constants.UserTypeEnterprise {
return errors.New(errors.CodeForbidden, constants.AgentFundManagementForbiddenMessage)
}
return handler(c)
}
}