This commit is contained in:
邹宗楠
2025-11-26 15:29:09 +08:00
parent dfb4646c16
commit 1b59ab41a0
9 changed files with 61982 additions and 61896 deletions

View File

@@ -550,6 +550,35 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE
if storeSku.SkuSyncStatus&(model.SyncFlagSaleMask|model.SyncFlagNewMask) != 0 {
params["status"] = jxSkuStatus2Ebai(storeSku.MergedStatus)
}
if storeSku.EbaiAttribute != "" && storeSku.EbaiAttribute != "{}" {
attr := map[string]interface{}{}
if storeSku.Upc != "" {
attr["upc"] = storeSku.Upc
} else {
attr["upc"] = "upc-" + utils.Int2Str(storeSku.SkuID)
}
attr["sale_price"] = storeSku.VendorPrice
attr["left_num"] = params["left_num"]
attr["weight"] = storeSku.Weight
attr["status"] = 1 // 正常
sepcProperty := make([]map[string]interface{}, 0, 0)
attributeList := make([]*AttributeListEBai, 0, 0)
err = utils.UnmarshalUseNumber(utils.MustMarshal(storeSku.EbaiAttribute), &attributeList)
for _, al := range attributeList {
for _, pv := range al.PropertyValues {
property := map[string]interface{}{
"prop_id": al.PropertyId,
"prop_text": al.PropertyName,
}
property["value_id"] = pv.ValueId
property["value_text"] = pv.ValueData
sepcProperty = append(sepcProperty)
}
}
attr["spec_property"] = sepcProperty
params["sku_spec"] = []interface{}{attr}
}
// todo 饿百如果给的UPC是空要报错但如果我要删除UPC怎么弄
// if storeSku.Upc != "" {
// params["upc"] = storeSku.Upc
@@ -566,6 +595,16 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE
return params
}
type AttributeListEBai struct {
PropertyId int64 `json:"propertyId"`
PropertyName string `json:"propertyName"`
PropertyValues []struct {
ValueId int64 `json:"ValueId"` // 属性值id
ValueData string `json:"valueData"` // 属性值内容
} `json:"propertyValues"` // 属性值列表
}
func ebaiSkuStatus2Jx(ebaiSkuStatus int) (jxSkuStatus int) {
if ebaiSkuStatus == ebaiapi.SkuStatusOnline {
jxSkuStatus = model.SkuStatusNormal
@@ -776,3 +815,16 @@ func (p *PurchaseHandler) UpdateStoreSkusSpecTag(ctx *jxcontext.Context, vendorO
func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string) (vendorCategoryId string, err error) {
return "", err
}
//GetCategoryAttrValueList 查询特殊属性的属性值列表
func GetCategoryAttrValueList(attrID int64) (categoryAttrValueListResult []*ebaiapi.CategoryAttr, err error) {
switch beego.BConfig.RunMode {
case model.ServerTypeFruits:
categoryAttrValueListResult, err = api.EbaiAPI.CategoryAttrValueList(attrID, "800082")
case model.ServerTypeVegetable:
categoryAttrValueListResult, err = api.EbaiAPI.CategoryAttrValueList(attrID, "666667")
case model.ServerTypePet:
categoryAttrValueListResult, err = api.EbaiAPI.CategoryAttrValueList(attrID, "666667")
}
return categoryAttrValueListResult, err
}