jdshop createsku2

This commit is contained in:
苏尹岚
2020-11-25 09:51:15 +08:00
parent 45026edd51
commit 1794ce5334
6 changed files with 375 additions and 135 deletions

View File

@@ -792,3 +792,196 @@ func (a *API) UploadImageNew(data []byte, fileName string) (jdURL string, err er
}
return jdURL, err
}
type WareSaveParam struct {
AdContent string `json:"adContent"`
AdContentURL string `json:"adContentUrl"`
AdContentWords string `json:"adContentWords"`
AvailableFeatures []interface{} `json:"availableFeatures"`
BrandID int `json:"brandId"`
CatIDLevel1 int `json:"catIdLevel1"`
CatIDLevel2 int `json:"catIdLevel2"`
CatIDLevel4 int `json:"catIdLevel4"`
CategoryID int `json:"categoryId"`
CharacteristicService []interface{} `json:"characteristicService"`
ColType int `json:"colType,omitempty"`
CostPrice string `json:"costPrice"`
Delivery int `json:"delivery"`
DeliveryID1 int `json:"deliveryId1"`
Density string `json:"density"`
DesignConcept string `json:"designConcept"`
ExtendFeatures []interface{} `json:"extendFeatures"`
Features []WareSaveSkusFea `json:"features,omitempty"`
FitmentNote string `json:"fitmentNote"`
FitmentNoteMobile string `json:"fitmentNoteMobile"`
HasWareBoot bool `json:"hasWareBoot"`
Height int `json:"height"`
HouseInfo struct {
Address struct {
AreaCode int `json:"areaCode"`
AreaName string `json:"areaName"`
CityCode int `json:"cityCode"`
CityName string `json:"cityName"`
Detail string `json:"detail"`
Img string `json:"img"`
Lat int `json:"lat"`
Lng int `json:"lng"`
ProvinceCode int `json:"provinceCode"`
ProvinceName string `json:"provinceName"`
} `json:"address"`
AvgPrice int `json:"avgPrice"`
Characteristics string `json:"characteristics"`
ExtentImgMap interface{} `json:"extentImgMap"`
Flag int `json:"flag"`
PresaleList []interface{} `json:"presaleList"`
TotalPrice int `json:"totalPrice"`
} `json:"houseInfo"`
ImageMap struct {
Num0000000000 []CreateSkuParamImages `json:"0000000000"`
} `json:"imageMap"`
ImgAgreementSelected bool `json:"imgAgreementSelected"`
IntroductionUseFlag string `json:"introductionUseFlag"`
Is7ToReturn int `json:"is7ToReturn"`
IsAllChannel bool `json:"isAllChannel"`
IsLoc int `json:"isLoc"`
IsLocSwitch int `json:"isLocSwitch"`
IsOperateInvoice int `json:"isOperateInvoice"`
IsRentWare int `json:"isRentWare"`
IsTaxCheap int `json:"isTaxCheap"`
ItemNum string `json:"itemNum"`
JdPrice int `json:"jdPrice"`
LastCategoryID int `json:"lastCategoryId"`
Length int `json:"length"`
LocAreaID1 int `json:"locAreaId1"`
LocMatchInfoVO struct {
ActivitiesIllustration string `json:"activitiesIllustration"`
ActivityAgreement int `json:"activityAgreement"`
ActivityBegin string `json:"activityBegin"`
ActivityEnd string `json:"activityEnd"`
AddressID int `json:"addressId"`
Coordinate string `json:"coordinate"`
DetailAddress string `json:"detailAddress"`
RegistrationField int `json:"registrationField"`
VenderID int `json:"venderId"`
WareID int `json:"wareId"`
} `json:"locMatchInfoVO"`
MainImg string `json:"mainImg"`
MarkSource int `json:"markSource"`
MarketPrice int `json:"marketPrice"`
MobileDesc string `json:"mobileDesc"`
MobileDescUseFlag string `json:"mobileDescUseFlag"`
MobileZhuangBaID string `json:"mobileZhuangBaId"`
MoreImage bool `json:"moreImage"`
MultiCateProps []interface{} `json:"multiCateProps"`
Notes string `json:"notes"`
OptionType int `json:"optionType"`
OutTime string `json:"outTime"`
OuterID string `json:"outerId"`
PackListing string `json:"packListing"`
PayType string `json:"payType"`
PromiseID int `json:"promiseId"`
PromiseTemplateType int `json:"promiseTemplateType"`
PropsSet []interface{} `json:"propsSet"`
PutawayTime string `json:"putawayTime"`
PwMarketingLabelVo struct {
IsRequestSku bool `json:"isRequestSku"`
PwBdsLabelBindVos []interface{} `json:"pwBdsLabelBindVos"`
PwBdsProposalVos []interface{} `json:"pwBdsProposalVos"`
RelationID int `json:"relationId"`
} `json:"pwMarketingLabelVo"`
QcReports interface{} `json:"qcReports"`
Rate string `json:"rate"`
RentSpuVO struct {
CreateTime interface{} `json:"createTime"`
PlotID int `json:"plotId"`
PlotInfo interface{} `json:"plotInfo"`
SkuList []interface{} `json:"skuList"`
SpuBroker interface{} `json:"spuBroker"`
SpuID int `json:"spuId"`
SpuName string `json:"spuName"`
StaffID int `json:"staffId"`
UpdateTime interface{} `json:"updateTime"`
} `json:"rentSpuVO"`
SaleAttrs []interface{} `json:"saleAttrs"`
Service string `json:"service"`
ServiceDesc string `json:"serviceDesc"`
ServiceFeeID int `json:"serviceFeeId"`
ShopCategorys []int `json:"shopCategorys"`
SkuJSON string `json:"skuJson"`
Skus []WareSaveSkus `json:"skus"`
TaxCheapContent string `json:"taxCheapContent"`
TaxCode string `json:"taxCode"`
TaxRate int `json:"taxRate"`
TempID string `json:"tempId"`
TemplateID int `json:"templateId"`
Title string `json:"title"`
ToUsePrice string `json:"toUsePrice"`
TransparentImageAudit []interface{} `json:"transparentImageAudit"`
TransparentImageMap struct {
} `json:"transparentImageMap"`
TransportID int `json:"transportId"`
UpcCode string `json:"upcCode"`
VenderID int `json:"venderId"`
WareID int64 `json:"wareId"`
WareLocation string `json:"wareLocation"`
WareStatus int `json:"wareStatus"`
WareStatusStr string `json:"wareStatusStr"`
Weight string `json:"weight"`
Wide int `json:"wide"`
ZeroTaxRate int `json:"zeroTaxRate"`
ZhuangBaID string `json:"zhuangBaId"`
ZhuangBaIntroduction string `json:"zhuangBaIntroduction"`
ZhuangBaMobileDesc string `json:"zhuangBaMobileDesc"`
}
type WareSaveSkusFea struct {
Cn string `json:"cn"`
Key string `json:"key"`
Value string `json:"value"`
}
type WareSaveSkusProp struct {
AttrID int `json:"attrId"`
AttrValues int64 `json:"attrValues"`
AttrValueAlias string `json:"attrValueAlias"`
}
type WareSaveSkus struct {
Props []WareSaveSkusProp `json:"props"`
Features []interface{} `json:"features"`
SkuID int64 `json:"skuId,omitempty"`
JdPrice string `json:"jdPrice"`
OuterID string `json:"outerId"`
StockNum int `json:"stockNum"`
RentDeposit string `json:"rentDeposit"`
RentUnit string `json:"rentUnit"`
RentServiceDay string `json:"rentServiceDay"`
SkuProps []interface{} `json:"skuProps"`
Plu string `json:"plu"`
Capacity interface{} `json:"capacity"`
}
type WareSaveResult struct {
SkuID int64 `json:"skuId"`
VenderID int `json:"venderId"`
WareID int64 `json:"wareId"`
Props []struct {
AttrID string `json:"attrId"`
AttrValues string `json:"attrValues"`
AttrValueAlias string `json:"attrValueAlias"`
} `json:"props"`
JdPrice float64 `json:"jdPrice"`
OuterID string `json:"outerId"`
StockNum int `json:"stockNum"`
}
//创建商品
//https://porder.shop.jd.com/order/orderlist/allOrders
func (a *API) WareSave(wareSaveParam *WareSaveParam) (wareSaveResult []*WareSaveResult, err error) {
params := utils.Struct2FlatMap(wareSaveParam)
result, err := a.AccessStorePage2("https://ware.shop.jd.com/rest/shop/ware/save", params, true)
if err == nil {
utils.Map2StructByJson(result["data"].(map[string]interface{})["skus"], &wareSaveResult, false)
}
return wareSaveResult, err
}