From d4d20f4ddfbf83a821692e6eeeb63c335b8fb1e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 6 Dec 2019 15:26:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E8=8D=90=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/model/dao/store_sku.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index 01a9b2b94..c2c9164dd 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -707,19 +707,22 @@ func GetTopCategorysByStoreIDs(db *DaoDB, storeIDs []int) (skuCategory []*model. JOIN order_sku b ON a.vendor_order_id = b.vendor_order_id JOIN sku c ON b.sku_id = c.id AND c.deleted_at = ? JOIN sku_name d ON d.id = c.name_id AND d.deleted_at = ? - WHERE 1=1 - AND a.order_created_at BETWEEN ? and NOW() + JOIN store e ON e.id = a.store_id + JOIN (SELECT city_code FROM store WHERE 1=1 ` sqlParams := []interface{}{ utils.DefaultTimeValue, utils.DefaultTimeValue, - time.Now().AddDate(0, -1, 0), } if len(storeIDs) > 0 { - sql += " AND a.store_id in(" + GenQuestionMarks(len(storeIDs)) + ")" + sql += " AND id IN(" + GenQuestionMarks(len(storeIDs)) + ")" sqlParams = append(sqlParams, storeIDs) } + sql += ` + )t6 ON t6.city_code = e.city_code + WHERE 1=1 + AND a.order_created_at BETWEEN ? and NOW() AND b.sale_price > ? GROUP BY d.category_id)t1 JOIN sku_category t3 ON t1.category_id = t3.id @@ -731,7 +734,7 @@ func GetTopCategorysByStoreIDs(db *DaoDB, storeIDs []int) (skuCategory []*model. Order by t4.count DESC)t5 LIMIT ? ` - sqlParams = append(sqlParams, 100, 2, utils.DefaultTimeValue, 1, 10) + sqlParams = append(sqlParams, time.Now().AddDate(0, -1, 0), 100, 2, utils.DefaultTimeValue, 1, 10) err = GetRows(db, &skuCategory, sql, sqlParams...) return skuCategory, err }