This commit is contained in:
邹宗楠
2022-12-15 18:15:49 +08:00
parent 202e2b7cc8
commit e898e29243
3 changed files with 2 additions and 16 deletions

View File

@@ -456,7 +456,6 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
if err != nil || len(skus) == 0 {
return err
}
globals.SugarLogger.Debugf("=====skus======= %s", utils.Format4Output(skus, false))
if len(excludeSkuIDs) > 0 {
excludeSkuMap := jxutils.IntList2Map(excludeSkuIDs)
var skus2 []*dao.StoreSkuSyncInfo

View File

@@ -585,7 +585,8 @@ func syncStoreSkuTiktok() {
if beego.BConfig.RunMode != "jxgy" {
errList.AddErr(cms.DeleteSkuNameExPrefixOverdue(db))
errList.AddErr(cms.SetMultiStoreSkuSyncModifyStatus(db, partner.GetMultiStoreVendorIDs()))
_, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDDD}, nil, false, nil, nil, syncFlag, true, true)
globals.SugarLogger.Debugf("=======定时任务更新")
_, err = cms.CurVendorSync.SyncStoresSkus2(jxcontext.AdminCtx, nil, 0, db, []int{model.VendorIDDD}, []int{668594}, false, nil, nil, syncFlag, true, true)
errList.AddErr(err)
}
case 1:

View File

@@ -121,7 +121,6 @@ func GetSkuDetailList(api *tiktokShop.API, param *MainSku) (*product_listV2_resp
// 对于多门店平台来说storeSkuList中只有SkuID与VendorSkuID有意义
// 抖店的商品只管创建,创建接口会返回成功,但是审核的时候不一定成功.当前系统无法判定此商品是否已经创建过了!
func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo, isCreate bool) (failedList []*partner.StoreSkuInfoWithErr, err error) {
globals.SugarLogger.Debugf("============%s", utils.Format4Output(storeSkuList, false))
var syncType string
db := dao.GetDB()
storeDetail, _ := dao.GetStoreDetail(db, storeID, model.VendorIDDD, "")
@@ -220,10 +219,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
if len(localThing) == 0 {
mainOrderDetail, err := api.GetSkuDetailLocalID("", utils.Int2Str(storeSku.SkuID))
if err != nil || mainOrderDetail == nil || mainOrderDetail.ProductIdStr == "" {
globals.SugarLogger.Debugf("========result %s", "本地不存在,线上也不存在")
tiktokResult, err := api.CreateStoreCommodity(param) // 创建主商品,同步主商品
globals.SugarLogger.Debugf("========result %s", utils.Format4Output(tiktokResult, false))
globals.SugarLogger.Debugf("========err %s", utils.Format4Output(err, false))
if err != nil {
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
continue
@@ -243,7 +239,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
//storeSku.VendorSonSkuID = utils.Int2Str(storeSku.SkuID) // 还没同步子商品
failedList = putils.GetErrMsg2FailedSingleList(storeSku, errors.New("只创建了主商品,没创建子商品"), storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
} else {
globals.SugarLogger.Debugf("========result %s", "本地不存在,线上存在,创建本地主品,分配子商品")
// 本地不存在,线上存在.直接创建子商品保存本地同步记录
var childrenProductId int64 = 0
if mainOrderDetail.CheckStatus != tiktokShop.SkuCheckStatusPass && mainOrderDetail.CheckStatus != tiktokShop.SkuCheckStatusPassNotPutOn {
@@ -279,12 +274,10 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
}
}
} else {
globals.SugarLogger.Debugf("========result %s", "本地存在,直接创建子商品")
// 主商品存在,直接同步子商品
childrenProductId, err := api.CreateSubProduct(utils.Str2Int64(localThing[0].VendorThingID), utils.Str2Int64(vendorStoreID))
if err != nil || childrenProductId == 0 {
failedList = putils.GetErrMsg2FailedSingleList(storeSku, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
globals.SugarLogger.Debugf("===failedList1=====:%s", utils.Format4Output(failedList, false))
storeSku.SkuSyncStatus = model.SyncFlagStoreSkuModifiedMask
storeSku.VendorSonSkuID = utils.Int64ToStr(childrenProductId) // (属性id skuID方案一)(自商品的商品id方案二)
storeSku.VendorSkuID = utils.Int64ToStr(childrenProductId) // 子商品主id
@@ -297,7 +290,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
storeSku.VendorSonSkuID = utils.Int64ToStr(childrenProductId) // (属性id skuID方案一)(自商品的商品id方案二)
storeSku.VendorSkuID = utils.Int64ToStr(childrenProductId) // 子商品主id
storeSku.VendorMainId = localThing[0].VendorThingID // 商品主id
globals.SugarLogger.Debugf("===failedList2=====:%s", utils.Format4Output(failedList, false))
}
}
} else {
@@ -370,15 +362,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
continue
}
globals.SugarLogger.Debugf("==========更新商品 %s", utils.Format4Output(storeSku, false))
}
return
}
globals.SugarLogger.Debugf("==========failedList %s", utils.Format4Output(failedList, false))
//if len(failedList) > 0 {
// err = nil
//}
return failedList, err
}