aa
This commit is contained in:
@@ -2,6 +2,16 @@ package pddapi
|
||||
|
||||
import "git.rosy.net.cn/baseapi/utils"
|
||||
|
||||
const (
|
||||
GoodsActTagMS = 4 //-秒杀,
|
||||
GoodsActTagBYBT = 7 //-百亿补贴,
|
||||
GoodsActTagQWBT = 10851 //-千万补贴,
|
||||
GoodsActTagPPHB = 31 //-品牌黑标,
|
||||
GoodsActTagJXBK = 10564 //-精选爆品-官方直推爆款,
|
||||
GoodsActTagTZTJ = 10584 //-精选爆品-团长推荐,
|
||||
GoodsActTagPPGY = 24 //-品牌高佣 =
|
||||
)
|
||||
|
||||
type GoodsCatsGetResult struct {
|
||||
CatName string `json:"cat_name"`
|
||||
Level int `json:"level"`
|
||||
@@ -23,18 +33,84 @@ func (a *API) GoodsCatsGet(catID int) (goodsCatsGetResult []*GoodsCatsGetResult,
|
||||
type GoodsSearchParam struct {
|
||||
CatID int `json:"cat_id,omitempty"`
|
||||
GoodsSignList []string `json:"goods_sign_list,omitempty"`
|
||||
ActivityTags []int `json:"activity_tags,omitempty"`
|
||||
Keyword string `json:"keyword,omitempty"`
|
||||
ListID string `json:"list_id,omitempty"`
|
||||
Page int `json:"page,omitempty"`
|
||||
PageSize int `json:"page_size,omitempty"`
|
||||
SortType int `json:"sort_type,omitempty"`
|
||||
}
|
||||
type GoodsSearchResult struct {
|
||||
GoodsList []struct {
|
||||
CategoryName string `json:"category_name"`
|
||||
CouponRemainQuantity int `json:"coupon_remain_quantity"`
|
||||
PromotionRate int `json:"promotion_rate"`
|
||||
ServiceTags []int `json:"service_tags"`
|
||||
MallID int `json:"mall_id"`
|
||||
MallName string `json:"mall_name"`
|
||||
MallCouponEndTime int `json:"mall_coupon_end_time"`
|
||||
LgstTxt string `json:"lgst_txt"`
|
||||
GoodsName string `json:"goods_name"`
|
||||
GoodsID int `json:"goods_id"`
|
||||
PredictPromotionRate int `json:"predict_promotion_rate"`
|
||||
GoodsDesc string `json:"goods_desc"`
|
||||
OptName string `json:"opt_name"`
|
||||
ShareRate int `json:"share_rate"`
|
||||
OptIds []int `json:"opt_ids"`
|
||||
GoodsImageURL string `json:"goods_image_url"`
|
||||
HasMallCoupon bool `json:"has_mall_coupon"`
|
||||
UnifiedTags []string `json:"unified_tags"`
|
||||
CouponStartTime int `json:"coupon_start_time"`
|
||||
MinGroupPrice int `json:"min_group_price"`
|
||||
CouponDiscount int `json:"coupon_discount"`
|
||||
CouponEndTime int `json:"coupon_end_time"`
|
||||
ZsDuoID int `json:"zs_duo_id"`
|
||||
MallCouponRemainQuantity int `json:"mall_coupon_remain_quantity"`
|
||||
PlanType int `json:"plan_type"`
|
||||
ExtraCouponAmount int `json:"extra_coupon_amount,omitempty"`
|
||||
CatIds []int `json:"cat_ids"`
|
||||
CouponMinOrderAmount int `json:"coupon_min_order_amount"`
|
||||
CategoryID int `json:"category_id"`
|
||||
MallCouponDiscountPct int `json:"mall_coupon_discount_pct"`
|
||||
CouponTotalQuantity int `json:"coupon_total_quantity"`
|
||||
MallCouponMinOrderAmount int `json:"mall_coupon_min_order_amount"`
|
||||
MerchantType int `json:"merchant_type"`
|
||||
SalesTip string `json:"sales_tip"`
|
||||
OnlySceneAuth bool `json:"only_scene_auth"`
|
||||
DescTxt string `json:"desc_txt"`
|
||||
MallCouponID int `json:"mall_coupon_id"`
|
||||
GoodsThumbnailURL string `json:"goods_thumbnail_url"`
|
||||
OptID int `json:"opt_id"`
|
||||
SearchID string `json:"search_id"`
|
||||
ActivityTags []int `json:"activity_tags"`
|
||||
HasCoupon bool `json:"has_coupon"`
|
||||
MinNormalPrice int `json:"min_normal_price"`
|
||||
MallCouponStartTime int `json:"mall_coupon_start_time"`
|
||||
ServTxt string `json:"serv_txt"`
|
||||
MallCouponTotalQuantity int `json:"mall_coupon_total_quantity"`
|
||||
MallCouponMaxDiscountAmount int `json:"mall_coupon_max_discount_amount"`
|
||||
MallCps int `json:"mall_cps"`
|
||||
GoodsSign string `json:"goods_sign"`
|
||||
CltCpnEndTime int `json:"clt_cpn_end_time,omitempty"`
|
||||
CltCpnMinAmt int `json:"clt_cpn_min_amt,omitempty"`
|
||||
CltCpnRemainQuantity int `json:"clt_cpn_remain_quantity,omitempty"`
|
||||
CltCpnBatchSn string `json:"clt_cpn_batch_sn,omitempty"`
|
||||
CltCpnDiscount int `json:"clt_cpn_discount,omitempty"`
|
||||
CltCpnQuantity int `json:"clt_cpn_quantity,omitempty"`
|
||||
CltCpnStartTime int `json:"clt_cpn_start_time,omitempty"`
|
||||
ActivityType int `json:"activity_type,omitempty"`
|
||||
} `json:"goods_list"`
|
||||
ListID string `json:"list_id"`
|
||||
TotalCount int `json:"total_count"`
|
||||
RequestID string `json:"request_id"`
|
||||
SearchID string `json:"search_id"`
|
||||
}
|
||||
|
||||
//多多进宝商品查询
|
||||
func (a *API) GoodsSearch(goodsSearchParam *GoodsSearchParam) (resourceURLGenResult *ResourceURLGenResult, err error) {
|
||||
func (a *API) GoodsSearch(goodsSearchParam *GoodsSearchParam) (goodsSearchResult *GoodsSearchResult, err error) {
|
||||
result, err := a.AccessAPI("pdd.ddk.goods.search", false, utils.Struct2FlatMap(goodsSearchParam))
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["resource_url_response"], &resourceURLGenResult, false)
|
||||
utils.Map2StructByJson(result["goods_search_response"], &goodsSearchResult, false)
|
||||
}
|
||||
return resourceURLGenResult, err
|
||||
return goodsSearchResult, err
|
||||
}
|
||||
|
||||
@@ -14,7 +14,11 @@ func TestGoodsCatsGet(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGoodsSearch(t *testing.T) {
|
||||
result, err := api.GoodsSearch(0, nil, "", "", 1, 5, 0)
|
||||
result, err := api.GoodsSearch(&GoodsSearchParam{
|
||||
ActivityTags: []int{10564},
|
||||
Page: 1,
|
||||
PageSize: 10,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user