From d42c92a2e1445ad4f6c2cdfc37246d893ac5a32e Mon Sep 17 00:00:00 2001 From: break Date: Thu, 13 Aug 2026 16:33:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/handler/admin/shop_commission.go | 3 +++ internal/model/dto/shop_commission_dto.go | 1 + internal/query/shop/fund_summary.go | 3 +++ 3 files changed, 7 insertions(+) diff --git a/internal/handler/admin/shop_commission.go b/internal/handler/admin/shop_commission.go index a907a56..8618d05 100644 --- a/internal/handler/admin/shop_commission.go +++ b/internal/handler/admin/shop_commission.go @@ -35,6 +35,9 @@ func (h *ShopCommissionHandler) ListFundSummary(c *fiber.Ctx) error { if err := c.QueryParser(&req); err != nil { return errors.New(errors.CodeInvalidParam) } + if c.Context().QueryArgs().Has("shop_id") && (req.ShopID == nil || *req.ShopID == 0) { + return errors.New(errors.CodeInvalidParam) + } if h.fundSummaryQuery == nil { return errors.New(errors.CodeInternalError, "代理商资金概况查询能力未配置") diff --git a/internal/model/dto/shop_commission_dto.go b/internal/model/dto/shop_commission_dto.go index 083b3bd..73c2bb1 100644 --- a/internal/model/dto/shop_commission_dto.go +++ b/internal/model/dto/shop_commission_dto.go @@ -8,6 +8,7 @@ package dto type ShopFundSummaryListReq struct { Page int `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码(默认1)"` PageSize int `json:"page_size" query:"page_size" validate:"omitempty,min=1,max=100" minimum:"1" maximum:"100" description:"每页数量(默认20,最大100)"` + ShopID *uint `json:"shop_id" query:"shop_id" validate:"omitempty,min=1" minimum:"1" description:"店铺ID精确筛选"` ShopName string `json:"shop_name" query:"shop_name" validate:"omitempty,max=100" maxLength:"100" description:"店铺名称(模糊查询)"` Username string `json:"username" query:"username" validate:"omitempty,max=50" maxLength:"50" description:"主账号用户名(模糊查询)"` } diff --git a/internal/query/shop/fund_summary.go b/internal/query/shop/fund_summary.go index 9e0d3b1..5741311 100644 --- a/internal/query/shop/fund_summary.go +++ b/internal/query/shop/fund_summary.go @@ -100,6 +100,9 @@ func normalizeFundSummaryPage(page, pageSize int) (int, int) { } func applyFundSummaryFilters(db *gorm.DB, req dto.ShopFundSummaryListReq) *gorm.DB { + if req.ShopID != nil { + db = db.Where("tb_shop.id = ?", *req.ShopID) + } if shopName := strings.TrimSpace(req.ShopName); shopName != "" { db = db.Where("shop_name ILIKE ?", "%"+shopName+"%") }