diff --git a/platformapi/jdshopapi/order.go b/platformapi/jdshopapi/order.go new file mode 100644 index 00000000..939199f1 --- /dev/null +++ b/platformapi/jdshopapi/order.go @@ -0,0 +1,11 @@ +package jdshopapi + +//查询单个订单 +//https://open.jd.com/home/home#/doc/api?apiCateId=55&apiId=2389&apiName=jingdong.pop.order.enGet +func (a *API) EnGet(orderID int64) (err error) { + _, err = a.AccessAPI("jingdong.pop.order.enGet", prodURL, map[string]interface{}{ + "order_id": orderID, + "optional_fields": "ALL", + }) + return err +} diff --git a/platformapi/jdshopapi/order_test.go b/platformapi/jdshopapi/order_test.go new file mode 100644 index 00000000..23655aa2 --- /dev/null +++ b/platformapi/jdshopapi/order_test.go @@ -0,0 +1,13 @@ +package jdshopapi + +import ( + "testing" +) + +func TestEnGet(t *testing.T) { + err := api.EnGet(116889545275) + if err != nil { + t.Fatal(err) + } + // t.Log(utils.Format4Output(result, false)) +} diff --git a/platformapi/jdshopapi/sku.go b/platformapi/jdshopapi/sku.go index 47bbfc4e..9a9bf03a 100644 --- a/platformapi/jdshopapi/sku.go +++ b/platformapi/jdshopapi/sku.go @@ -113,8 +113,9 @@ type CreateSkuParamSkus struct { // Props []struct{} `json:"props"` //否 无 SKU属性(已废弃 请使用multiCateProps,已经按照类目限制使用3级类目修改,请及时迁移到多级类目) SaleAttrs []*CreateSkuParamAttrs `json:"saleAttrs"` //否 无 多级SKU属性,仅当属性可以下沉时才能设置,不验证必填!sku维度设置后,以sku上的属性为准! // Capacity string `json:"capacity"` // 否 20L 20T 容量,在有特殊要求的类目下必填!最多支持6位小数。 - Type string `json:"type"` //"com.jd.pop.ware.ic.api.domain.sku" - Type2 string `json:"@type"` + Type string `json:"type"` //"com.jd.pop.ware.ic.api.domain.sku" + Type2 string `json:"@type"` + MultiCateProps []*CreateSkuParamAttrs `json:"multiCateProps"` // 否 无 类目属性列表,类目属性中有必填项时,此字段必填;若未设置或设置错误,会有“通用属性必填”等错误提示! } type CreateSkuParamAttrs struct { @@ -142,12 +143,13 @@ type CreateSkuResult struct { } type UpdateWareParam struct { - WareID int64 `json:"wareId"` - Title string `json:"title"` //否 标题 商品名称 限制45个字符内 - VenderID int64 `json:"venderId"` - PromiseID int `json:"promiseId"` // 否 无 配送时效 - MobileDesc string `json:"mobileDesc"` // 是 无 移动版的商品介绍 长度限制10W个字符 - Introduction string `json:"introduction"` // 是 无 PC版的商品介绍 长度限制10W个字符 + WareID int64 `json:"wareId"` + Title string `json:"title"` //否 标题 商品名称 限制45个字符内 + VenderID int64 `json:"venderId"` + PromiseID int `json:"promiseId"` // 否 无 配送时效 + MobileDesc string `json:"mobileDesc"` // 是 无 移动版的商品介绍 长度限制10W个字符 + Introduction string `json:"introduction"` // 是 无 PC版的商品介绍 长度限制10W个字符 + Features []*CreateSkuParamFeatures `json:"features"` // 否 无 商品维度的特殊属性 目前两个特殊属性 IBS、FBP、FCS、SCF 4种商家类型【规格型号】 model和【销售单位】 unit 字段且为必填(如 个、盒、袋等)请勿填写公司名称。 } type QueryPictureReuslt struct { @@ -168,16 +170,17 @@ type UpdateSkusParam struct { } type UpdateSkusParamSkus struct { - WareID int64 `json:"wareId,omitempty"` //是 11111111111 商品ID(必填) - SkuID int64 `json:"skuId,omitempty"` //否 11111558987 skuID(新增的sku可不填写) - SaleAttrs []*CreateSkuParamAttrs `json:"saleAttrs,omitempty"` //是 无 SKU销售属性 - JdPrice float64 `json:"jdPrice,omitempty"` //是 无 京东价必填 单位:元 - OuterID string `json:"outerId,omitempty"` //否 ww_4567 外部ID,系统不保证唯一性,如需唯一性自行保证 - StockNum string `json:"stockNum,omitempty"` //是 10 总库存数 - BarCode string `json:"barCode,omitempty"` //否 45456467777 SKU的条形码 - Capacity string `json:"capacity,omitempty"` //否 20L 容量,在有特殊要求的类目下必填!最多支持6位小数。 - Type string `json:"type"` //"com.jd.pop.ware.ic.api.domain.sku" - Type2 string `json:"@type"` + WareID int64 `json:"wareId,omitempty"` //是 11111111111 商品ID(必填) + SkuID int64 `json:"skuId,omitempty"` //否 11111558987 skuID(新增的sku可不填写) + SaleAttrs []*CreateSkuParamAttrs `json:"saleAttrs,omitempty"` //是 无 SKU销售属性 + JdPrice float64 `json:"jdPrice,omitempty"` //是 无 京东价必填 单位:元 + OuterID string `json:"outerId,omitempty"` //否 ww_4567 外部ID,系统不保证唯一性,如需唯一性自行保证 + StockNum string `json:"stockNum,omitempty"` //是 10 总库存数 + BarCode string `json:"barCode,omitempty"` //否 45456467777 SKU的条形码 + Capacity string `json:"capacity,omitempty"` //否 20L 容量,在有特殊要求的类目下必填!最多支持6位小数。 + Type string `json:"type"` //"com.jd.pop.ware.ic.api.domain.sku" + Type2 string `json:"@type"` + MultiCateProps []*CreateSkuParamAttrs `json:"multiCateProps"` // 否 无 类目属性列表,类目属性中有必填项时,此字段必填;若未设置或设置错误,会有“通用属性必填”等错误提示! } //查询商家所有的店内分类 diff --git a/platformapi/jdshopapi/sku_test.go b/platformapi/jdshopapi/sku_test.go index 4f2dcd76..691e9c11 100644 --- a/platformapi/jdshopapi/sku_test.go +++ b/platformapi/jdshopapi/sku_test.go @@ -231,7 +231,7 @@ func TestCreateSku(t *testing.T) { } func TestFindAttrs(t *testing.T) { - result, err := api.FindAttrs(13573) + result, err := api.FindAttrs(13571) if err != nil { t.Fatal(err) } @@ -239,7 +239,7 @@ func TestFindAttrs(t *testing.T) { } func TestFindValuesByAttrId(t *testing.T) { - result, no, err := api.FindValuesByAttrId(1001027602) + result, no, err := api.FindValuesByAttrId(102241) if err != nil { t.Fatal(err) }