错误提示,门店评分修改

This commit is contained in:
苏尹岚
2019-12-12 13:38:06 +08:00
parent 4a4342def0
commit 19704b74bc
12 changed files with 86 additions and 65 deletions

View File

@@ -2542,9 +2542,14 @@ func GetStorePriceScore(ctx *jxcontext.Context, storeIDs []int, fromScore, toSco
return pagedInfo, err
}
func CreateStorePriceScore(ctx *jxcontext.Context) (err error) {
func CreateStorePriceScore(ctx *jxcontext.Context, forRefresh bool) (err error) {
db := dao.GetDB()
snapshotAt := utils.Time2Date(time.Now())
var snapshotAt time.Time
if forRefresh {
snapshotAt = utils.Time2Date(time.Now().AddDate(0, 0, -1))
} else {
snapshotAt = utils.Time2Date(time.Now())
}
storePriceScoreSnapshot, err := dao.GetStorePriceScoreSnapshot(db, snapshotAt)
if len(storePriceScoreSnapshot) > 0 {
dao.Begin(db)
@@ -2556,7 +2561,10 @@ func CreateStorePriceScore(ctx *jxcontext.Context) (err error) {
}
}
}()
dao.DeleteEntity(db, storePriceScoreSnapshot[0], "SnapshotAt")
priceReferSnapshotDeleteHis := &model.StorePriceScoreSnapshot{SnapshotAt: snapshotAt.AddDate(0, -1, 0)}
priceReferSnapshotDelete := &model.StorePriceScoreSnapshot{SnapshotAt: snapshotAt}
dao.DeleteEntity(db, priceReferSnapshotDeleteHis, "SnapshotAt")
dao.DeleteEntity(db, priceReferSnapshotDelete, "SnapshotAt")
for _, v := range storePriceScoreSnapshot {
dao.WrapAddIDCULDEntity(v, ctx.GetUserName())
v.SnapshotAt = snapshotAt

View File

@@ -2143,6 +2143,9 @@ func GetTopCategorysByStoreIDs(ctx *jxcontext.Context, storeIDs []int) (skuCateg
func RefershStoreSkusMidPrice(ctx *jxcontext.Context, storeIDs []int) (err error) {
db := dao.GetDB()
_, err = dao.RefershStoreSkusMidPrice(db, storeIDs)
if err == nil {
CreateStorePriceScore(ctx, true)
}
return err
}