jdapi.GetSkuPageInfo不用map
This commit is contained in:
@@ -140,6 +140,59 @@ type PageShopInfo struct {
|
||||
StoreShareURL string `json:"storeShareUrl"`
|
||||
}
|
||||
|
||||
type PageSku struct {
|
||||
ButtonEnable bool `json:"buttonEnable"`
|
||||
CatID string `json:"catId"`
|
||||
FixedStatus bool `json:"fixedStatus"`
|
||||
FuncIndicatins string `json:"funcIndicatins"`
|
||||
H5SwichItem struct {
|
||||
IsLeadApp bool `json:"isLeadApp"`
|
||||
} `json:"h5SwichItem"`
|
||||
HasSaleAttr bool `json:"hasSaleAttr"`
|
||||
IconType int `json:"iconType"`
|
||||
Image []*SkuPageImg `json:"image"`
|
||||
InCartCount int `json:"inCartCount"`
|
||||
IsInScope bool `json:"isInScope"`
|
||||
IsRemind bool `json:"isRemind"`
|
||||
MarkingPrice string `json:"markingPrice"`
|
||||
Name string `json:"name"`
|
||||
OrgCode string `json:"orgCode"`
|
||||
Prescription bool `json:"prescription"`
|
||||
PriceUnit string `json:"priceUnit"`
|
||||
ProductComment struct {
|
||||
CommentNum string `json:"commentNum"`
|
||||
GoodRate float64 `json:"goodRate"`
|
||||
GoodRating string `json:"goodRating"`
|
||||
HasMore bool `json:"hasMore"`
|
||||
TotalScore string `json:"totalScore"`
|
||||
} `json:"productComment"`
|
||||
ProductInfoType int `json:"productInfoType"`
|
||||
ProductType int `json:"productType"`
|
||||
ProductTypeEnum string `json:"productTypeEnum"`
|
||||
ShareProductURL string `json:"shareProductUrl"`
|
||||
ShowState int `json:"showState"`
|
||||
ShowStateEnum string `json:"showStateEnum"`
|
||||
ShowStateName string `json:"showStateName"`
|
||||
ShowTimLine bool `json:"showTimLine"`
|
||||
SkuID int64 `json:"skuId"`
|
||||
SkuPriceVO struct {
|
||||
BasicPrice string `json:"basicPrice"`
|
||||
MkPrice string `json:"mkPrice"`
|
||||
Promotion int `json:"promotion"`
|
||||
RealTimePrice string `json:"realTimePrice"`
|
||||
SkuID string `json:"skuId"`
|
||||
} `json:"skuPriceVO"`
|
||||
Standard string `json:"standard"`
|
||||
StoreInfo struct {
|
||||
Show bool `json:"show"`
|
||||
StoreID string `json:"storeId"`
|
||||
} `json:"storeInfo"`
|
||||
Subtitle string `json:"subtitle"`
|
||||
Tags []string `json:"tags"`
|
||||
UserActionSku string `json:"userActionSku"`
|
||||
VenderID string `json:"venderId"`
|
||||
}
|
||||
|
||||
const (
|
||||
QualifyTypeCompany = "25" // 营业执照
|
||||
QualifyTypePerson = "22" // 身份证,个体工商户要求填
|
||||
@@ -322,7 +375,7 @@ func (a *API) GetStoreOrderInfoList(fromTime, toTime string) (storeOrderList []m
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (a *API) GetSkuPageInfo(skuId int64) (skuPageInfo map[string]interface{}, err error) {
|
||||
func (a *API) GetSkuPageInfo(skuId int64) (skuPageInfo *PageSku, err error) {
|
||||
skuIDMap := map[string]interface{}{
|
||||
"skuId": utils.Int64ToStr(skuId),
|
||||
"storeId": "0",
|
||||
@@ -334,14 +387,17 @@ func (a *API) GetSkuPageInfo(skuId int64) (skuPageInfo map[string]interface{}, e
|
||||
"body": utils.Format4Output(skuIDMap, true),
|
||||
}
|
||||
|
||||
skuPageInfo, err = a.AccessStorePage("https://daojia.jd.com/client", params, false)
|
||||
result, err := a.AccessStorePage("https://daojia.jd.com/client", params, false)
|
||||
if err == nil {
|
||||
err = utils.Map2StructByJson(result, &skuPageInfo, false)
|
||||
}
|
||||
return skuPageInfo, err
|
||||
}
|
||||
|
||||
func (a *API) GetSkuPageImageInfo(skuId int64) (imgList []*SkuPageImg, err error) {
|
||||
skuPageInfo, err := a.GetSkuPageInfo(skuId)
|
||||
if err == nil {
|
||||
err = utils.Map2StructByJson(skuPageInfo["image"], &imgList, false)
|
||||
imgList = skuPageInfo.Image
|
||||
}
|
||||
return imgList, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user