diff --git a/business/model/dao/store.go b/business/model/dao/store.go index 97ee58b11..01eaea4bc 100644 --- a/business/model/dao/store.go +++ b/business/model/dao/store.go @@ -527,12 +527,14 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore FROM store_price_score_snapshot a JOIN store b ON b.id = a.store_id JOIN place e ON e.code = b.city_code - LEFT JOIN (SELECT a.store_id, count(d.type = ? OR NULL) direct_down_count, count(d.type = ? OR NULL) sec_kill_count - FROM store_sku_bind a - LEFT JOIN act_store_sku b ON a.store_id = b.store_id AND b.sku_id = a.sku_id - LEFT JOIN act_map c ON c.act_id = b.act_id - LEFT JOIN act d ON d.id = c.act_id - WHERE 1=1 + LEFT JOIN (SELECT t1.store_id,count(t1.type = ? OR NULL) direct_down_count, count(t1.type = ? OR NULL) sec_kill_count + FROM( + SELECT a.store_id, a.sku_id,d.type + FROM store_sku_bind a + LEFT JOIN act_store_sku b ON a.store_id = b.store_id AND b.sku_id = a.sku_id + LEFT JOIN act_map c ON c.act_id = b.act_id + LEFT JOIN act d ON d.id = c.act_id + WHERE 1=1 ` sqlParams := []interface{}{ model.ActSkuDirectDown, model.ActSkuSecKill, @@ -549,7 +551,8 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore AND NOW() BETWEEN d.begin_at AND d.end_at AND a.status = ? AND a.deleted_at = ? - GROUP BY a.store_id)t1 ON t1.store_id = a.store_id + GROUP BY 1,2,3)t1 + GROUP BY 1)ON t1.store_id = a.store_id WHERE 1=1 ` sqlParams = append(sqlParams, model.StoreSkuBindStatusNormal, utils.DefaultTimeValue)