This commit is contained in:
@@ -35,6 +35,9 @@ func (h *ShopCommissionHandler) ListFundSummary(c *fiber.Ctx) error {
|
|||||||
if err := c.QueryParser(&req); err != nil {
|
if err := c.QueryParser(&req); err != nil {
|
||||||
return errors.New(errors.CodeInvalidParam)
|
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 {
|
if h.fundSummaryQuery == nil {
|
||||||
return errors.New(errors.CodeInternalError, "代理商资金概况查询能力未配置")
|
return errors.New(errors.CodeInternalError, "代理商资金概况查询能力未配置")
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ package dto
|
|||||||
type ShopFundSummaryListReq struct {
|
type ShopFundSummaryListReq struct {
|
||||||
Page int `json:"page" query:"page" validate:"omitempty,min=1" minimum:"1" description:"页码(默认1)"`
|
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)"`
|
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:"店铺名称(模糊查询)"`
|
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:"主账号用户名(模糊查询)"`
|
Username string `json:"username" query:"username" validate:"omitempty,max=50" maxLength:"50" description:"主账号用户名(模糊查询)"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,9 @@ func normalizeFundSummaryPage(page, pageSize int) (int, int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func applyFundSummaryFilters(db *gorm.DB, req dto.ShopFundSummaryListReq) *gorm.DB {
|
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 != "" {
|
if shopName := strings.TrimSpace(req.ShopName); shopName != "" {
|
||||||
db = db.Where("shop_name ILIKE ?", "%"+shopName+"%")
|
db = db.Where("shop_name ILIKE ?", "%"+shopName+"%")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user