aa
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package jdapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@@ -680,15 +681,28 @@ 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{}{
|
||||
type BatchAddSkuByUPCResult struct {
|
||||
FailedDetail string `json:"failedDetail"`
|
||||
OrgCode string `json:"orgCode"`
|
||||
OutSkuID string `json:"outSkuId"`
|
||||
ResultCode string `json:"resultCode"`
|
||||
ResultMsg string `json:"resultMsg"`
|
||||
SkuID string `json:"skuId"`
|
||||
UpcCode string `json:"upcCode"`
|
||||
}
|
||||
|
||||
func (a *API) BatchAddSkuByUPC(batchSkuRequestList []*CreateByUpcParam2) (batchAddSkuByUPCResult *BatchAddSkuByUPCResult, err error) {
|
||||
result, err := a.AccessAPINoPage("pms/batchAddSku", map[string]interface{}{
|
||||
"traceId": utils.GetUUID(),
|
||||
"openBatchAddSkuRequests": batchSkuRequestList,
|
||||
}, nil, nil, nil)
|
||||
if err == nil {
|
||||
|
||||
utils.Map2StructByJson(result.([]interface{})[0].(map[string]interface{}), &batchAddSkuByUPCResult, false)
|
||||
if batchAddSkuByUPCResult.SkuID == "" && batchAddSkuByUPCResult.FailedDetail != "" {
|
||||
return nil, fmt.Errorf(batchAddSkuByUPCResult.FailedDetail)
|
||||
}
|
||||
}
|
||||
return nil, err
|
||||
return batchAddSkuByUPCResult, err
|
||||
}
|
||||
|
||||
func (a *API) GetSpuStatus(outSpuId string) (resultStatus int, err error) {
|
||||
|
||||
@@ -278,7 +278,7 @@ func TestQueren(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBatchAddSkuByUPC(t *testing.T) {
|
||||
_, err := api.BatchAddSkuByUPC([]*CreateByUpcParam2{
|
||||
result, err := api.BatchAddSkuByUPC([]*CreateByUpcParam2{
|
||||
&CreateByUpcParam2{
|
||||
OutSkuId: "6048265",
|
||||
Upc: "6911672042530",
|
||||
@@ -289,4 +289,5 @@ func TestBatchAddSkuByUPC(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user