1
This commit is contained in:
@@ -215,13 +215,18 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
|||||||
// 获取本地存储映射关系,获取本地主商品id是否存在
|
// 获取本地存储映射关系,获取本地主商品id是否存在
|
||||||
var mainProductId int64 = 0
|
var mainProductId int64 = 0
|
||||||
var mainOrderDetail *product_detail_response.ProductDetailData
|
var mainOrderDetail *product_detail_response.ProductDetailData
|
||||||
|
globals.SugarLogger.Debugf("=======storesku %s", utils.Format4Output(storeSku, false))
|
||||||
localThing, _ := dao.GetThingToTiktokMapList(db, model.VendorIDDD, int64(storeSku.SkuID), storeDetail.VendorOrgCode)
|
localThing, _ := dao.GetThingToTiktokMapList(db, model.VendorIDDD, int64(storeSku.SkuID), storeDetail.VendorOrgCode)
|
||||||
|
globals.SugarLogger.Debugf("============1")
|
||||||
|
globals.SugarLogger.Debugf("=======localThing %s", utils.Format4Output(localThing, false))
|
||||||
if len(localThing) != 0 {
|
if len(localThing) != 0 {
|
||||||
mainProductId = utils.Str2Int64(localThing[0].VendorThingID)
|
mainProductId = utils.Str2Int64(localThing[0].VendorThingID)
|
||||||
} else {
|
} else {
|
||||||
mainOrderDetail = loadMainProductId(api, storeSku)
|
mainOrderDetail = loadMainProductId(api, storeSku)
|
||||||
|
globals.SugarLogger.Debugf("=======mainOrderDetail loadMainProductId %s", utils.Format4Output(mainOrderDetail, false))
|
||||||
mainProductId = mainOrderDetail.MainProductId
|
mainProductId = mainOrderDetail.MainProductId
|
||||||
}
|
}
|
||||||
|
globals.SugarLogger.Debugf("============2")
|
||||||
|
|
||||||
if len(localThing) == 0 {
|
if len(localThing) == 0 {
|
||||||
if mainProductId == 0 {
|
if mainProductId == 0 {
|
||||||
@@ -437,12 +442,14 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
|||||||
func loadMainProductId(api *tiktokShop.API, storeSku *dao.StoreSkuSyncInfo) (mainOrderDetail *product_detail_response.ProductDetailData) {
|
func loadMainProductId(api *tiktokShop.API, storeSku *dao.StoreSkuSyncInfo) (mainOrderDetail *product_detail_response.ProductDetailData) {
|
||||||
// 这有可能获取的值主商品也有可能是子商品,我们需要的是主商品id和状态
|
// 这有可能获取的值主商品也有可能是子商品,我们需要的是主商品id和状态
|
||||||
mainOrderDetail, err := api.GetSkuDetailLocalID("", utils.Int2Str(storeSku.SkuID))
|
mainOrderDetail, err := api.GetSkuDetailLocalID("", utils.Int2Str(storeSku.SkuID))
|
||||||
|
globals.SugarLogger.Debugf("===GetSkuDetailLocalID %s", utils.Format4Output(mainOrderDetail, false))
|
||||||
if err != nil || mainOrderDetail == nil {
|
if err != nil || mainOrderDetail == nil {
|
||||||
mainOrderDetail.MainProductId = 0
|
mainOrderDetail.MainProductId = 0
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if mainOrderDetail.MainProductId != 0 { // 子商品时,获取主商品id和状态
|
if mainOrderDetail.MainProductId != 0 { // 子商品时,获取主商品id和状态
|
||||||
mainOrderDetail, err = api.GetSkuDetail(utils.Int64ToStr(mainOrderDetail.MainProductId), "")
|
mainOrderDetail, err = api.GetSkuDetail(utils.Int64ToStr(mainOrderDetail.MainProductId), "")
|
||||||
|
globals.SugarLogger.Debugf("===GetSkuDetail %s", utils.Format4Output(mainOrderDetail, false))
|
||||||
if err != nil || mainOrderDetail == nil {
|
if err != nil || mainOrderDetail == nil {
|
||||||
mainOrderDetail.MainProductId = 0
|
mainOrderDetail.MainProductId = 0
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user