京东活动即使创建失败,也记录平台活动ID

删除活动商品时,如果之前是同步失败状态,不调用SyncAct
This commit is contained in:
gazebo
2019-11-21 11:40:35 +08:00
parent 603c6bffa2
commit 81249ae3b7
4 changed files with 25 additions and 15 deletions

View File

@@ -242,6 +242,7 @@ func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITa
}
}
}
db := dao.GetDB()
err = func() (err error) {
if model.IsSyncStatusDelete(act.SyncStatus) {
for vendorActID := range vendorActInfoMap {
@@ -257,6 +258,10 @@ func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITa
updateItems = append(updateItems, partner.Act2Update(act, model.SyncFlagModifiedMask))
} else if model.IsSyncStatusNew(act.SyncStatus) {
if act.VendorActID, err = createSkuAct(ctx, act, actStoreSkuList4Create); err != nil {
if act.VendorActID != "" {
actMap := partner.Act2ActMap(act)
dao.UpdateEntity(db, actMap, "VendorActID")
}
return err
}
updateItems = append(updateItems, partner.ActStoreSku2Update(actStoreSkuList4Create, model.SyncFlagNewMask)...)
@@ -289,7 +294,6 @@ func (c *PurchaseHandler) SyncAct(ctx *jxcontext.Context, parentTask tasksch.ITa
}
return err
}()
db := dao.GetDB()
// globals.SugarLogger.Debug(utils.Format4Output(updateItems, false))
_, err2 := dao.BatchUpdateEntityByKV(db, updateItems)
if err == nil {