fix(admin): 商户筛选下拉改用不分页的精简接口
自查新做的下游订单页时发现的问题:商户筛选下拉调用 /api/platform/merchants?size=200,而分页查询会把 >100 的 size 静默降级为 20 (service.normalizePage),因此商户超过 20 家时下拉里会少一批商户,界面不报任何错。 - 新增 service.ListMerchantOptions:不分页返回全部启用商户的精简信息 (id/code/name),独立于分页的 ListMerchants - 新增 GET /api/platform/merchant-options - 前端改用该接口;types 增加 MerchantOption,api 增加 merchantOptions() 测试: - TestListMerchantOptionsReturnsAllActiveMerchants:造 25 家启用 + 1 家禁用, 断言返回数量与库中启用数一致、必须超过分页上限、且不含已禁用商户 - TestListMerchantsClampsOversizedPageSize:钉住「size=200 实际只返回 20 条, 而 total 反映真实总数」这一事实,即上面接口存在的理由
This commit is contained in:
@@ -236,6 +236,8 @@ func Setup(h *Handlers) *gin.Engine {
|
||||
platform.PATCH("/platform/admins/:id", h.User.UpdatePlatformAdmin)
|
||||
platform.DELETE("/platform/admins/:id", h.User.DeletePlatformAdmin)
|
||||
platform.GET("/platform/merchants", h.Merchant.ListPlatformMerchants)
|
||||
// 不分页的精简商户列表,供筛选下拉使用(分页接口的 size 上限是 100)
|
||||
platform.GET("/platform/merchant-options", h.Merchant.ListMerchantOptions)
|
||||
// 跨商户订单视图:商户后台的 /api/merchant/orders 强制单商户隔离,
|
||||
// 超管需要一条平台视角入口来查看全部下游订单。
|
||||
platform.GET("/platform/orders", h.Merchant.ListPlatformOrders)
|
||||
|
||||
Reference in New Issue
Block a user