1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package mtwmapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"regexp"
|
||||
@@ -471,6 +472,52 @@ type CategoryAttrValueListResult struct {
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// RetailProductRules 根据末级美团分类ID获取图片发布规则
|
||||
func (a *API) RetailProductRules(tagID int64) (*ProductRulesObj, error) {
|
||||
result, err := a.AccessAPI2("retail/product/rules", true, map[string]interface{}{
|
||||
"tag_id": tagID,
|
||||
}, "success_map", "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rules := &ProductRulesObj{}
|
||||
if result != nil {
|
||||
resultByte, _ := json.Marshal(result)
|
||||
err = utils.UnmarshalUseNumber(resultByte, rules)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return rules, err
|
||||
}
|
||||
|
||||
type ProductRulesObj struct {
|
||||
StructRules []struct {
|
||||
RuleId int `json:"rule_id"`
|
||||
RuleName string `json:"rule_name"`
|
||||
ValueList []struct {
|
||||
IsByDefault bool `json:"is_by_default"`
|
||||
ValueId int `json:"value_id"`
|
||||
ValueName string `json:"value_name"`
|
||||
} `json:"value_list"`
|
||||
} `json:"struct_rules"`
|
||||
UnstructRules struct {
|
||||
QualificationPicturesRule struct {
|
||||
IsQualificationPicturesNeed int `json:"is_qualification_pictures_need"`
|
||||
} `json:"qualification_pictures_rule"`
|
||||
SpecialPicturesRules []struct {
|
||||
IsDisplayed int `json:"is_displayed"`
|
||||
IsRequired int `json:"is_required"`
|
||||
NumLimit int `json:"num_limit"`
|
||||
SpecialPictureDescription string `json:"special_picture_description"`
|
||||
SpecialPictureExample string `json:"special_picture_example"`
|
||||
SpecialPictureTitle string `json:"special_picture_title"`
|
||||
SpecialPictureType int `json:"special_picture_type"`
|
||||
} `json:"special_pictures_rules"`
|
||||
} `json:"unstruct_rules"`
|
||||
}
|
||||
|
||||
//category/attr/value/list 查询特殊属性的属性值列表
|
||||
//https://open-shangou.meituan.com/home/docDetail/387
|
||||
func (a *API) CategoryAttrValueList(attr_id int64, keyword string) (categoryAttrValueListResult []*CategoryAttrValueListResult, err error) {
|
||||
|
||||
Reference in New Issue
Block a user