OpSkuParam.Upc json to upcCode

This commit is contained in:
gazebo
2019-12-13 15:16:56 +08:00
parent fd42a483d9
commit 17c4265ea4
2 changed files with 35 additions and 1 deletions

View File

@@ -184,7 +184,7 @@ type OpSkuParam struct {
IsSale int `json:"-"` // 创建0,1可售-1不可售更新0忽略1可售-1不可售
DontUseThisFieldDirectlyIsSale bool `json:"isSale"` // 门店商品可售状态(true/false)新建商品时如果为true门店商品可售状态初始为可售如果为false 门店商品可售状态初始为不可售。后续修改各个门店商品可售状态时,请使用根据京东到家商品编码批量修改门店商品可售状态接口。
Upc string `json:"upc,omitempty"` // UPC编码商品条码限1-35个字符包装类的商品要求UPC编码必填且要符合条码编写的校验否则商品会不予通过接口返回错误状态码code为10059。
Upc string `json:"upcCode,omitempty"` // TODO 老版与新版接口参数不一致,UPC编码商品条码限1-35个字符包装类的商品要求UPC编码必填且要符合条码编写的校验否则商品会不予通过接口返回错误状态码code为10059。
Images []string `json:"images,omitempty"`
ProductDesc string `json:"productDesc,omitempty"`
IfViewDesc int `json:"ifViewDesc"`

View File

@@ -133,6 +133,14 @@ func TestGetProductStatust(t *testing.T) {
}
}
func TestAddShopCategory(t *testing.T) {
result, err := api.AddShopCategory(0, "hello", 1, 0, "test")
if err != nil {
t.Fatal(err)
}
t.Log(result)
}
func TestDelShopCategory(t *testing.T) {
err := api.DelShopCategory(4784689)
if err != nil {
@@ -156,6 +164,32 @@ func TestGetSpuSaleAttr(t *testing.T) {
t.Log(utils.Format4Output(result, false))
}
func TestAddSku(t *testing.T) {
str := `
{"brandId":35247,
"categoryId":20847,
"fixedStatus":1,
"ifViewDesc":0,
"images":["http://image.jxc4.com/e42be71501d0fbb841743bfb7a9ebbcf.jpg"],
"isSale":false,
"outSkuId":"29935",
"shopCategories":[4247719],
"skuName":"黑2龙江冰宝珍珠米10kg/袋",
"skuPrice":7245,"traceId":"4414AEAD1CCA11EAB689525400E86DC0,xujianhua","weight":1}
`
var param *OpSkuParam
err := utils.UnmarshalUseNumber([]byte(str), &param)
if err != nil {
t.Fatal(err)
}
param.Upc = "6666000029935"
result, err := api.AddSku2(param)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestBatchAddSku(t *testing.T) {
paramList := []*CreateByUpcParam{
&CreateByUpcParam{