- make params shopCategoryLevel, sor and username optional for jd.AddShopCategory

This commit is contained in:
gazebo
2019-03-19 22:52:51 +08:00
parent 9a1e89ab7c
commit 2293cae175

View File

@@ -204,11 +204,17 @@ func (a *API) QueryChildCategoriesForOP(pid int64) (catList []*CategoryInfo, err
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=180&apiid=de26f24a62aa47a49e5ab7579d638cb3
func (a *API) AddShopCategory(pid int64, shopCategoryName string, shopCategoryLevel, sort int, userName string) (catId string, err error) {
params := map[string]interface{}{
KeyPID: pid,
KeyShopCategoryName: shopCategoryName,
KeyShopCategoryLevel: shopCategoryLevel,
KeySort: sort,
"createPin": utils.GetAPIOperator(userName),
KeyPID: pid,
KeyShopCategoryName: shopCategoryName,
}
if shopCategoryLevel > 0 {
params[KeyShopCategoryLevel] = shopCategoryLevel
}
if sort >= 0 {
params[KeySort] = sort
}
if userName != "" {
params["createPin"] = utils.GetAPIOperator(userName)
}
result, err := a.AccessAPINoPage("pms/addShopCategory", params, nil, nil, nil)
if err == nil {