diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 838aac8b0..3e22fd5aa 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -3848,7 +3848,7 @@ func getSkuNamePrice(db *dao.DaoDB, skuID int, orgPrice int64) (price int64, nam func BackUpStoreSkuBind(ctx *jxcontext.Context, isAsync, isContinueWhenError bool) (hint string, err error) { var ( db = dao.GetDB() - snapshotAt = time.Now() + snapshotAt = utils.Time2Date(time.Now()) ) storeSkuBindHis := &model.StoreSkuBindHistory{ SnapshotAt: snapshotAt.AddDate(0, 0, -3), @@ -3856,10 +3856,10 @@ func BackUpStoreSkuBind(ctx *jxcontext.Context, isAsync, isContinueWhenError boo storeSkuBindHis2 := &model.StoreSkuBindHistory{ SnapshotAt: snapshotAt, } - dao.DeleteEntity(db, storeSkuBindHis, "SnapShotAt") - dao.DeleteEntity(db, storeSkuBindHis2, "SnapShotAt") + dao.DeleteEntity(db, storeSkuBindHis, "SnapshotAt") + dao.DeleteEntity(db, storeSkuBindHis2, "SnapshotAt") storeList, err := dao.GetStoreList(db, nil, nil, nil, nil, "") - task := tasksch.NewParallelTask("RefreshOrdersPriceInfo", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, + task := tasksch.NewParallelTask("BackUpStoreSkuBind", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx, func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) { store := batchItemList[0].(*model.Store) storeSku, err := dao.GetStoresSkusInfo(db, []int{store.ID}, nil) @@ -3867,7 +3867,8 @@ func BackUpStoreSkuBind(ctx *jxcontext.Context, isAsync, isContinueWhenError boo storeSkuBindHis := &model.StoreSkuBindHistory{} storeSkuBindHis.StoreSkuBind = *v storeSkuBindHis.StoreSkuBindID = v.ID - storeSkuBindHis.SnapshotAt = snapshotAt + storeSkuBindHis.StoreSkuBind.ID = 0 + storeSkuBindHis.SnapshotAt = utils.Time2Date(snapshotAt) dao.CreateEntity(db, storeSkuBindHis) } return retVal, err diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 7830ad3d9..14aa3023b 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -283,17 +283,17 @@ func syncStoreSku() { // _, err = cms.CurVendorSync.FullSyncStoresSkus(jxcontext.AdminCtx, db, partner.GetMultiStoreVendorIDs(), nil, false, []int{27379}, true, true) errList.AddErr(err) case 1: - errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, []int{3})) + // errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, []int{3})) - // errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, partner.GetSingleStoreVendorIDs())) - _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, []int{3}, nil, false, true, cms.AmendPruneAll, false) + errList.AddErr(cms.SetSingleStoreSkuSyncModifyStatus(db, partner.GetSingleStoreVendorIDs())) + // _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, []int{3}, nil, false, true, cms.AmendPruneAll, false) - // _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, partner.GetSingleStoreVendorIDs(), nil, false, true, cms.AmendPruneAll, false) + _, err = cms.CurVendorSync.AmendAndPruneStoreStuff(jxcontext.AdminCtx, partner.GetSingleStoreVendorIDs(), nil, false, true, cms.AmendPruneAll, false) errList.AddErr(err) SaveImportantTaskID(TaskNameSyncStoreSku, SpecialTaskID) - taskID, err2 := cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{3}, nil, false, nil, nil, syncFlag, true, true) - // taskID, err2 := cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, partner.GetSingleStoreVendorIDs(), nil, false, nil, nil, syncFlag, true, true) + // taskID, err2 := cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{3}, nil, false, nil, nil, syncFlag, true, true) + taskID, err2 := cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, partner.GetSingleStoreVendorIDs(), nil, false, nil, nil, syncFlag, true, true) errList.AddErr(err2) SaveImportantTaskID(TaskNameSyncStoreSku, taskID) diff --git a/business/model/store_sku.go b/business/model/store_sku.go index a655a96a2..8911292cd 100644 --- a/business/model/store_sku.go +++ b/business/model/store_sku.go @@ -142,7 +142,7 @@ type StoreSkuBindHistory struct { func (*StoreSkuBindHistory) TableUnique() [][]string { return [][]string{ - []string{"StoreID", "SkuID", "DeletedAt"}, + []string{"StoreID", "SkuID", "DeletedAt", "SnapshotAt"}, } }