门店促销

This commit is contained in:
苏尹岚
2019-12-26 09:05:19 +08:00
parent 11310fc16d
commit 90cbc5c81f
4 changed files with 15 additions and 15 deletions

View File

@@ -2548,13 +2548,13 @@ func StoreStatus2Chinese(status int) (str string) {
}
}
func GetStorePriceScore(ctx *jxcontext.Context, storeIDs, vendorIDs []int, fromScore, toScore, sort, directSort, secKillSort int, snapDate string, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
func GetStorePriceScore(ctx *jxcontext.Context, storeIDs, vendorIDs []int, fromScore, toScore, sort int, snapDate string, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
var snapDateParam time.Time
db := dao.GetDB()
if snapDate != "" {
snapDateParam = utils.Str2Time(snapDate)
}
storePriceScore, totalCount, err := dao.GetStorePriceScore(db, storeIDs, vendorIDs, fromScore, toScore, sort, directSort, secKillSort, snapDateParam, offset, pageSize)
storePriceScore, totalCount, err := dao.GetStorePriceScore(db, storeIDs, vendorIDs, fromScore, toScore, sort, snapDateParam, offset, pageSize)
pagedInfo = &model.PagedInfo{
Data: storePriceScore,
TotalCount: totalCount,
@@ -2589,6 +2589,7 @@ func CreateStorePriceScore(ctx *jxcontext.Context) (err error) {
}
}
dao.Commit(db)
globals.SugarLogger.Debugf("CreateStorePriceScore")
}
return err
}

View File

@@ -6,6 +6,8 @@ import (
"math"
"time"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model"
@@ -76,6 +78,7 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int) (err e
}
}
dao.Commit(db)
globals.SugarLogger.Debugf("CreatePriceRefer")
}
return err
}

View File

@@ -489,7 +489,7 @@ func GetStoreMapsListWithoutDisabled(db *DaoDB, vendorIDs []int, status int) (st
return storeMapList, err
}
func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore, sort, directSort, secKillSort int, snapDate time.Time, offset, pageSize int) (StorePriceScore []*StorePriceScore, totalCount int, err error) {
func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore, sort int, snapDate time.Time, offset, pageSize int) (StorePriceScore []*StorePriceScore, totalCount int, err error) {
sql := `
SELECT SQL_CALC_FOUND_ROWS a.store_id,score store_score,e.name city_name,b.name store_name
FROM store_price_score_snapshot a
@@ -533,19 +533,17 @@ func GetStorePriceScore(db *DaoDB, storeIDs, vendorIDs []int, fromScore, toScore
sql += " AND a.snapshot_at = ?"
sqlParams = append(sqlParams, snapDate)
}
if sort == 0 {
if sort == 1 {
sql += " ORDER BY a.score"
} else if sort == 1 {
} else if sort == -1 {
sql += " ORDER BY a.score DESC"
}
if directSort == 0 {
} else if sort == 2 {
sql += " ORDER BY t1.direct_down_count"
} else if directSort == 1 {
} else if sort == -2 {
sql += " ORDER BY t1.direct_down_count DESC"
}
if secKillSort == 0 {
} else if sort == 3 {
sql += " ORDER BY t1.sec_kill_count"
} else if secKillSort == 1 {
} else if sort == -3 {
sql += " ORDER BY t1.sec_kill_count DESC"
}
sql += " LIMIT ? OFFSET ?"