feat: 完善商品筛选、发布配置与优质号主流程
This commit is contained in:
@@ -158,6 +158,16 @@ func TestApplyAdminListFiltersSmartRouting(t *testing.T) {
|
||||
query: AdminListQuery{Keyword: "12345"},
|
||||
wantSQLFrag: "l.listing_no = ? OR EXISTS (SELECT 1 FROM rental_orders AS o WHERE o.listing_id = l.id AND o.order_no = ?) OR l.id = ?",
|
||||
},
|
||||
{
|
||||
name: "赔付方案按商品快照筛选",
|
||||
query: AdminListQuery{CompensationPlan: "insurance"},
|
||||
wantSQLFrag: "l.compensation_plan = ?",
|
||||
},
|
||||
{
|
||||
name: "极品专区按商品快照筛选",
|
||||
query: AdminListQuery{Zone: "premium"},
|
||||
wantSQLFrag: "l.is_premium = ?",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
@@ -110,22 +110,24 @@ type AdminUpdateScreenshotsRequest struct {
|
||||
}
|
||||
|
||||
type AdminListQuery struct {
|
||||
OwnerID uint64
|
||||
Keyword string
|
||||
Status string
|
||||
ReviewStatus string
|
||||
Insurance []string
|
||||
Stamina []string
|
||||
Load []string
|
||||
SkinGroup []string
|
||||
SkinName []string
|
||||
MinCoin *float64
|
||||
MaxCoin *float64
|
||||
MinDeposit *float64
|
||||
MaxDeposit *float64
|
||||
Limit int
|
||||
Page int
|
||||
PageSize int
|
||||
OwnerID uint64
|
||||
Keyword string
|
||||
Status string
|
||||
ReviewStatus string
|
||||
CompensationPlan string
|
||||
Zone string
|
||||
Insurance []string
|
||||
Stamina []string
|
||||
Load []string
|
||||
SkinGroup []string
|
||||
SkinName []string
|
||||
MinCoin *float64
|
||||
MaxCoin *float64
|
||||
MinDeposit *float64
|
||||
MaxDeposit *float64
|
||||
Limit int
|
||||
Page int
|
||||
PageSize int
|
||||
}
|
||||
|
||||
type AdminListResult struct {
|
||||
|
||||
@@ -75,6 +75,8 @@ func parseAdminListQuery(c *gin.Context) (AdminListQuery, bool) {
|
||||
query.Keyword = strings.TrimSpace(c.Query("keyword"))
|
||||
query.Status = c.Query("status")
|
||||
query.ReviewStatus = c.Query("review_status")
|
||||
query.CompensationPlan = strings.TrimSpace(c.Query("compensation_plan"))
|
||||
query.Zone = strings.TrimSpace(c.Query("zone"))
|
||||
query.Insurance = parseCSVQuery(c.Query("insurance"))
|
||||
query.Stamina = parseCSVQuery(c.Query("stamina"))
|
||||
query.Load = parseCSVQuery(c.Query("load"))
|
||||
|
||||
@@ -131,6 +131,15 @@ func (r *Repository) applyAdminListFilters(db *gorm.DB, query AdminListQuery) *g
|
||||
if query.ReviewStatus != "" {
|
||||
db = db.Where("l.review_status = ?", query.ReviewStatus)
|
||||
}
|
||||
if query.CompensationPlan != "" {
|
||||
db = db.Where("l.compensation_plan = ?", query.CompensationPlan)
|
||||
}
|
||||
switch query.Zone {
|
||||
case "premium":
|
||||
db = db.Where("l.is_premium = ?", true)
|
||||
case "normal":
|
||||
db = db.Where("l.is_premium = ?", false)
|
||||
}
|
||||
if query.MinCoin != nil {
|
||||
db = db.Where(
|
||||
"EXISTS (SELECT 1 FROM game_accounts AS coin_account WHERE coin_account.id = l.account_id AND coin_account.haf_coin_amount >= ?)",
|
||||
|
||||
Reference in New Issue
Block a user