diff --git a/business/model/dao/thing_map.go b/business/model/dao/thing_map.go index 82fb4959a..b6316054c 100644 --- a/business/model/dao/thing_map.go +++ b/business/model/dao/thing_map.go @@ -42,6 +42,11 @@ func CreateThingMap(thingId int64, vendorThingID, appOrgCode, err string, thingT return CreateEntity(GetDB(), thingMap) } +func UpdateThingMap(thingMap *model.ThingMap) error { + _, err := UpdateEntity(GetDB(), thingMap, "ID") + return err +} + // GetThingToTiktokMapList 抖店获取同步类型 func GetThingToTiktokMapList(db *DaoDB, vendorId int, thingId int64, vendorOrgCode string) (cats []*model.ThingMap, err error) { sql := ` diff --git a/business/partner/purchase/tiktok_store/store_sku2_utils.go b/business/partner/purchase/tiktok_store/store_sku2_utils.go index 0a8d923b5..9c8fec93a 100644 --- a/business/partner/purchase/tiktok_store/store_sku2_utils.go +++ b/business/partner/purchase/tiktok_store/store_sku2_utils.go @@ -28,6 +28,7 @@ import ( "git.rosy.net.cn/jx-callback/globals" "math/rand" "strings" + "time" ) type MainSku struct { @@ -224,7 +225,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType) continue } - if err := dao.CreateThingMap(int64(storeSku.SkuID), utils.Int64ToStr(tiktokResult.ProductId), storeDetail.VendorOrgCode, "本地不存在,线上也不存在", model.ThingTypeSku, model.SyncFlagNewMask); err != nil { + if err := dao.CreateThingMap(int64(storeSku.SkuID), utils.Int64ToStr(tiktokResult.ProductId), storeDetail.VendorOrgCode, "本地不存在,线上也不存在", model.ThingTypeSku, 0); err != nil { failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType) } @@ -307,6 +308,11 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI if err := api.EditStoreCommodity(updateParam); err != nil { failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType) storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID) + } else { + localThing[0].UpdatedAt = time.Now() + localThing[0].SyncStatus = 0 + localThing[0].ThingType = model.ThingTypeSku + dao.UpdateThingMap(localThing[0]) } continue }