1
This commit is contained in:
@@ -2,10 +2,9 @@ package jdapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -188,26 +187,25 @@ const (
|
||||
)
|
||||
|
||||
type OpSkuParam struct {
|
||||
TraceID string `json:"traceId"`
|
||||
OutSkuID string `json:"outSkuId"`
|
||||
ShopCategories []int64 `json:"shopCategories,omitempty"`
|
||||
CategoryID int64 `json:"categoryId,omitempty"`
|
||||
BrandID int64 `json:"brandId,omitempty"`
|
||||
SkuName string `json:"skuName,omitempty"`
|
||||
SkuPrice int `json:"skuPrice,omitempty"`
|
||||
Weight float64 `json:"weight,omitempty"`
|
||||
FixedStatus int `json:"fixedStatus,omitempty"` // 商家商品上下架状态(1:上架;2:下架;4:删除;)
|
||||
IsSale int `json:"-"` // 创建:0,1可售,-1不可售,更新:0忽略,1可售,-1不可售
|
||||
DontUseThisFieldDirectlyIsSale bool `json:"isSale"` // 门店商品可售状态(true/false);新建商品时,如果为true,门店商品可售状态初始为可售,如果为false, 门店商品可售状态初始为不可售。后续修改各个门店商品可售状态时,请使用根据京东到家商品编码批量修改门店商品可售状态接口。
|
||||
|
||||
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"`
|
||||
Slogan string `json:"slogan,omitempty"`
|
||||
SloganStartTime string `json:"sloganStartTime,omitempty"`
|
||||
SloganEndTime string `json:"sloganEndTime,omitempty"`
|
||||
SellCities []int64 `json:"sellCities,omitempty"`
|
||||
TraceID string `json:"traceId"`
|
||||
OutSkuID string `json:"outSkuId"`
|
||||
ShopCategories []int64 `json:"shopCategories,omitempty"`
|
||||
CategoryID int64 `json:"categoryId,omitempty"`
|
||||
BrandID int64 `json:"brandId,omitempty"`
|
||||
SkuName string `json:"skuName,omitempty"`
|
||||
SkuPrice int `json:"skuPrice,omitempty"`
|
||||
Weight float64 `json:"weight,omitempty"`
|
||||
FixedStatus int `json:"fixedStatus,omitempty"` // 商家商品上下架状态(1:上架;2:下架;4:删除;)
|
||||
IsSale int `json:"-"` // 创建:0,1可售,-1不可售,更新:0忽略,1可售,-1不可售
|
||||
DontUseThisFieldDirectlyIsSale bool `json:"isSale"` // 门店商品可售状态(true/false);新建商品时,如果为true,门店商品可售状态初始为可售,如果为false, 门店商品可售状态初始为不可售。后续修改各个门店商品可售状态时,请使用根据京东到家商品编码批量修改门店商品可售状态接口。
|
||||
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"`
|
||||
Slogan string `json:"slogan,omitempty"`
|
||||
SloganStartTime string `json:"sloganStartTime,omitempty"`
|
||||
SloganEndTime string `json:"sloganEndTime,omitempty"`
|
||||
SellCities []int64 `json:"sellCities,omitempty"`
|
||||
}
|
||||
|
||||
type QueryListBySkuIdsParam struct {
|
||||
@@ -415,6 +413,60 @@ func (a *API) AddSku2(param *OpSkuParam) (skuID string, err error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
func (a *API) NewAddSku(param *NewAddSkuParam) (skuID string, err error) {
|
||||
mapData := utils.Struct2MapByJson(param)
|
||||
result, err := a.AccessAPINoPage("pms/addSku", mapData, nil, nil, nil)
|
||||
if err == nil {
|
||||
skuId := utils.Interface2Int64WithDefault(result.(map[string]interface{})["skuId"], 0)
|
||||
return utils.Int64ToStr(skuId), nil
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
|
||||
type NewAddSkuParam struct {
|
||||
//LimitPurchaseNum int `json:"limitPurchaseNum"`
|
||||
TraceId string `json:"traceId"`
|
||||
OutSkuId string `json:"outSkuId"`
|
||||
ShopCategories []int64 `json:"shopCategories"`
|
||||
CategoryId int64 `json:"categoryId"`
|
||||
BrandId int64 `json:"brandId"`
|
||||
SkuName string `json:"skuName"`
|
||||
SkuPrice int64 `json:"skuPrice"`
|
||||
Weight float64 `json:"weight"`
|
||||
Upc string `json:"upc"`
|
||||
Images []string `json:"images"`
|
||||
ProductDesc string `json:"productDesc"`
|
||||
//IfViewDesc int `json:"ifViewDesc"`
|
||||
//Slogan string `json:"slogan"`
|
||||
//SloganStartTime time.Time `json:"sloganStartTime"`
|
||||
//SloganEndTime time.Time `json:"sloganEndTime"`
|
||||
//PrefixKeyId string `json:"prefixKeyId"`
|
||||
//PrefixKey string `json:"prefixKey"`
|
||||
//PreKeyStartTime time.Time `json:"preKeyStartTime"`
|
||||
//PreKeyEndTime time.Time `json:"preKeyEndTime"`
|
||||
//Length int `json:"length"`
|
||||
//Width int `json:"width"`
|
||||
//Height int `json:"height"`
|
||||
//TransportAttribute string `json:"transportAttribute"`
|
||||
//LiquidStatue string `json:"liquidStatue"`
|
||||
//Prescripition string `json:"prescripition"`
|
||||
//HighSingularValue string `json:"highSingularValue"`
|
||||
//IsBreakable string `json:"isBreakable"`
|
||||
FixedStatus int `json:"fixedStatus"`
|
||||
IsSale bool `json:"isSale"`
|
||||
//SellCities []int64 `json:"sellCities"`
|
||||
//PackageFee float64 `json:"packageFee"`
|
||||
//BusinessMark []int `json:"businessMark"`
|
||||
//ReturnLabel string `json:"returnLabel"`
|
||||
//RegistImage string `json:"registImage"`
|
||||
//ApprovalTime time.Time `json:"approvalTime"`
|
||||
//EndTime time.Time `json:"endTime"`
|
||||
//CategoryAttrs interface{} `json:"categoryAttrs"`
|
||||
//SalePointList interface{} `json:"salePointList"`
|
||||
//StationShopCategories interface{} `json:"stationShopCategories"`
|
||||
//OutStationNos interface{} `json:"outStationNos"`
|
||||
}
|
||||
|
||||
// 根据商家商品编码修改商品信息接口
|
||||
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=180&apiid=290bdb0ea8a44e10b86b05591254ad68
|
||||
func (a *API) UpdateSku(outSkuId string, params map[string]interface{}) (skuId string, err error) {
|
||||
@@ -797,7 +849,7 @@ func GetJdSkuIDFromError(err error) int64 {
|
||||
func (a *API) GetSkuCategoryBySkuName(productName string) (*GetSkuCategoryBySkuName, error) {
|
||||
result, err := a.AccessAPINoPage("pms/getSkuCateBrandBySkuName", map[string]interface{}{
|
||||
"productName": productName,
|
||||
"fields": []string{"category"},
|
||||
"fields": []string{"category", "brand"},
|
||||
}, nil, nil, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user