Merge branch 'mark' of e.coding.net:rosydev/jx-callback into mark
This commit is contained in:
@@ -2413,18 +2413,18 @@ func StoreStatus2Chinese(status int) (str string) {
|
||||
}
|
||||
}
|
||||
|
||||
func GetStorePriceScore(ctx *jxcontext.Context, storeIDs []int, fromScore, toScore, sort int, snapDate string, offset, pageSize int) (storePriceScoreEx *dao.StorePriceScoreEx, err error) {
|
||||
func GetStorePriceScore(ctx *jxcontext.Context, storeIDs []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, fromScore, toScore, sort, snapDateParam, offset, pageSize)
|
||||
storePriceScoreEx = &dao.StorePriceScoreEx{
|
||||
StorePriceScoreList: storePriceScore,
|
||||
TotalCount: totalCount,
|
||||
pagedInfo = &model.PagedInfo{
|
||||
Data: storePriceScore,
|
||||
TotalCount: totalCount,
|
||||
}
|
||||
return storePriceScoreEx, err
|
||||
return pagedInfo, err
|
||||
}
|
||||
|
||||
func CreateStorePriceScore(ctx *jxcontext.Context) (err error) {
|
||||
|
||||
@@ -36,9 +36,18 @@ func GetStatisticsReportForAfsOrders(ctx *jxcontext.Context, storeIDs []int, fro
|
||||
return statisticsReportForOrdersList, err
|
||||
}
|
||||
|
||||
func StatisticsReportForStoreSkusPrice(ctx *jxcontext.Context, cityCodes, skuIDs []int) (priceRefer []*model.PriceReferSnapshot, err error) {
|
||||
func StatisticsReportForStoreSkusPrice(ctx *jxcontext.Context, cityCodes, skuIDs []int, snapDate string, offset, pageSize int) (pagedInfo *model.PagedInfo, err error) {
|
||||
var snapDateParam time.Time
|
||||
db := dao.GetDB()
|
||||
return dao.GetPriceReferSnapshot(db, cityCodes, skuIDs)
|
||||
if snapDate != "" {
|
||||
snapDateParam = utils.Str2Time(snapDate)
|
||||
}
|
||||
priceReferSnapshot, totalCount, err := dao.GetPriceReferSnapshot(db, cityCodes, skuIDs, snapDateParam, offset, pageSize)
|
||||
pagedInfo = &model.PagedInfo{
|
||||
Data: priceReferSnapshot,
|
||||
TotalCount: totalCount,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int) (err error) {
|
||||
|
||||
@@ -234,12 +234,12 @@ func GetStatisticsReportForStoreSkusPrice(db *DaoDB, cityCodes, skuIDs []int) (p
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func GetPriceReferSnapshot(db *DaoDB, cityCodes, skuIDs []int) (priceReferSnapshot []*model.PriceReferSnapshot, err error) {
|
||||
func GetPriceReferSnapshot(db *DaoDB, cityCodes, skuIDs []int, snapDate time.Time, offset, pageSize int) (priceReferSnapshot []*model.PriceReferSnapshot, totalCount int, err error) {
|
||||
sql := `
|
||||
SELECT *
|
||||
SELECT SQL_CALC_FOUND_ROWS *
|
||||
FROM price_refer_snapshot
|
||||
WHERE 1=1
|
||||
AND delete_at = ?
|
||||
AND deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
@@ -252,8 +252,16 @@ func GetPriceReferSnapshot(db *DaoDB, cityCodes, skuIDs []int) (priceReferSnapsh
|
||||
sql += " AND city_code IN (" + GenQuestionMarks(len(cityCodes)) + ")"
|
||||
sqlParams = append(sqlParams, cityCodes)
|
||||
}
|
||||
if err = GetRows(db, &priceReferSnapshot, sql, sqlParams...); err == nil {
|
||||
return priceReferSnapshot, nil
|
||||
if !utils.IsTimeZero(snapDate) {
|
||||
sql += " AND snapshot_at = ?"
|
||||
sqlParams = append(sqlParams, snapDate)
|
||||
}
|
||||
return nil, err
|
||||
sql += " LIMIT ? OFFSET ?"
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
Begin(db)
|
||||
defer Commit(db)
|
||||
if err = GetRows(db, &priceReferSnapshot, sql, sqlParams...); err == nil {
|
||||
totalCount = GetLastTotalRowCount(db)
|
||||
}
|
||||
return priceReferSnapshot, totalCount, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user