From f5e8860b0ac185c0d9b2ab86a2f6ce9a303bf6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 8 Jan 2020 09:46:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=BA=8B=E5=8A=A1=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/report/report.go | 6 +++--- business/model/store.go | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) 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"}, } }