aa
This commit is contained in:
@@ -2,6 +2,10 @@ package tbunionapi
|
||||
|
||||
import "git.rosy.net.cn/baseapi/utils"
|
||||
|
||||
const (
|
||||
SSRXCatID = 28026
|
||||
)
|
||||
|
||||
type OptimusMaterialResult struct {
|
||||
CategoryID int `json:"category_id"`
|
||||
ClickURL string `json:"click_url"`
|
||||
@@ -51,19 +55,87 @@ func (a *API) OptimusMaterial(materialID, adzoneID, pageNo, pageSize int) (activ
|
||||
type MaterialOptionalParam struct {
|
||||
AdzoneID int `json:"adzone_id,omitempty"`
|
||||
Q string `json:"q,omitempty"`
|
||||
ListID string `json:"list_id,omitempty"`
|
||||
PageNo int `json:"page_no,omitempty"`
|
||||
PageSize int `json:"page_size,omitempty"`
|
||||
Sort int `json:"sort,omitempty"`
|
||||
Cat string `json:"cat,omitempty"`
|
||||
}
|
||||
type MaterialOptionalResult struct {
|
||||
CategoryID int `json:"category_id"`
|
||||
CategoryName string `json:"category_name"`
|
||||
CommissionRate string `json:"commission_rate"`
|
||||
CommissionType string `json:"commission_type"`
|
||||
CouponAmount string `json:"coupon_amount,omitempty"`
|
||||
CouponEndTime string `json:"coupon_end_time,omitempty"`
|
||||
CouponID string `json:"coupon_id"`
|
||||
CouponInfo string `json:"coupon_info"`
|
||||
CouponRemainCount int `json:"coupon_remain_count"`
|
||||
CouponShareURL string `json:"coupon_share_url,omitempty"`
|
||||
CouponStartFee string `json:"coupon_start_fee,omitempty"`
|
||||
CouponStartTime string `json:"coupon_start_time,omitempty"`
|
||||
CouponTotalCount int `json:"coupon_total_count"`
|
||||
IncludeDxjh string `json:"include_dxjh"`
|
||||
IncludeMkt string `json:"include_mkt"`
|
||||
InfoDxjh string `json:"info_dxjh"`
|
||||
ItemDescription string `json:"item_description"`
|
||||
ItemID int64 `json:"item_id"`
|
||||
ItemURL string `json:"item_url"`
|
||||
LevelOneCategoryID int `json:"level_one_category_id"`
|
||||
LevelOneCategoryName string `json:"level_one_category_name"`
|
||||
Nick string `json:"nick"`
|
||||
NumIid int64 `json:"num_iid"`
|
||||
PictURL string `json:"pict_url"`
|
||||
PresaleDeposit string `json:"presale_deposit"`
|
||||
PresaleEndTime int `json:"presale_end_time"`
|
||||
PresaleStartTime int `json:"presale_start_time"`
|
||||
PresaleTailEndTime int `json:"presale_tail_end_time"`
|
||||
PresaleTailStartTime int `json:"presale_tail_start_time"`
|
||||
Provcity string `json:"provcity"`
|
||||
RealPostFee string `json:"real_post_fee"`
|
||||
ReservePrice string `json:"reserve_price"`
|
||||
SellerID int64 `json:"seller_id"`
|
||||
ShopDsr int `json:"shop_dsr"`
|
||||
ShopTitle string `json:"shop_title"`
|
||||
ShortTitle string `json:"short_title"`
|
||||
SmallImages []string `json:"small_images"`
|
||||
SuperiorBrand string `json:"superior_brand"`
|
||||
Title string `json:"title"`
|
||||
TkTotalCommi string `json:"tk_total_commi"`
|
||||
TkTotalSales string `json:"tk_total_sales"`
|
||||
URL string `json:"url"`
|
||||
UserType int `json:"user_type"`
|
||||
Volume int `json:"volume"`
|
||||
WhiteImage string `json:"white_image"`
|
||||
XID string `json:"x_id"`
|
||||
ZkFinalPrice string `json:"zk_final_price"`
|
||||
}
|
||||
|
||||
//物料搜索
|
||||
func (a *API) MaterialOptional(materialID, adzoneID, pageNo, pageSize int) (activityInfoGetResult []*OptimusMaterialResult, err error) {
|
||||
result, err := a.AccessAPI("taobao.tbk.dg.material.optional", false, map[string]interface{}{
|
||||
"material_id": materialID,
|
||||
"adzone_id": adzoneID,
|
||||
"page_no": pageNo,
|
||||
"page_size": pageSize,
|
||||
func (a *API) MaterialOptional(param *MaterialOptionalParam) (activityInfoGetResult []*MaterialOptionalResult, err error) {
|
||||
result, err := a.AccessAPI("taobao.tbk.dg.material.optional", false, utils.Struct2FlatMap(param))
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["result_list"], &activityInfoGetResult, false)
|
||||
}
|
||||
return activityInfoGetResult, err
|
||||
}
|
||||
|
||||
//商品链接转换
|
||||
func (a *API) ItemConvert(itemID int) (activityInfoGetResult []*OptimusMaterialResult, err error) {
|
||||
result, err := a.AccessAPI("taobao.tbk.item.convert", false, map[string]interface{}{
|
||||
"fields": "num_iid,click_url",
|
||||
"num_iids": utils.Int2Str(itemID),
|
||||
"adzone_id": JxAdzoneID,
|
||||
})
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["result_list"], &activityInfoGetResult, false)
|
||||
}
|
||||
return activityInfoGetResult, err
|
||||
}
|
||||
|
||||
//商品类目查询
|
||||
func (a *API) ItemcatsGet(itemID int) (activityInfoGetResult []*OptimusMaterialResult, err error) {
|
||||
result, err := a.AccessAPI("taobao.itemcats.get", false, map[string]interface{}{
|
||||
"parent_cid": 0,
|
||||
})
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["result_list"], &activityInfoGetResult, false)
|
||||
|
||||
@@ -12,3 +12,32 @@ func TestOptimusMaterial(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestMaterialOptional(t *testing.T) {
|
||||
result, err := api.MaterialOptional(&MaterialOptionalParam{
|
||||
AdzoneID: 111339100149,
|
||||
PageNo: 1,
|
||||
PageSize: 10,
|
||||
Cat: "",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestItemConvert(t *testing.T) {
|
||||
result, err := api.ItemConvert(42319524271)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestItemcatsGet(t *testing.T) {
|
||||
result, err := api.ItemcatsGet(0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user