diff --git a/business/jxstore/report/report.go b/business/jxstore/report/report.go index e2b9b8f78..ca0b29060 100644 --- a/business/jxstore/report/report.go +++ b/business/jxstore/report/report.go @@ -65,6 +65,9 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn var priceReferSnapshotList []*model.PriceReferSnapshot db := dao.GetDB() snapshotAt := utils.Time2Date(time.Now().AddDate(0, 0, -1)) + dao.DeletePriceReferHistory(db, utils.Time2Date(snapshotAt.AddDate(0, 0, -7))) + priceReferSnapshotDelete := &model.PriceReferSnapshot{SnapshotAt: snapshotAt} + dao.DeleteEntity(db, priceReferSnapshotDelete, "SnapshotAt") taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) { switch step { case 0: @@ -79,9 +82,6 @@ func BeginSavePriceRefer(ctx *jxcontext.Context, cityCodes, skuIDs []int, isAsyn } } }() - dao.DeletePriceReferHistory(db, utils.Time2Date(snapshotAt.AddDate(0, 0, -7))) - priceReferSnapshotDelete := &model.PriceReferSnapshot{SnapshotAt: snapshotAt} - dao.DeleteEntity(db, priceReferSnapshotDelete, "SnapshotAt") taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { v := batchItemList[0].(*model.PriceReferSnapshot) dao.WrapAddIDCULDEntity(v, ctx.GetUserName()) diff --git a/business/model/store.go b/business/model/store.go index 26ade2838..604371afc 100644 --- a/business/model/store.go +++ b/business/model/store.go @@ -475,7 +475,8 @@ type PriceReferSnapshot struct { func (*PriceReferSnapshot) TableUnique() [][]string { return [][]string{ - []string{"CityCode", "NameID", "SkuID", "SnapshotAt"}, + []string{"CityCode", "SkuID", "SnapshotAt"}, + []string{"CityCode", "NameID", "SnapshotAt"}, } }