From 1c49fcb1d7b96e5f2d0b54d9ad8bc661a6a0f1b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 1 Mar 2021 18:14:36 +0800 Subject: [PATCH] a --- platformapi/jdapi/sku.go | 21 +++++++++++++++++++++ platformapi/jdapi/sku_test.go | 14 ++++++++++++++ platformapi/jdapi/store_page.go | 2 +- platformapi/jdshopapi/store_page_test.go | 2 +- 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/platformapi/jdapi/sku.go b/platformapi/jdapi/sku.go index 297c5fcc..16686156 100644 --- a/platformapi/jdapi/sku.go +++ b/platformapi/jdapi/sku.go @@ -65,6 +65,8 @@ const ( MaxBatchSize4BatchUpdateOutSkuId = 50 MaxPageSize4QuerySku = 50 MaxSkuIDsCount4QueryListBySkuIds = 25 + + ErrMustUPC = "处方药商品请根据商品UPC码批量新增商品接口创建" ) const ( @@ -140,6 +142,14 @@ type CreateByUpcParam struct { IsSale bool `json:"isSale"` // 门店商品可售状态,true为可售,false为不可售,默认为可售。 } +type CreateByUpcParam2 struct { + Upc string `json:"upc"` // 商品UPC码 + OutSkuId string `json:"outSkuId"` // 商家商品编码,商家系统中唯一编码,限1-35字符,与到家商品编码一对一对应 + JdPrice string `json:"jdPrice"` // 商家商品价格(单位:元),用于初始商品门店价格,所有的商品门店价格都会初始化成该值。后续修改商品门店价格需要通过价格类接口修改。 + ShopCategoryID int64 `json:"shopCategoryId"` // 商家店内分类编码,店内分类编码通过查询商家店内分类信息接口获取 + IsSale bool `json:"isSale"` // 门店商品可售状态,true为可售,false为不可售,默认为可售。 +} + type CreateByUpcPair struct { Upc string SkuId int64 @@ -670,6 +680,17 @@ func (a *API) BatchAddSku(batchSkuRequestList []*CreateByUpcParam) (pairs []*Cre return nil, err } +func (a *API) BatchAddSkuByUPC(batchSkuRequestList []*CreateByUpcParam2) (pairs []*CreateByUpcPair, err error) { + _, err = a.AccessAPINoPage("pms/batchAddSku", map[string]interface{}{ + "traceId": utils.GetUUID(), + "openBatchAddSkuRequests": batchSkuRequestList, + }, nil, nil, nil) + if err == nil { + + } + return nil, err +} + func (a *API) GetSpuStatus(outSpuId string) (resultStatus int, err error) { result, err := a.AccessAPINoPage("pms/getSpuStatus", map[string]interface{}{ "outSuperId": outSpuId, diff --git a/platformapi/jdapi/sku_test.go b/platformapi/jdapi/sku_test.go index 8cace522..e81aa5c9 100644 --- a/platformapi/jdapi/sku_test.go +++ b/platformapi/jdapi/sku_test.go @@ -276,3 +276,17 @@ func TestQueren(t *testing.T) { // } // t.Log(utils.Format4Output(result, false)) } + +func TestBatchAddSkuByUPC(t *testing.T) { + _, err := api.BatchAddSkuByUPC([]*CreateByUpcParam2{ + &CreateByUpcParam2{ + OutSkuId: "6048265", + Upc: "6911672042530", + JdPrice: "29800", + ShopCategoryID: 5485102, + }, + }) + if err != nil { + t.Fatal(err) + } +} diff --git a/platformapi/jdapi/store_page.go b/platformapi/jdapi/store_page.go index 4c5ed54e..3c8ca643 100644 --- a/platformapi/jdapi/store_page.go +++ b/platformapi/jdapi/store_page.go @@ -694,7 +694,7 @@ func (a *API) SaveQualify(stationNo string, actionType int, qualifyList []*Quali "stationNo": stationNo, "actionType": actionType, "qualifyList": utils.Format4Output(qualifyList, true), - "type": 1, + "type": 0, "degrade": "no", }, true, "") return err diff --git a/platformapi/jdshopapi/store_page_test.go b/platformapi/jdshopapi/store_page_test.go index a802e911..3ca847ec 100644 --- a/platformapi/jdshopapi/store_page_test.go +++ b/platformapi/jdshopapi/store_page_test.go @@ -606,7 +606,7 @@ func maxUncrossedLines(A []int, B []int) (s int) { } func TestShopList(t *testing.T) { - result, err := api.ShopList(2) + result, err := api.ShopList(25) if err != nil { t.Fatal(err) }