美团新apisku销售属性
This commit is contained in:
@@ -182,7 +182,7 @@ type UpdateSkusParamSkus struct {
|
|||||||
Capacity string `json:"capacity,omitempty"` //否 20L 容量,在有特殊要求的类目下必填!最多支持6位小数。
|
Capacity string `json:"capacity,omitempty"` //否 20L 容量,在有特殊要求的类目下必填!最多支持6位小数。
|
||||||
Type string `json:"type"` //"com.jd.pop.ware.ic.api.domain.sku"
|
Type string `json:"type"` //"com.jd.pop.ware.ic.api.domain.sku"
|
||||||
Type2 string `json:"@type"`
|
Type2 string `json:"@type"`
|
||||||
MultiCateProps []*CreateSkuParamAttrs `json:"multiCateProps"` // 否 无 类目属性列表,类目属性中有必填项时,此字段必填;若未设置或设置错误,会有“通用属性必填”等错误提示!
|
MultiCateProps []*CreateSkuParamAttrs `json:"multiCateProps,omitempty"` // 否 无 类目属性列表,类目属性中有必填项时,此字段必填;若未设置或设置错误,会有“通用属性必填”等错误提示!
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询商家所有的店内分类
|
//查询商家所有的店内分类
|
||||||
|
|||||||
@@ -328,31 +328,17 @@ func TestSearchWare4Valid(t *testing.T) {
|
|||||||
|
|
||||||
func TestUpdateSkus(t *testing.T) {
|
func TestUpdateSkus(t *testing.T) {
|
||||||
_, err := api.UpdateSkus(&UpdateSkusParam{
|
_, err := api.UpdateSkus(&UpdateSkusParam{
|
||||||
WareID: 14537944716,
|
WareID: 14600091031,
|
||||||
Skus: []*UpdateSkusParamSkus{
|
Skus: []*UpdateSkusParamSkus{
|
||||||
&UpdateSkusParamSkus{
|
&UpdateSkusParamSkus{
|
||||||
WareID: 14537944716,
|
WareID: 14600091031,
|
||||||
JdPrice: 1.5,
|
SkuID: 70357447332,
|
||||||
StockNum: "99",
|
JdPrice: 7.5,
|
||||||
OuterID: "11",
|
StockNum: "9999",
|
||||||
SaleAttrs: []*CreateSkuParamAttrs{
|
SaleAttrs: []*CreateSkuParamAttrs{
|
||||||
&CreateSkuParamAttrs{
|
&CreateSkuParamAttrs{
|
||||||
AttrID: "1001027602",
|
AttrID: "1001027602",
|
||||||
AttrValues: []string{"2440977935"},
|
AttrValues: []string{"2441658643"},
|
||||||
},
|
|
||||||
},
|
|
||||||
Type: "com.jd.pop.ware.ic.api.domain.sku",
|
|
||||||
Type2: "com.jd.pop.ware.ic.api.domain.Sku",
|
|
||||||
},
|
|
||||||
&UpdateSkusParamSkus{
|
|
||||||
WareID: 14537944716,
|
|
||||||
JdPrice: 1.8,
|
|
||||||
StockNum: "99",
|
|
||||||
OuterID: "123",
|
|
||||||
SaleAttrs: []*CreateSkuParamAttrs{
|
|
||||||
&CreateSkuParamAttrs{
|
|
||||||
AttrID: "1001027602",
|
|
||||||
AttrValues: []string{"2441761921"},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Type: "com.jd.pop.ware.ic.api.domain.sku",
|
Type: "com.jd.pop.ware.ic.api.domain.sku",
|
||||||
@@ -436,10 +422,10 @@ func TestTransparentImageAdd(t *testing.T) {
|
|||||||
|
|
||||||
func TestUpdateWareSaleAttrvalueAlias(t *testing.T) {
|
func TestUpdateWareSaleAttrvalueAlias(t *testing.T) {
|
||||||
err := api.UpdateWareSaleAttrvalueAlias(&UpdateWareSaleAttrvalueAliasParam{
|
err := api.UpdateWareSaleAttrvalueAlias(&UpdateWareSaleAttrvalueAliasParam{
|
||||||
WareID: 14566414324,
|
WareID: 14565234929,
|
||||||
Props: []*CreateSkuParamAttrs2{
|
Props: []*CreateSkuParamAttrs2{
|
||||||
&CreateSkuParamAttrs2{
|
&CreateSkuParamAttrs2{
|
||||||
AttrID: "1001038262",
|
AttrID: "1000021981",
|
||||||
AttrValues: []string{"2453826609"},
|
AttrValues: []string{"2453826609"},
|
||||||
AttrValueAlias: []string{"500g 下午易缺货"},
|
AttrValueAlias: []string{"500g 下午易缺货"},
|
||||||
Type: "com.jd.pop.ware.ic.api.domain.prop",
|
Type: "com.jd.pop.ware.ic.api.domain.prop",
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ const (
|
|||||||
SellStatusOffline = 1 // 下架
|
SellStatusOffline = 1 // 下架
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
MtwmSkuAttr = `[{"attrId":1200000094,"attrName":"产地","valueList":[{"valueId":100000050,"value":"中国"}]},{"attrId":1200000132,"attrName":"国产/进口","valueList":[{"valueId":1300000003,"value":"国产"}]},{"attrId":1200000210,"attrName":"商品类别","valueList":[{"valueId":1300002991,"value":"水果混合切片"}]},{"attrId":1200000275,"attrName":"是否有机","valueList":[{"valueId":1300003874,"value":"无机"}]},{"attrId":1200000286,"attrName":"果品品牌","valueList":[{"valueId":1300003944,"value":"其他品牌"}]}]`
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
retailBatchFailedSkuReg = regexp.MustCompile(`((?:\d+;)+)`)
|
retailBatchFailedSkuReg = regexp.MustCompile(`((?:\d+;)+)`)
|
||||||
)
|
)
|
||||||
@@ -127,6 +131,21 @@ type Param4UpdateCat struct {
|
|||||||
Period string `json:"period,omitempty"`
|
Period string `json:"period,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CategoryAttrListResult struct {
|
||||||
|
AttrID string `json:"attr_id"`
|
||||||
|
AttrName string `json:"attr_name"`
|
||||||
|
AttrValueType string `json:"attr_value_type"`
|
||||||
|
Need string `json:"need"`
|
||||||
|
CharacterType string `json:"character_type"`
|
||||||
|
TextMaxLength string `json:"text_max_length"`
|
||||||
|
Sequence int `json:"sequence"`
|
||||||
|
SupportExtend string `json:"support_extend"`
|
||||||
|
ValueList []struct {
|
||||||
|
ValueID string `json:"value_id"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
} `json:"value_list"`
|
||||||
|
}
|
||||||
|
|
||||||
// 美团分类没有ID,就以名字为唯一标识,不论级别都必须不能重名
|
// 美团分类没有ID,就以名字为唯一标识,不论级别都必须不能重名
|
||||||
// name(和originName)的长度不能超过10个字符(字符,不是字节)
|
// name(和originName)的长度不能超过10个字符(字符,不是字节)
|
||||||
// 创建一级分类,originName为空,name为新分类名,secondaryName为空
|
// 创建一级分类,originName为空,name为新分类名,secondaryName为空
|
||||||
@@ -363,6 +382,38 @@ func (a *API) RetailSkuDelete(trackInfo, poiCode, foodCode, skuID string) (err e
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//category/attr/list 根据末级类目id获取类目属性列表
|
||||||
|
//https://open-shangou.meituan.com/home/docDetail/386
|
||||||
|
func (a *API) CategoryAttrList(tag_id int64) (categoryAttrListResult []*CategoryAttrListResult, err error) {
|
||||||
|
result, err := a.AccessAPI("gw/category/attr/list", true, map[string]interface{}{
|
||||||
|
"tag_id": tag_id,
|
||||||
|
})
|
||||||
|
if err == nil {
|
||||||
|
utils.Map2StructByJson(result.(map[string]interface{})["general_attrs"], &categoryAttrListResult, false)
|
||||||
|
}
|
||||||
|
return categoryAttrListResult, err
|
||||||
|
}
|
||||||
|
|
||||||
|
type CategoryAttrValueListResult struct {
|
||||||
|
ValueID string `json:"value_id"`
|
||||||
|
Value string `json:"value"`
|
||||||
|
}
|
||||||
|
|
||||||
|
//category/attr/value/list 查询特殊属性的属性值列表
|
||||||
|
//https://open-shangou.meituan.com/home/docDetail/387
|
||||||
|
func (a *API) CategoryAttrValueList(attr_id int64, keyword string, page_num, page_size int) (categoryAttrValueListResult []*CategoryAttrValueListResult, err error) {
|
||||||
|
result, err := a.AccessAPI("gw/category/attr/value/list", true, map[string]interface{}{
|
||||||
|
"attr_id": attr_id,
|
||||||
|
"keyword": keyword,
|
||||||
|
"page_num": page_num,
|
||||||
|
"page_size": page_size,
|
||||||
|
})
|
||||||
|
if err == nil {
|
||||||
|
utils.Map2StructByJson(result, &categoryAttrValueListResult, false)
|
||||||
|
}
|
||||||
|
return categoryAttrValueListResult, err
|
||||||
|
}
|
||||||
|
|
||||||
// 就是厂商商品类别
|
// 就是厂商商品类别
|
||||||
func (a *API) RetailGetSpTagIds() (tagIds []*RetailTag, err error) {
|
func (a *API) RetailGetSpTagIds() (tagIds []*RetailTag, err error) {
|
||||||
result, err := a.AccessAPI("retail/getSpTagIds", true, nil)
|
result, err := a.AccessAPI("retail/getSpTagIds", true, nil)
|
||||||
|
|||||||
@@ -284,3 +284,19 @@ func TestRetailSellStatus(t *testing.T) {
|
|||||||
}
|
}
|
||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestCategoryAttrList(t *testing.T) {
|
||||||
|
result, err := api.CategoryAttrList(200002727)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestCategoryAttrValueList(t *testing.T) {
|
||||||
|
result, err := api.CategoryAttrValueList(1200000094, "中国", 1, 5)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user