1
This commit is contained in:
@@ -691,8 +691,6 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo
|
|||||||
if err = GetRows(db, &skus, sql, sqlParams...); err != nil {
|
if err = GetRows(db, &skus, sql, sqlParams...); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
globals.SugarLogger.Debugf("======GetStoreSkus2 := %s", sql)
|
|
||||||
globals.SugarLogger.Debugf("======GetStoreSkus2 := %s", utils.Format4Output(sqlParams, false))
|
|
||||||
return skus, err
|
return skus, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
|||||||
Weight: utils.Int2Float64(storeSku.Weight),
|
Weight: utils.Int2Float64(storeSku.Weight),
|
||||||
DeliveryDelayDay: tiktokShop.DeliveryDelayDayToDay,
|
DeliveryDelayDay: tiktokShop.DeliveryDelayDayToDay,
|
||||||
PresellType: tiktokShop.SendGoodsTypeNow,
|
PresellType: tiktokShop.SendGoodsTypeNow,
|
||||||
Supply7dayReturn: 2, // 是否支持7天无理由,0不支持,1支持,2支持(拆封后不支持)
|
Supply7dayReturn: 0, // 是否支持7天无理由,0不支持,1支持,2支持(拆封后不支持)
|
||||||
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,
|
||||||
@@ -164,18 +164,18 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
|||||||
} else {
|
} else {
|
||||||
img2, err := GetTiktokImgList(utils.Int2Str(storeSku.StoreID), storeDetail.VendorOrgCode, storeSku.DescImg)
|
img2, err := GetTiktokImgList(utils.Int2Str(storeSku.StoreID), storeDetail.VendorOrgCode, storeSku.DescImg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
param.Description = strings.Split(img, ",")[0]
|
||||||
}
|
}
|
||||||
param.Description = img2
|
param.Description = img2
|
||||||
}
|
}
|
||||||
|
|
||||||
// weight_unit 目前抖音只支持g和kg两种
|
// weight_unit 目前抖音只支持g和kg两种
|
||||||
switch storeSku.Unit {
|
//switch storeSku.Unit {
|
||||||
case "g", "ml", "G", "ML":
|
//case "g", "ml", "G", "ML":
|
||||||
param.WeightUnit = tiktokShop.WeightUint_G
|
param.WeightUnit = tiktokShop.WeightUint_G
|
||||||
case "kg", "l", "L", "KG":
|
//case "kg", "l", "L", "KG":
|
||||||
param.WeightUnit = tiktokShop.WeightUint_G
|
// param.WeightUnit = tiktokShop.WeightUint_G
|
||||||
}
|
//}
|
||||||
|
|
||||||
// spec_prices
|
// spec_prices
|
||||||
param.SpecPrices = GetSpecPrices(param.Specs, vendorStoreID, 0, storeSku)
|
param.SpecPrices = GetSpecPrices(param.Specs, vendorStoreID, 0, storeSku)
|
||||||
@@ -304,7 +304,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
|||||||
Weight: utils.Int2Float64(storeSku.Weight),
|
Weight: utils.Int2Float64(storeSku.Weight),
|
||||||
DeliveryDelayDay: tiktokShop.DeliveryDelayDayToDay,
|
DeliveryDelayDay: tiktokShop.DeliveryDelayDayToDay,
|
||||||
PresellType: tiktokShop.SendGoodsTypeNow,
|
PresellType: tiktokShop.SendGoodsTypeNow,
|
||||||
Supply7dayReturn: 2,
|
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,
|
||||||
@@ -336,12 +336,12 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// weight_unit 目前抖音只支持g和kg两种
|
// weight_unit 目前抖音只支持g和kg两种
|
||||||
switch storeSku.Unit {
|
//switch storeSku.Unit {
|
||||||
case "g", "ml", "G", "ML":
|
//case "g", "ml", "G", "ML":
|
||||||
param.WeightUnit = tiktokShop.WeightUint_G
|
param.WeightUnit = tiktokShop.WeightUint_G
|
||||||
case "kg", "l", "L", "KG":
|
//case "kg", "l", "L", "KG":
|
||||||
param.WeightUnit = tiktokShop.WeightUint_G
|
// param.WeightUnit = tiktokShop.WeightUint_G
|
||||||
}
|
//}
|
||||||
|
|
||||||
//param.SpecPrices = GetSpecPrices(param.Specs, vendorStoreID, 0, storeSku)
|
//param.SpecPrices = GetSpecPrices(param.Specs, vendorStoreID, 0, storeSku)
|
||||||
// 获取商品的属性
|
// 获取商品的属性
|
||||||
@@ -574,14 +574,9 @@ func GetTiktokImgList(storeId, appOrgCode string, img ...string) (string, error)
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range tiktokImgList.SuccessMap {
|
for _, v := range tiktokImgList {
|
||||||
tiktokImg = append(tiktokImg, v.ByteUrl)
|
tiktokImg = append(tiktokImg, v.ByteUrl)
|
||||||
}
|
}
|
||||||
if len(tiktokImg) <= model.NO {
|
|
||||||
for _, v := range tiktokImgList.FailedMap {
|
|
||||||
return "", errors.New(v.ErrMsg)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return strings.Join(tiktokImg, "|"), nil
|
return strings.Join(tiktokImg, "|"), nil
|
||||||
}
|
}
|
||||||
@@ -594,7 +589,8 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
|
|||||||
detail1 = detail1[0:3]
|
detail1 = detail1[0:3]
|
||||||
}
|
}
|
||||||
specsUnit := "g"
|
specsUnit := "g"
|
||||||
var infoValue float64 = 1
|
var infoValue float64 = 1 // 同意计量单位,目前抖店只支持g
|
||||||
|
var specQuality = float64(localSku.SpecQuality) // 可能SpecQuality为0,给默认值
|
||||||
switch localSku.SpecUnit {
|
switch localSku.SpecUnit {
|
||||||
case "g", "G", "ml", "ML":
|
case "g", "G", "ml", "ML":
|
||||||
specsUnit = "g"
|
specsUnit = "g"
|
||||||
@@ -603,6 +599,9 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
|
|||||||
specsUnit = "g"
|
specsUnit = "g"
|
||||||
infoValue = 1000
|
infoValue = 1000
|
||||||
}
|
}
|
||||||
|
if specQuality == 0 {
|
||||||
|
specQuality = 1
|
||||||
|
}
|
||||||
switch len(detail1) {
|
switch len(detail1) {
|
||||||
case 1:
|
case 1:
|
||||||
name1 := strings.Split(strings.Split(detail1[0], "|")[1], ",")
|
name1 := strings.Split(strings.Split(detail1[0], "|")[1], ",")
|
||||||
@@ -617,7 +616,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
|
|||||||
}
|
}
|
||||||
|
|
||||||
sku.DeliveryInfos = []*tiktokShop.DeliveryInfos{
|
sku.DeliveryInfos = []*tiktokShop.DeliveryInfos{
|
||||||
{InfoType: "weight", InfoUnit: specsUnit, InfoValue: utils.Float64ToStr(float64(localSku.SpecQuality) * infoValue)},
|
{InfoType: "weight", InfoUnit: specsUnit, InfoValue: utils.Float64ToStr(specQuality * infoValue)},
|
||||||
}
|
}
|
||||||
stock := localSku.Stock
|
stock := localSku.Stock
|
||||||
if localSku.Stock == 0 {
|
if localSku.Stock == 0 {
|
||||||
@@ -642,7 +641,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
|
|||||||
SupplierID: "",
|
SupplierID: "",
|
||||||
OuterSkuID: utils.Int2Str(localSku.NameID),
|
OuterSkuID: utils.Int2Str(localSku.NameID),
|
||||||
DeliveryInfos: []*tiktokShop.DeliveryInfos{
|
DeliveryInfos: []*tiktokShop.DeliveryInfos{
|
||||||
{InfoType: "weight", InfoUnit: specsUnit, InfoValue: utils.Float64ToStr(float64(localSku.SpecQuality) * infoValue)},
|
{InfoType: "weight", InfoUnit: specsUnit, InfoValue: utils.Float64ToStr(specQuality * infoValue)},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
stock := localSku.Stock
|
stock := localSku.Stock
|
||||||
@@ -672,7 +671,7 @@ func GetSpecPrices(specs, storeId string, mainSkuId int64, localSku *dao.StoreSk
|
|||||||
SupplierID: "",
|
SupplierID: "",
|
||||||
OuterSkuID: utils.Int2Str(localSku.NameID),
|
OuterSkuID: utils.Int2Str(localSku.NameID),
|
||||||
DeliveryInfos: []*tiktokShop.DeliveryInfos{
|
DeliveryInfos: []*tiktokShop.DeliveryInfos{
|
||||||
{InfoType: "weight", InfoUnit: specsUnit, InfoValue: utils.Float64ToStr(float64(localSku.SpecQuality) * infoValue)},
|
{InfoType: "weight", InfoUnit: specsUnit, InfoValue: utils.Float64ToStr(specQuality * infoValue)},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
stock := localSku.Stock
|
stock := localSku.Stock
|
||||||
|
|||||||
Reference in New Issue
Block a user