活动商品数查询修改

This commit is contained in:
苏尹岚
2020-01-19 16:50:09 +08:00
parent 9ab78e6844
commit 30974ee5ca

View File

@@ -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)