diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 71ddf27ee..474b290a9 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -292,22 +292,18 @@ func getGetStoresSkusBaseSQL(db *dao.DaoDB, storeIDs, skuIDs []int, isFocus bool sql += ` JOIN store_sku_bind t4 ON t4.store_id = t3.id AND t4.sku_id = t2.id AND t4.deleted_at = ? LEFT JOIN sku_name_place_bind t5 ON t1.id = t5.name_id AND t3.city_code = t5.place_code - LEFT JOIN (SELECT count(*) count,id,city_code FROM store WHERE status = ? GROUP BY 2)te ON te.id = t3.id AND te.city_code = t3.city_code - LEFT JOIN price_refer_snapshot tn ON IF(te.count < 3 ,tn.city_code = 0, tn.city_code = t3.city_code) AND tn.sku_id = t2.id AND tn.snapshot_at = ? LEFT JOIN price_refer_snapshot t6 ON t6.city_code = 0 AND t6.sku_id = t2.id AND t6.snapshot_at = ? WHERE t1.deleted_at = ? AND (t1.is_global = 1 OR t5.id IS NOT NULL OR 1 = ?)/* AND t1.status = ?*/ ` sqlParams = append(sqlParams, []interface{}{ utils.DefaultTimeValue, - model.StoreStatusOpened, - utils.Time2Date(time.Now().AddDate(0, 0, -1)), utils.Time2Date(time.Now().AddDate(0, 0, -1)), utils.DefaultTimeValue, utils.Bool2Int(isFocus), // model.SkuStatusNormal, }) if isHighPrice { - sql += " AND t4.unit_price > tn.mid_unit_price / IF(t3.pay_percentage < 50 , 70, t3.pay_percentage) * 1.2" + sql += " AND t4.unit_price > t6.mid_unit_price / IF(t3.pay_percentage < 50 , 70, t3.pay_percentage) * 1.2" } if isFocus { sql += " AND ((t2.status = ? AND t1.status = ?) OR t4.status = ?)" @@ -489,10 +485,11 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, isFocus bo t3.id store_id, t1.id name_id ` + sql + ` GROUP BY 1, 2 - ORDER BY 1, 2 ` if isHighPrice { - sql2 += " , t4.unit_price DESC" + sql2 += " ORDER BY t4.unit_price DESC" + } else { + sql2 += " ORDER BY 1, 2" } sql2 += ` LIMIT ? OFFSET ?