京东上城商品搜索
This commit is contained in:
@@ -219,7 +219,7 @@ type WaybillReceiveParam struct {
|
|||||||
// ReceiveCompany string `json:"receiveCompany"` //否 北京市大兴区亦庄经济开发区京东大厦 收件人公司,长度:50,说明:不能为生僻字
|
// ReceiveCompany string `json:"receiveCompany"` //否 北京市大兴区亦庄经济开发区京东大厦 收件人公司,长度:50,说明:不能为生僻字
|
||||||
// Goods string `json:"goods"` //否 服装、3C等 托寄物名称,长度:200,说明:为避免托运物品在铁路、航空安检中被扣押,请务必下传商品类目或名称,例如:服装、3C等
|
// Goods string `json:"goods"` //否 服装、3C等 托寄物名称,长度:200,说明:为避免托运物品在铁路、航空安检中被扣押,请务必下传商品类目或名称,例如:服装、3C等
|
||||||
// GoodsCount int `json:"goodsCount"` //否 无 寄托物数量
|
// GoodsCount int `json:"goodsCount"` //否 无 寄托物数量
|
||||||
// PromiseTimeType int `json:"promiseTimeType"` //否 无 产品类型(1:特惠送 2:特快送 4:城际闪送 5:同城当日达 6:次晨达 7:微小件 8: 生鲜专送 16:生鲜特快 17、生鲜特惠 21:特惠小包)
|
PromiseTimeType int `json:"promiseTimeType"` //否 无 产品类型(1:特惠送 2:特快送 4:城际闪送 5:同城当日达 6:次晨达 7:微小件 8: 生鲜专送 16:生鲜特快 17、生鲜特惠 21:特惠小包)
|
||||||
// Freight int `json:"freight"` //否 无 运费
|
// Freight int `json:"freight"` //否 无 运费
|
||||||
// PickUpStartTime time.Time `json:"pickUpStartTime"` //否 1 预约取件开始时间
|
// PickUpStartTime time.Time `json:"pickUpStartTime"` //否 1 预约取件开始时间
|
||||||
// PickUpEndTime time.Time `json:"pickUpEndTime"` //否 1 预约取件结束时间
|
// PickUpEndTime time.Time `json:"pickUpEndTime"` //否 1 预约取件结束时间
|
||||||
|
|||||||
@@ -599,21 +599,31 @@ func (a *API) UpdateWareSaleAttrvalueAlias(param *UpdateWareSaleAttrvalueAliasPa
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SearchSkuListResult struct {
|
type SearchSkuListResult struct {
|
||||||
Status int `json:"status"`
|
Status int `json:"status"`
|
||||||
JdPrice float64 `json:"jdPrice"`
|
JdPrice float64 `json:"jdPrice"`
|
||||||
SkuID int64 `json:"skuId"`
|
SkuID int64 `json:"skuId"`
|
||||||
WareID int64 `json:"wareId"`
|
WareID int64 `json:"wareId"`
|
||||||
OuterID string `json:"outerId"`
|
OuterID string `json:"outerId"`
|
||||||
|
SaleAttrs []struct {
|
||||||
|
AttrID string `json:"attrId"`
|
||||||
|
Index int `json:"index"`
|
||||||
|
AttrValueAlias []string `json:"attrValueAlias"`
|
||||||
|
AttrValues []string `json:"attrValues"`
|
||||||
|
} `json:"saleAttrs"`
|
||||||
|
StockNum int `json:"stockNum"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//搜索sku
|
//搜索sku
|
||||||
//https://open.jd.com/home/home#/doc/api?apiCateId=48&apiId=1227&apiName=jingdong.sku.read.searchSkuList
|
//https://open.jd.com/home/home#/doc/api?apiCateId=48&apiId=1227&apiName=jingdong.sku.read.searchSkuList
|
||||||
func (a *API) SearchSkuList(wareId int64) (list []*SearchSkuListResult, err error) {
|
func (a *API) SearchSkuList(pageNo, pageSize int) (list []*SearchSkuListResult, totalCount int, err error) {
|
||||||
result, err := a.AccessAPI2("jingdong.sku.read.searchSkuList", prodURL, map[string]interface{}{
|
result, err := a.AccessAPI2("jingdong.sku.read.searchSkuList", prodURL, map[string]interface{}{
|
||||||
"wareId": wareId,
|
"pageNo": pageNo,
|
||||||
|
"pageSize": pageSize,
|
||||||
|
"field": "jdPrice,saleAttrs,stockNum",
|
||||||
})
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
utils.Map2StructByJson(result["jingdong_sku_read_searchSkuList_responce"].(map[string]interface{})["page"].(map[string]interface{})["data"], &list, false)
|
utils.Map2StructByJson(result["jingdong_sku_read_searchSkuList_responce"].(map[string]interface{})["page"].(map[string]interface{})["data"], &list, false)
|
||||||
|
totalCount = int(utils.Interface2Int64WithDefault(result["jingdong_sku_read_searchSkuList_responce"].(map[string]interface{})["page"].(map[string]interface{})["totalItem"], 0))
|
||||||
}
|
}
|
||||||
return list, err
|
return list, totalCount, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ func TestImageUpdate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSearchWare4Valid(t *testing.T) {
|
func TestSearchWare4Valid(t *testing.T) {
|
||||||
result, err := api.SearchWare4Valid("猕猴桃 奇异果", 0, 0)
|
result, err := api.SearchWare4Valid("", 0, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -454,7 +454,7 @@ func TestSearchSkuList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAAAAAA(t *testing.T) {
|
func TestAAAAAA(t *testing.T) {
|
||||||
result, err := api.SearchSkuList(14518860227)
|
result, _, err := api.SearchSkuList(2, 20)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user