This commit is contained in:
邹宗楠
2023-01-04 21:53:39 +08:00
parent e3da652deb
commit 910cf57b64

View File

@@ -28,6 +28,7 @@ import (
"git.rosy.net.cn/jx-callback/globals" "git.rosy.net.cn/jx-callback/globals"
"math/rand" "math/rand"
"strings" "strings"
"time"
"unicode" "unicode"
) )
@@ -165,8 +166,8 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
param.Description = detailImg param.Description = detailImg
// 部分商品没有所属的分类,直接跳过! // 部分商品没有所属的分类,直接跳过!
if storeSku.SkuVendorMapCatID != "" { if storeSku.VendorVendorCatID != 0 {
param.CategoryLeafId = utils.Str2Int64(storeSku.SkuVendorMapCatID) param.CategoryLeafId = storeSku.VendorVendorCatID
} else if len(param.Pic) != 0 { // 自动推导分类id } else if len(param.Pic) != 0 { // 自动推导分类id
param.CategoryLeafId, err = api.GetRecommendCategory(strings.Split(img, "|")) param.CategoryLeafId, err = api.GetRecommendCategory(strings.Split(img, "|"))
if param.CategoryLeafId == 0 || err != nil { if param.CategoryLeafId == 0 || err != nil {
@@ -274,45 +275,45 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
} }
} else { } else {
// 线上本地都存在,但是线上审核不成功,就去更新主商品 // 线上本地都存在,但是线上审核不成功,就去更新主商品
//if mainOrderDetail.CheckStatus == tiktokShop.SkuCheckStatusProhibit || mainOrderDetail.CheckStatus == tiktokShop.SkuCheckStatusNotPass { if mainOrderDetail.CheckStatus == tiktokShop.SkuCheckStatusProhibit || mainOrderDetail.CheckStatus == tiktokShop.SkuCheckStatusNotPass {
// // 更新主商品,在同步到子门店,考虑审核时间 // 更新主商品,在同步到子门店,考虑审核时间
// updateParam := &product_editV2_request.ProductEditV2Param{ updateParam := &product_editV2_request.ProductEditV2Param{
// PayType: tiktokShop.TiktokPayType1, PayType: tiktokShop.TiktokPayType1,
// ReduceType: tiktokShop.SkuReduceTypePayMakeOrder, ReduceType: tiktokShop.SkuReduceTypePayMakeOrder,
// Weight: utils.Int2Float64(storeSku.Weight), Weight: utils.Int2Float64(storeSku.Weight),
// DeliveryDelayDay: tiktokShop.DeliveryDelayDayToDay, DeliveryDelayDay: tiktokShop.DeliveryDelayDayToDay,
// PresellType: tiktokShop.SendGoodsTypeNow, PresellType: tiktokShop.SendGoodsTypeNow,
// Supply7dayReturn: 0, Supply7dayReturn: 0,
// Mobile: storeDetail.Tel1, Mobile: storeDetail.Tel1,
// Commit: true, Commit: true,
// Specs: "重量|" + utils.Float64ToStr(float64(storeSku.SpecQuality)) + storeSku.SpecUnit, Specs: "重量|" + utils.Float64ToStr(float64(storeSku.SpecQuality)) + storeSku.SpecUnit,
// NeedRechargeMode: false, NeedRechargeMode: false,
// SellChannel: []int64{0}, SellChannel: []int64{0},
// StartSaleType: 0, StartSaleType: 0,
// PickupMethod: "0", PickupMethod: "0",
// CategoryLeafId: param.CategoryLeafId, CategoryLeafId: param.CategoryLeafId,
// Name: param.Name, Name: param.Name,
// ProductFormatNew: param.ProductFormatNew, ProductFormatNew: param.ProductFormatNew,
// } }
// updateParam.Pic = img updateParam.Pic = img
// updateParam.Description = detailImg updateParam.Description = detailImg
// updateParam.WeightUnit = tiktokShop.WeightUint_G updateParam.WeightUnit = tiktokShop.WeightUint_G
// updateParam.StandardBrandId = param.StandardBrandId // 默认品牌京西菜市 updateParam.StandardBrandId = param.StandardBrandId // 默认品牌京西菜市
// updateParam.ProductId = mainOrderDetail.ProductId updateParam.ProductId = mainOrderDetail.ProductId
// updateParam.MainProductId = mainProductId updateParam.MainProductId = mainProductId
// updateParam.SpecPrices = param.SpecPrices updateParam.SpecPrices = param.SpecPrices
// //updateParam.StoreId = utils.Str2Int64(vendorStoreID) //updateParam.StoreId = utils.Str2Int64(vendorStoreID)
// if err := api.EditStoreCommodity(updateParam); err != nil { if err := api.EditStoreCommodity(updateParam); err != nil {
// failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType) failedList = putils.GetErrMsg2FailedSingleList(storeSkuList, err, storeID, model.VendorChineseNames[model.VendorIDDD], syncType)
// storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID) storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
// } else { } else {
// localThing[0].UpdatedAt = time.Now() localThing[0].UpdatedAt = time.Now()
// localThing[0].SyncStatus = 0 localThing[0].SyncStatus = 0
// localThing[0].ThingType = model.ThingTypeSku localThing[0].ThingType = model.ThingTypeSku
// dao.UpdateThingMap(localThing[0]) dao.UpdateThingMap(localThing[0])
// } }
// continue continue
//} }
// 主商品存在,直接同步子商品 // 主商品存在,直接同步子商品
childrenProductId, err := api.CreateSubProduct(utils.Str2Int64(localThing[0].VendorThingID), utils.Str2Int64(vendorStoreID)) childrenProductId, err := api.CreateSubProduct(utils.Str2Int64(localThing[0].VendorThingID), utils.Str2Int64(vendorStoreID))