fix: resolve frontend build error and order refund bug, add member price filter

This commit is contained in:
2026-01-07 21:49:04 +08:00
parent 5b45f7d5c4
commit a1de16bc01
18 changed files with 772 additions and 282 deletions

View File

@@ -38,6 +38,37 @@ func (s *content) List(ctx context.Context, filter *content_dto.ContentListFilte
q = q.Where(tbl.IsPinned.Is(*filter.IsPinned))
}
if filter.PriceType != nil && *filter.PriceType != "all" {
if *filter.PriceType == "member" {
q = q.Where(tbl.Visibility.Eq(consts.ContentVisibilityTenantOnly))
} else {
pTbl, pQ := models.ContentPriceQuery.QueryContext(ctx)
var shouldFilter bool
var prices []*models.ContentPrice
if *filter.PriceType == "free" {
shouldFilter = true
prices, _ = pQ.Where(pTbl.PriceAmount.Eq(0)).Select(pTbl.ContentID).Find()
} else if *filter.PriceType == "paid" {
shouldFilter = true
prices, _ = pQ.Where(pTbl.PriceAmount.Gt(0)).Select(pTbl.ContentID).Find()
}
if shouldFilter {
ids := make([]int64, len(prices))
for i, p := range prices {
ids[i] = p.ContentID
}
if len(ids) > 0 {
q = q.Where(tbl.ID.In(ids...))
} else {
q = q.Where(tbl.ID.Eq(-1))
}
}
}
}
// Sort
sort := "latest"
if filter.Sort != nil && *filter.Sort != "" {