1
This commit is contained in:
@@ -279,6 +279,9 @@ func storeSkuSyncInfo2Bare(inSku *dao.StoreSkuSyncInfo) (outSku *partner.StoreSk
|
|||||||
if inSku.VendorSkuAttrId != "" {
|
if inSku.VendorSkuAttrId != "" {
|
||||||
outSku.VendorSkuAttrId = inSku.VendorSkuAttrId
|
outSku.VendorSkuAttrId = inSku.VendorSkuAttrId
|
||||||
}
|
}
|
||||||
|
if inSku.VendorSonSkuID != "" {
|
||||||
|
outSku.VendorSonSkuID = inSku.VendorSonSkuID
|
||||||
|
}
|
||||||
return outSku
|
return outSku
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,6 +382,9 @@ func sku2Update(vendorID int, sku *dao.StoreSkuSyncInfo, syncStatus int8) (item
|
|||||||
if sku.VendorSkuAttrId != "" {
|
if sku.VendorSkuAttrId != "" {
|
||||||
kvs["VendorSkuAttrId"] = sku.VendorSkuAttrId
|
kvs["VendorSkuAttrId"] = sku.VendorSkuAttrId
|
||||||
}
|
}
|
||||||
|
if sku.VendorSonSkuID != "" {
|
||||||
|
kvs["VendorSonSkuID"] = sku.VendorSonSkuID
|
||||||
|
}
|
||||||
storeSku := &model.StoreSkuBind{}
|
storeSku := &model.StoreSkuBind{}
|
||||||
storeSku.ID = sku.BindID
|
storeSku.ID = sku.BindID
|
||||||
item = &dao.KVUpdateItem{
|
item = &dao.KVUpdateItem{
|
||||||
|
|||||||
@@ -75,9 +75,10 @@ type StoreSkuSyncInfo struct {
|
|||||||
// 平台相关的store sku信息
|
// 平台相关的store sku信息
|
||||||
StoreSkuStatus int // 库存状态
|
StoreSkuStatus int // 库存状态
|
||||||
SkuSyncStatus int8 // 锁定状态
|
SkuSyncStatus int8 // 锁定状态
|
||||||
VendorSkuID string `orm:"column(vendor_sku_id)"`
|
VendorSkuID string `orm:"column(vendor_sku_id)"` // 子商品id
|
||||||
VendorSkuAttrId string `orm:"column(vendor_sku_attr_id)"`
|
VendorSonSkuID string `orm:"column(vendor_son_sku_id)"` // 子商品skuid
|
||||||
VendorMainId string `orm:"column(vendor_main_id)"`
|
VendorSkuAttrId string `orm:"column(vendor_sku_attr_id)"` // 主商品skuid
|
||||||
|
VendorMainId string `orm:"column(vendor_main_id)"` // 主商品id
|
||||||
JdsWareID int64 `orm:"column(jds_ware_id)" json:"jdsWareID"`
|
JdsWareID int64 `orm:"column(jds_ware_id)" json:"jdsWareID"`
|
||||||
BindDeletedAt time.Time `orm:"type(datetime)" json:"bindDeletedAt"`
|
BindDeletedAt time.Time `orm:"type(datetime)" json:"bindDeletedAt"`
|
||||||
|
|
||||||
@@ -566,7 +567,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo
|
|||||||
SELECT
|
SELECT
|
||||||
t14.vendor_id, t14.vendor_org_code,
|
t14.vendor_id, t14.vendor_org_code,
|
||||||
t1.id bind_id, t1.sku_id, t1.price, t1.unit_price, t1.status store_sku_status,
|
t1.id bind_id, t1.sku_id, t1.price, t1.unit_price, t1.status store_sku_status,
|
||||||
%s vendor_sku_id, t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price, t1.%s_lock_time lock_time,t1.vendor_sku_attr_id,t1.vendor_main_id,
|
%s vendor_sku_id, t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price, t1.%s_lock_time lock_time,t1.vendor_son_sku_id,t1.vendor_sku_attr_id,t1.vendor_main_id,
|
||||||
t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id, t1.stock, t1.mt_ladder_box_price,
|
t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id, t1.stock, t1.mt_ladder_box_price,
|
||||||
t2.*,
|
t2.*,
|
||||||
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.category_id name_category_id, t3.yb_name_suffix,t3.tiktok_attribute,
|
t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.category_id name_category_id, t3.yb_name_suffix,t3.tiktok_attribute,
|
||||||
|
|||||||
@@ -115,13 +115,14 @@ type StoreSkuBind struct {
|
|||||||
// ElmID int64 `orm:"column(elm_id);index"`
|
// ElmID int64 `orm:"column(elm_id);index"`
|
||||||
MtwmID int64 `orm:"column(mtwm_id);index"`
|
MtwmID int64 `orm:"column(mtwm_id);index"`
|
||||||
EbaiID int64 `orm:"column(ebai_id);index"`
|
EbaiID int64 `orm:"column(ebai_id);index"`
|
||||||
DdID int64 `orm:"column(dd_id);index"` // 子品主商品id
|
|
||||||
YbID int64 `orm:"column(yb_id);index"`
|
YbID int64 `orm:"column(yb_id);index"`
|
||||||
JdsID int64 `orm:"column(jds_id);index"`
|
JdsID int64 `orm:"column(jds_id);index"`
|
||||||
JdsWareID int64 `orm:"column(jds_ware_id)"`
|
JdsWareID int64 `orm:"column(jds_ware_id)"`
|
||||||
//GmID string `orm:"column(gm_id)"`
|
//GmID string `orm:"column(gm_id)"`
|
||||||
// WscID int64 `orm:"column(wsc_id);index"` // 表示微盟skuId
|
// WscID int64 `orm:"column(wsc_id);index"` // 表示微盟skuId
|
||||||
// WscID2 int64 `orm:"column(wsc_id2);index"` // 表示微盟goodsId
|
// WscID2 int64 `orm:"column(wsc_id2);index"` // 表示微盟goodsId
|
||||||
|
DdID int64 `orm:"column(dd_id);index"` // 子品主商品id
|
||||||
|
VendorSonSkuID string `orm:"column(vendor_son_sku_id)"` // 子商品skuid
|
||||||
VendorSkuAttrId string `orm:"column(vendor_sku_attr_id)"` // 抖音需要,主品skuid
|
VendorSkuAttrId string `orm:"column(vendor_sku_attr_id)"` // 抖音需要,主品skuid
|
||||||
VendorMainId string `orm:"column(vendor_Main_id)"` // 抖音需要,商品主id
|
VendorMainId string `orm:"column(vendor_Main_id)"` // 抖音需要,商品主id
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,9 @@ type StoreSkuInfo struct {
|
|||||||
SpecUnit string `json:"specUnit"`
|
SpecUnit string `json:"specUnit"`
|
||||||
SpecQuality float32 `json:"specQuality"`
|
SpecQuality float32 `json:"specQuality"`
|
||||||
|
|
||||||
VendorMainId string `json:"vendorMainId"`
|
VendorMainId string `json:"vendorMainId"` // 主商品id
|
||||||
VendorSkuAttrId string `json:"vendorSkuAttrId"`
|
VendorSkuAttrId string `json:"vendorSkuAttrId"` //主商品sku_id
|
||||||
|
VendorSonSkuID string `json:"vendorSonSkuID"` // 子商品skuid
|
||||||
}
|
}
|
||||||
|
|
||||||
type StoreSkuInfoWithErr struct {
|
type StoreSkuInfoWithErr struct {
|
||||||
|
|||||||
@@ -281,33 +281,22 @@ 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.ProductId = utils.Str2Int64(v.VendorSkuID)
|
err = api.EditPrice(&sku_editPrice_request.SkuEditPriceParam{
|
||||||
//param.Specs = "净重|" + fmt.Sprintf("%f", v.SpecQuality) + v.SpecUnit
|
|
||||||
//
|
|
||||||
//skuSize := make([]*tiktokShop.SpecDetailList, 0, 0)
|
|
||||||
//detail1 := strings.Split(param.Specs, "^")
|
|
||||||
//name1 := strings.Split(strings.Split(detail1[0], "|")[1], ",")
|
|
||||||
//for i := 0; i < len(name1); i++ {
|
|
||||||
// sku := &tiktokShop.SpecDetailList{
|
|
||||||
// SpecDetailName1: name1[i],
|
|
||||||
// StockNum: v.Stock,
|
|
||||||
// Price: int(v.VendorPrice),
|
|
||||||
// Code: utils.Int2Str(v.SkuID),
|
|
||||||
// StepStockNum: 0,
|
|
||||||
// SupplierID: "",
|
|
||||||
// OuterSkuID: utils.Int2Str(v.NameID),
|
|
||||||
// DeliveryInfos: []*tiktokShop.DeliveryInfos{
|
|
||||||
// {InfoType: "weight", InfoUnit: v.SpecUnit, InfoValue: fmt.Sprintf("%f", v.SpecQuality)},
|
|
||||||
// },
|
|
||||||
// }
|
|
||||||
// skuSize = append(skuSize, sku)
|
|
||||||
//}
|
|
||||||
//data, _ := json.Marshal(skuSize)
|
|
||||||
//param.SpecPrices = string(data)
|
|
||||||
err := api.EditPrice(&sku_editPrice_request.SkuEditPriceParam{
|
|
||||||
Price: v.VendorPrice,
|
Price: v.VendorPrice,
|
||||||
SkuId: utils.Str2Int64(v.VendorSkuAttrId),
|
SkuId: utils.Str2Int64(v.VendorSkuAttrId),
|
||||||
|
ProductId: utils.Str2Int64(v.VendorMainId),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(v, err, storeID, model.VendorChineseNames[model.VendorIDDD], "更新主品价格异常")...)
|
||||||
|
} else {
|
||||||
|
failedList = append(failedList, putils.GetErrMsg2FailedSingleList(v, err, storeID, model.VendorChineseNames[model.VendorIDDD], "更新主品价格正常")...)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新子品
|
||||||
|
err = api.EditPrice(&sku_editPrice_request.SkuEditPriceParam{
|
||||||
|
Price: v.VendorPrice,
|
||||||
|
SkuId: utils.Str2Int64(v.VendorSonSkuID),
|
||||||
ProductId: utils.Str2Int64(v.VendorSkuID),
|
ProductId: utils.Str2Int64(v.VendorSkuID),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -275,6 +275,11 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI
|
|||||||
storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
|
storeSku.VendorSkuID = utils.Int2Str(storeSku.SkuID)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
var attrId2 []string
|
||||||
|
for _, v := range tiktokResultChildren.Sku {
|
||||||
|
attrId2 = append(attrId2, utils.Int64ToStr(v.SkuId))
|
||||||
|
}
|
||||||
|
storeSku.VendorSonSkuID = strings.Join(attrId2, ",") // 属性id skuID
|
||||||
storeSku.VendorSkuID = utils.Int64ToStr(tiktokResultChildren.ProductId) // 子商品主id
|
storeSku.VendorSkuID = utils.Int64ToStr(tiktokResultChildren.ProductId) // 子商品主id
|
||||||
storeSku.VendorMainId = utils.Int64ToStr(tiktokResultProductId) // 商品主id
|
storeSku.VendorMainId = utils.Int64ToStr(tiktokResultProductId) // 商品主id
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user