feat: 代理商资金可见性重构(agent-fund-visibility)
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m10s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 7m10s
- 将 GET /shops/commission-summary 重命名为 GET /shops/fund-summary, 响应新增 main_balance、main_frozen_balance 两个预充值钱包字段 - 新增 GET /shops/:id/main-wallet/transactions 预充值钱包流水接口 - 将佣金统计、每日统计、发起提现从 /my/ 路径迁移至 /shops/:id/ 路径: GET /shops/:id/commission-stats GET /shops/:id/commission-daily-stats POST /shops/:id/withdrawal-requests - 删除 MyCommissionService、MyCommissionHandler 及全部 /my/ 路由 - 补齐 ListShopWithdrawalRequests、ListShopCommissionRecords 的 CanManageShop 越权校验(安全修复) - 提现接口增加严格权限:仅代理账号本人可为自己店铺发起提现 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -50,9 +50,6 @@ func RegisterAdminRoutes(router fiber.Router, handlers *bootstrap.Handlers, midd
|
||||
registerAuthorizationRoutes(authGroup, handlers.Authorization, doc, basePath)
|
||||
}
|
||||
|
||||
if handlers.MyCommission != nil {
|
||||
registerMyCommissionRoutes(authGroup, handlers.MyCommission, doc, basePath)
|
||||
}
|
||||
if handlers.IotCard != nil {
|
||||
registerIotCardRoutes(authGroup, handlers.IotCard, handlers.IotCardImport, doc, basePath)
|
||||
}
|
||||
|
||||
@@ -1,62 +0,0 @@
|
||||
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 registerMyCommissionRoutes(router fiber.Router, handler *admin.MyCommissionHandler, doc *openapi.Generator, basePath string) {
|
||||
my := router.Group("/my")
|
||||
groupPath := basePath + "/my"
|
||||
|
||||
Register(my, doc, groupPath, "GET", "/commission-summary", handler.GetSummary, RouteSpec{
|
||||
Summary: "我的佣金概览",
|
||||
Tags: []string{"我的佣金"},
|
||||
Input: nil,
|
||||
Output: new(dto.MyCommissionSummaryResp),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(my, doc, groupPath, "POST", "/withdrawal-requests", handler.CreateWithdrawal, RouteSpec{
|
||||
Summary: "发起提现申请",
|
||||
Tags: []string{"我的佣金"},
|
||||
Input: new(dto.CreateMyWithdrawalReq),
|
||||
Output: new(dto.CreateMyWithdrawalResp),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(my, doc, groupPath, "GET", "/withdrawal-requests", handler.ListWithdrawals, RouteSpec{
|
||||
Summary: "我的提现记录",
|
||||
Tags: []string{"我的佣金"},
|
||||
Input: new(dto.MyWithdrawalListReq),
|
||||
Output: new(dto.WithdrawalRequestPageResult),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(my, doc, groupPath, "GET", "/commission-records", handler.ListRecords, RouteSpec{
|
||||
Summary: "我的佣金明细",
|
||||
Tags: []string{"我的佣金"},
|
||||
Input: new(dto.MyCommissionRecordListReq),
|
||||
Output: new(dto.MyCommissionRecordPageResult),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(my, doc, groupPath, "GET", "/commission-stats", handler.GetStats, RouteSpec{
|
||||
Summary: "我的佣金统计",
|
||||
Tags: []string{"我的佣金"},
|
||||
Input: new(dto.CommissionStatsRequest),
|
||||
Output: new(dto.CommissionStatsResponse),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(my, doc, groupPath, "GET", "/commission-daily-stats", handler.GetDailyStats, RouteSpec{
|
||||
Summary: "我的每日佣金统计",
|
||||
Tags: []string{"我的佣金"},
|
||||
Input: new(dto.DailyCommissionStatsRequest),
|
||||
Output: []dto.DailyCommissionStatsResponse{},
|
||||
Auth: true,
|
||||
})
|
||||
}
|
||||
@@ -86,17 +86,17 @@ func registerShopCommissionRoutes(router fiber.Router, handler *admin.ShopCommis
|
||||
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),
|
||||
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", "/:shop_id/withdrawal-requests", handler.ListWithdrawalRequests, RouteSpec{
|
||||
Summary: "代理商提现记录",
|
||||
Tags: []string{"代理商佣金管理"},
|
||||
Tags: []string{"代理商资金管理"},
|
||||
Input: new(dto.ShopWithdrawalRequestListReq),
|
||||
Output: new(dto.ShopWithdrawalRequestPageResult),
|
||||
Auth: true,
|
||||
@@ -104,18 +104,50 @@ func registerShopCommissionRoutes(router fiber.Router, handler *admin.ShopCommis
|
||||
|
||||
Register(shops, doc, groupPath, "GET", "/:shop_id/commission-records", handler.ListCommissionRecords, RouteSpec{
|
||||
Summary: "代理商佣金明细",
|
||||
Tags: []string{"代理商佣金管理"},
|
||||
Tags: []string{"代理商资金管理"},
|
||||
Input: new(dto.ShopCommissionRecordListReq),
|
||||
Output: new(dto.ShopCommissionRecordPageResult),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(shops, doc, groupPath, "GET", "/:shop_id/main-wallet/transactions", handler.ListMainWalletTransactions, RouteSpec{
|
||||
Summary: "代理商预充值钱包流水",
|
||||
Tags: []string{"代理商资金管理"},
|
||||
Input: new(dto.MainWalletTransactionListRequest),
|
||||
Output: new(dto.MainWalletTransactionListResponse),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(shops, doc, groupPath, "GET", "/:shop_id/commission-stats", handler.GetCommissionStats, RouteSpec{
|
||||
Summary: "代理商佣金统计",
|
||||
Tags: []string{"代理商资金管理"},
|
||||
Input: new(dto.CommissionStatsRequest),
|
||||
Output: new(dto.CommissionStatsResponse),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(shops, doc, groupPath, "GET", "/:shop_id/commission-daily-stats", handler.GetCommissionDailyStats, RouteSpec{
|
||||
Summary: "代理商每日佣金统计",
|
||||
Tags: []string{"代理商资金管理"},
|
||||
Input: new(dto.DailyCommissionStatsRequest),
|
||||
Output: []dto.DailyCommissionStatsResponse{},
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Register(shops, doc, groupPath, "POST", "/:shop_id/withdrawal-requests", handler.CreateWithdrawal, RouteSpec{
|
||||
Summary: "发起提现申请",
|
||||
Tags: []string{"代理商资金管理"},
|
||||
Input: new(dto.CreateMyWithdrawalReq),
|
||||
Output: new(dto.CreateMyWithdrawalResp),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
commissionRecords := router.Group("/commission-records")
|
||||
crPath := basePath + "/commission-records"
|
||||
|
||||
Register(commissionRecords, doc, crPath, "POST", "/:id/resolve", handler.ResolveCommissionRecord, RouteSpec{
|
||||
Summary: "修正待审佣金记录",
|
||||
Tags: []string{"代理商佣金管理"},
|
||||
Tags: []string{"代理商资金管理"},
|
||||
Input: new(dto.CommissionRecordResolveRequest),
|
||||
Auth: true,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user