1
This commit is contained in:
@@ -1,19 +1,15 @@
|
|||||||
package tiktok_store
|
package tiktok_store
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||||
freightTemplate_create_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/freightTemplate_create/request"
|
freightTemplate_create_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/freightTemplate_create/request"
|
||||||
product_addV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/request"
|
product_addV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_addV2/request"
|
||||||
product_detail_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_detail/response"
|
product_detail_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_detail/response"
|
||||||
product_editV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_editV2/request"
|
product_editV2_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/product_editV2/request"
|
||||||
shop_bindStoreFreight_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_bindStoreFreight/request"
|
shop_bindStoreFreight_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_bindStoreFreight/request"
|
||||||
|
sku_editPrice_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/sku_editPrice/request"
|
||||||
tiktokShop "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
tiktokShop "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||||
"math/rand"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||||
@@ -23,6 +19,8 @@ import (
|
|||||||
"git.rosy.net.cn/jx-callback/business/partner"
|
"git.rosy.net.cn/jx-callback/business/partner"
|
||||||
"git.rosy.net.cn/jx-callback/business/partner/putils"
|
"git.rosy.net.cn/jx-callback/business/partner/putils"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
|
"math/rand"
|
||||||
|
"regexp"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -500,32 +498,40 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr
|
|||||||
func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||||
api := getAPI(vendorOrgCode, storeID, vendorStoreID)
|
api := getAPI(vendorOrgCode, storeID, vendorStoreID)
|
||||||
for _, v := range storeSkuList {
|
for _, v := range storeSkuList {
|
||||||
param := &product_editV2_request.ProductEditV2Param{}
|
//param := &product_editV2_request.ProductEditV2Param{}
|
||||||
param.ProductId = utils.Str2Int64(v.VendorSkuID)
|
//param.ProductId = utils.Str2Int64(v.VendorSkuID)
|
||||||
param.Specs = "净重|" + fmt.Sprintf("%f", v.SpecQuality) + v.SpecUnit
|
//param.Specs = "净重|" + fmt.Sprintf("%f", v.SpecQuality) + v.SpecUnit
|
||||||
|
//
|
||||||
skuSize := make([]*tiktokShop.SpecDetailList, 0, 0)
|
//skuSize := make([]*tiktokShop.SpecDetailList, 0, 0)
|
||||||
detail1 := strings.Split(param.Specs, "^")
|
//detail1 := strings.Split(param.Specs, "^")
|
||||||
name1 := strings.Split(strings.Split(detail1[0], "|")[1], ",")
|
//name1 := strings.Split(strings.Split(detail1[0], "|")[1], ",")
|
||||||
for i := 0; i < len(name1); i++ {
|
//for i := 0; i < len(name1); i++ {
|
||||||
sku := &tiktokShop.SpecDetailList{
|
// sku := &tiktokShop.SpecDetailList{
|
||||||
SpecDetailName1: name1[i],
|
// SpecDetailName1: name1[i],
|
||||||
StockNum: v.Stock,
|
// StockNum: v.Stock,
|
||||||
Price: int(v.VendorPrice),
|
// Price: int(v.VendorPrice),
|
||||||
Code: utils.Int2Str(v.SkuID),
|
// Code: utils.Int2Str(v.SkuID),
|
||||||
StepStockNum: 0,
|
// StepStockNum: 0,
|
||||||
SupplierID: "",
|
// SupplierID: "",
|
||||||
OuterSkuID: utils.Int2Str(v.NameID),
|
// OuterSkuID: utils.Int2Str(v.NameID),
|
||||||
DeliveryInfos: []*tiktokShop.DeliveryInfos{
|
// DeliveryInfos: []*tiktokShop.DeliveryInfos{
|
||||||
{InfoType: "weight", InfoUnit: v.SpecUnit, InfoValue: fmt.Sprintf("%f", v.SpecQuality)},
|
// {InfoType: "weight", InfoUnit: v.SpecUnit, InfoValue: fmt.Sprintf("%f", v.SpecQuality)},
|
||||||
},
|
// },
|
||||||
}
|
// }
|
||||||
skuSize = append(skuSize, sku)
|
// skuSize = append(skuSize, sku)
|
||||||
|
//}
|
||||||
|
//data, _ := json.Marshal(skuSize)
|
||||||
|
//param.SpecPrices = string(data)
|
||||||
|
param := &sku_editPrice_request.SkuEditPriceParam{
|
||||||
|
Price: v.VendorPrice,
|
||||||
|
Code: "",
|
||||||
|
SkuId: 0,
|
||||||
|
OutSkuId: int64(v.SkuID),
|
||||||
|
ProductId: utils.Str2Int64(v.VendorSkuID),
|
||||||
|
OutProductId: int64(v.SkuID),
|
||||||
}
|
}
|
||||||
data, _ := json.Marshal(skuSize)
|
|
||||||
param.SpecPrices = string(data)
|
|
||||||
|
|
||||||
err := api.EditStoreCommodity(param)
|
err := api.EditPrice(param)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(v, err, storeID, model.VendorChineseNames[model.VendorIDDD], "上架商品异常")...)
|
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(v, err, storeID, model.VendorChineseNames[model.VendorIDDD], "上架商品异常")...)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -260,6 +260,16 @@ func GetErrMsg2FailedSingleList(storeSkuList interface{}, err error, storeID int
|
|||||||
SyncType: syncType,
|
SyncType: syncType,
|
||||||
}
|
}
|
||||||
failedList = append(failedList, storeSkuInfoWithErr)
|
failedList = append(failedList, storeSkuInfoWithErr)
|
||||||
|
} else if storeSku, ok := storeSkuList.(*partner.StoreSkuInfo); ok {
|
||||||
|
globals.SugarLogger.Debugf("=======storeSku== %s", utils.Format4Output(storeSkuLists, false))
|
||||||
|
storeSkuInfoWithErr := &partner.StoreSkuInfoWithErr{
|
||||||
|
StoreSkuInfo: storeSku,
|
||||||
|
ErrMsg: errMsg,
|
||||||
|
StoreID: storeID,
|
||||||
|
VendoreName: vendorName,
|
||||||
|
SyncType: syncType,
|
||||||
|
}
|
||||||
|
failedList = append(failedList, storeSkuInfoWithErr)
|
||||||
} else if storeSkuLists, ok := storeSkuList.([]*dao.StoreSkuSyncInfo); ok {
|
} else if storeSkuLists, ok := storeSkuList.([]*dao.StoreSkuSyncInfo); ok {
|
||||||
globals.SugarLogger.Debugf("=======storeSkuLists StoreSkuSyncInfo== %s", utils.Format4Output(storeSkuLists, false))
|
globals.SugarLogger.Debugf("=======storeSkuLists StoreSkuSyncInfo== %s", utils.Format4Output(storeSkuLists, false))
|
||||||
storeSkuInfo := &partner.StoreSkuInfo{
|
storeSkuInfo := &partner.StoreSkuInfo{
|
||||||
|
|||||||
Reference in New Issue
Block a user