Merge branch 'mark' of e.coding.net:rosydev/jx-callback into mark
This commit is contained in:
@@ -676,10 +676,12 @@ func GetTopSkusByStoreIDs(db *DaoDB, storeIDs []int) (skuName []*model.SkuName,
|
||||
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()
|
||||
`
|
||||
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)) + ")"
|
||||
@@ -699,7 +701,10 @@ func GetTopSkusByStoreIDs(db *DaoDB, storeIDs []int) (skuName []*model.SkuName,
|
||||
|
||||
func GetTopCategorysByStoreIDs(db *DaoDB, storeIDs []int) (skuCategory []*model.SkuCategory, err error) {
|
||||
sql := `
|
||||
SELECT t3.*
|
||||
SELECT DISTINCT t5.* FROM(
|
||||
SELECT d.*
|
||||
FROM (
|
||||
SELECT t3.*,t1.count
|
||||
FROM(
|
||||
SELECT SUM(b.count) count,d.category_id
|
||||
FROM goods_order a
|
||||
@@ -707,10 +712,12 @@ func GetTopCategorysByStoreIDs(db *DaoDB, storeIDs []int) (skuCategory []*model.
|
||||
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()
|
||||
`
|
||||
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)) + ")"
|
||||
@@ -722,10 +729,13 @@ func GetTopCategorysByStoreIDs(db *DaoDB, storeIDs []int) (skuCategory []*model.
|
||||
JOIN sku_category t3 ON t1.category_id = t3.id
|
||||
AND t3.level = ?
|
||||
AND t3.deleted_at = ?
|
||||
ORDER BY t1.count DESC
|
||||
ORDER BY t1.count DESC)t4
|
||||
JOIN sku_category d ON d.id = t4.parent_id
|
||||
AND d.level = ?
|
||||
Order by t4.count DESC)t5
|
||||
LIMIT ?
|
||||
`
|
||||
sqlParams = append(sqlParams, 100, 2, utils.DefaultTimeValue, 10)
|
||||
sqlParams = append(sqlParams, 100, 2, utils.DefaultTimeValue, 1, 10)
|
||||
err = GetRows(db, &skuCategory, sql, sqlParams...)
|
||||
return skuCategory, err
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ func (c *StoreSkuController) GetMissingStoreSkuFromOrder() {
|
||||
|
||||
// @Title 根据门店信息查找推荐商品(按销量)
|
||||
// @Description 根据门店信息查找推荐商品(按销量)
|
||||
// @Param token header string true "认证token"
|
||||
// @Param token header string false "认证token"
|
||||
// @Param storeIDs query string true "门店列表"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
@@ -467,7 +467,7 @@ func (c *StoreSkuController) GetTopSkusByStoreIDs() {
|
||||
|
||||
// @Title 根据门店信息查找推荐分类(按商品销量)
|
||||
// @Description 根据门店信息查找推荐分类(按商品销量)
|
||||
// @Param token header string true "认证token"
|
||||
// @Param token header string false "认证token"
|
||||
// @Param storeIDs query string true "门店列表"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
// @Failure 200 {object} controllers.CallResult
|
||||
|
||||
Reference in New Issue
Block a user