- make params shopCategoryLevel, sor and username optional for jd.AddShopCategory
This commit is contained in:
@@ -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
|
// 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) {
|
func (a *API) AddShopCategory(pid int64, shopCategoryName string, shopCategoryLevel, sort int, userName string) (catId string, err error) {
|
||||||
params := map[string]interface{}{
|
params := map[string]interface{}{
|
||||||
KeyPID: pid,
|
KeyPID: pid,
|
||||||
KeyShopCategoryName: shopCategoryName,
|
KeyShopCategoryName: shopCategoryName,
|
||||||
KeyShopCategoryLevel: shopCategoryLevel,
|
}
|
||||||
KeySort: sort,
|
if shopCategoryLevel > 0 {
|
||||||
"createPin": utils.GetAPIOperator(userName),
|
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)
|
result, err := a.AccessAPINoPage("pms/addShopCategory", params, nil, nil, nil)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user