1
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"sort"
|
||||
@@ -392,15 +391,23 @@ func (a *API) AccessAPIHavePage(apiStr string, jdParams map[string]interface{},
|
||||
localJdParams[KeyPageNo] = curPage
|
||||
localJdParams[KeyPageSize] = pageSize
|
||||
jsonResult, err := a.AccessAPI(apiStr, localJdParams)
|
||||
globals.SugarLogger.Debugf("============jsonResult====%s", utils.Format4Output(jsonResult, false))
|
||||
globals.SugarLogger.Debugf("============err====%s", err)
|
||||
if err != nil {
|
||||
return nil, totalCount, err
|
||||
}
|
||||
var data map[string]interface{}
|
||||
encryptData, err := JDDecodeToData(a.appSecret, jsonResult["encryptData"].(string))
|
||||
|
||||
if err := utils.UnmarshalUseNumber(encryptData, &data); err != nil {
|
||||
if jsonResult["encryptData"] != nil {
|
||||
encryptData, err := JDDecodeToData(a.appSecret, jsonResult["encryptData"].(string))
|
||||
if err != nil {
|
||||
return nil, totalCount, platformapi.ErrResponseDataFormatWrong
|
||||
}
|
||||
if err := utils.UnmarshalUseNumber(encryptData, &data); err != nil {
|
||||
return nil, totalCount, platformapi.ErrResponseDataFormatWrong
|
||||
}
|
||||
} else if jsonResult["encryptData"] == nil && jsonResult["data"] != nil {
|
||||
if err := utils.UnmarshalUseNumber([]byte(jsonResult["data"].(string)), &data); err != nil {
|
||||
return nil, totalCount, platformapi.ErrResponseDataFormatWrong
|
||||
}
|
||||
} else {
|
||||
return nil, totalCount, platformapi.ErrResponseDataFormatWrong
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package jdapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@@ -321,7 +320,6 @@ func (a *API) AddShopCategory(pid int64, shopCategoryName string, shopCategoryLe
|
||||
params["createPin"] = utils.GetAPIOperator(userName)
|
||||
}
|
||||
result, err := a.AccessAPINoPage("pms/addShopCategory", params, nil, nil, nil)
|
||||
globals.SugarLogger.Debugf("========result : %s", utils.Format4Output(result, false))
|
||||
if err == nil {
|
||||
return (result.(map[string]interface{}))["id"].(string), nil
|
||||
}
|
||||
@@ -338,8 +336,6 @@ func (a *API) QueryCategoriesByOrgCode() (catList []*CategoryInfo, err error) {
|
||||
"SHOP_CATEGORY_LEVEL",
|
||||
"SORT",
|
||||
}), nil, nil, nil)
|
||||
globals.SugarLogger.Debugf("=========result := %s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("=========result := %s", err)
|
||||
if err == nil {
|
||||
return interface2CatList(result, 1, nil), nil
|
||||
}
|
||||
@@ -454,7 +450,6 @@ func (a *API) BatchUpdateOutSkuId(skuInfoList []*SkuIDPair) (failedList []*Batch
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=180&apiid=e433b95f74524dab91718432c0358977
|
||||
// pageNo 从1开始
|
||||
func (a *API) QuerySkuInfos(queryParam *QuerySkuParam) (skuList []*SkuMain, totalCount int, err error) {
|
||||
globals.SugarLogger.Debugf("============queryParam====%s", utils.Format4Output(queryParam, false))
|
||||
if queryParam.PageNo <= 0 {
|
||||
queryParam.PageNo = 1
|
||||
}
|
||||
@@ -462,11 +457,8 @@ func (a *API) QuerySkuInfos(queryParam *QuerySkuParam) (skuList []*SkuMain, tota
|
||||
queryParam.PageSize = MaxPageSize4QuerySku
|
||||
}
|
||||
result, totalCount, err := a.AccessAPIHavePage("pms/querySkuInfos", utils.Struct2MapByJson(queryParam), nil, nil, nil)
|
||||
globals.SugarLogger.Debugf("============QuerySkuInfos====%s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("============QuerySkuInfos====%s", err)
|
||||
if err == nil {
|
||||
err = JdMap2StructByJson(result, &skuList, false)
|
||||
globals.SugarLogger.Debugf("============JdMap2StructByJson====%s", err)
|
||||
}
|
||||
return skuList, totalCount, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user