美团分类操作添加对于code的支持api

This commit is contained in:
gazebo
2019-10-16 10:58:28 +08:00
parent 5f11b3c524
commit 444b0583d0
2 changed files with 68 additions and 11 deletions

View File

@@ -142,6 +142,39 @@ func (a *API) RetailCatUpdate(poiCode, originName, name, secondaryName string, s
return err
}
func (a *API) RetailCatUpdate2(poiCode, originCode, originName, code, name, secondCode, secondaryName string, sequence int) (err error) {
params := map[string]interface{}{
KeyAppPoiCode: poiCode,
"category_name": name,
"sequence": sequence,
}
if code != "" {
params["category_code"] = code
}
if secondCode != "" {
params["secondary_category_code"] = secondCode
}
if secondaryName != "" {
params["secondary_category_name"] = secondaryName
}
if originCode != "" {
params["category_code_origin"] = originCode
} else {
params["category_name_origin"] = originName
}
_, err = a.AccessAPI("retailCat/update", false, params)
if err != nil {
if err2, ok := err.(*utils.ErrorWithCode); ok {
if err2.IntCode() == 833 {
return nil
}
}
}
return err
}
func (a *API) RetailCatDelete(poiCode, name string) (err error) {
_, err = a.AccessAPI("retailCat/delete", false, map[string]interface{}{
KeyAppPoiCode: poiCode,
@@ -150,6 +183,19 @@ func (a *API) RetailCatDelete(poiCode, name string) (err error) {
return err
}
func (a *API) RetailCatDelete2(poiCode, code, name string) (err error) {
params := map[string]interface{}{
KeyAppPoiCode: poiCode,
}
if code != "" {
params["category_code"] = code
} else {
params["category_name"] = name
}
_, err = a.AccessAPI("retailCat/delete", false, params)
return err
}
func (a *API) RetailCatList(poiCode string) (retailCatList []*RetailCategoryInfo, err error) {
result, err := a.AccessAPI("retailCat/list", true, map[string]interface{}{
KeyAppPoiCode: poiCode,