字段
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m26s

This commit is contained in:
2026-08-13 16:33:55 +08:00
parent 7e7f1cbb67
commit d42c92a2e1
3 changed files with 7 additions and 0 deletions

View File

@@ -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, "代理商资金概况查询能力未配置")

View File

@@ -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:"主账号用户名(模糊查询)"`
}

View File

@@ -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+"%")
}