From 4e722b9a8537e9f6ca42c949be390c6ab89e0a0f Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Mon, 26 Apr 2021 14:13:08 +0800 Subject: [PATCH] =?UTF-8?q?pdd=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/pddapi/pdd_test.go | 2 +- platformapi/pddapi/union.go | 109 +++++++++++++++++++++++++++++++ platformapi/pddapi/union_test.go | 9 +++ 3 files changed, 119 insertions(+), 1 deletion(-) diff --git a/platformapi/pddapi/pdd_test.go b/platformapi/pddapi/pdd_test.go index b378ee6f..18e4df20 100644 --- a/platformapi/pddapi/pdd_test.go +++ b/platformapi/pddapi/pdd_test.go @@ -17,6 +17,6 @@ func init() { api = New("f9d95aaf5856485eabf39588f69a86de", "fa40c1fe356eebc1376ace1d2380ed44e553c602") api.SetCookieWithStr(` - t=948ba2dc83b4b34e02a9d87212e574a8; cna=A9cHGZw1jjgCAd3tly+uuYIG; account-path-guide-s1=true; 1172080007-payment-time=true; xlly_s=1; cookie2=1a1a1b2e0fdeaea7c73f238a708b2bd5; v=0; _tb_token_=7e385ebeee37e; alimamapwag=TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgNi4xOyBXaW42NDsgeDY0KSBBcHBsZVdlYktpdC81MzcuMzYgKEtIVE1MLCBsaWtlIEdlY2tvKSBDaHJvbWUvOTAuMC40NDMwLjg1IFNhZmFyaS81MzcuMzY%3D; cookie32=5887051fc70ab30be7a2655652e82dc6; alimamapw=RkAFUwICU1JQXAA%2BBw0GVlcDAAYGBwIEXVYBAgZUBA9RUQNTAABQUQZXAQY%3D; cookie31=MTE3MjA4MDAwNyxxcTM2NTE3NjI4NixmZW5nLnNoaUByb3N5Lm5ldC5jbixUQg%3D%3D; login=Vq8l%2BKCLz3%2F65A%3D%3D; isg=BCEhHCMG5XUeJUmGx-aU4ApDMO07zpXAI2znAoP2HSiH6kG8yx6lkE8oSB7sOS34; l=eB_opK6mjKn7XdlbBOfanurza77OSIRYYuPzaNbMiOCPOw1B5qD5W615yR86C3GVh6DMR3-XtET6BeYBqQAonxvTabLUOWMmn; tfstk=cqS5BpaGtbcW084E4TwqzMaD6QtdwgM6dzOlFNn8Yx8HAC1cwcR6wP_n9mL9h +api_uid=rBUUdWCCMreX52J0PKSxAg==; _crr=Sc9lQeJBDpG6Cf1Ae5AIwa0sZ40C0PUt; _bee=Sc9lQeJBDpG6Cf1Ae5AIwa0sZ40C0PUt; _f77=90467a51-270b-4cdf-9ac3-f41857c1c446; _a42=7253ac74-23d5-4ac7-a4cc-4897fd9f0f04; rcgk=Sc9lQeJBDpG6Cf1Ae5AIwa0sZ40C0PUt; rckk=Sc9lQeJBDpG6Cf1Ae5AIwa0sZ40C0PUt; ru1k=90467a51-270b-4cdf-9ac3-f41857c1c446; ru2k=7253ac74-23d5-4ac7-a4cc-4897fd9f0f04; _nano_fp=XpEalpgYnpTyX0PolT_Oq8RPIoS2CU18OBg0Nv2H; accesstoken=664839c54548f3710c9ceeef9b4371479854d2cdd4bbc; DDJB_PASS_ID=4328f6f7ab5fa4cc1617be1b8fc359b1; DDJB_LOGIN_SCENE=0 `) } diff --git a/platformapi/pddapi/union.go b/platformapi/pddapi/union.go index 2ac8423e..f22d6d5f 100644 --- a/platformapi/pddapi/union.go +++ b/platformapi/pddapi/union.go @@ -1,5 +1,7 @@ package pddapi +import "git.rosy.net.cn/baseapi/utils" + const ( cthMediaID = 9180924964 ) @@ -13,3 +15,110 @@ func (a *API) GoodsOPidGenerate(name string) (err error) { }) return err } + +type ActivityOperationListResult struct { + ID int `json:"id"` + Name string `json:"name"` + Starttime string `json:"startTime"` + Endtime string `json:"endTime"` + Description string `json:"description"` + Introduction string `json:"introduction"` + Level int `json:"level"` + Goodspoolid string `json:"goodsPoolId"` + Duoimage string `json:"duoImage"` + Bannerimage string `json:"bannerImage"` + Filename string `json:"fileName"` + Fileurl string `json:"fileUrl"` + Activitylink string `json:"activityLink"` + Cpscoverage int `json:"cpsCoverage"` + Activitystatus int `json:"activityStatus"` + Tagid int `json:"tagId"` + Goodslist []struct { + Mallid int `json:"mallId"` + Mallname string `json:"mallName"` + Malllogo interface{} `json:"mallLogo"` + Qrcodeimageurl interface{} `json:"qrCodeImageUrl"` + Merchanttype int `json:"merchantType"` + Hascltcpn bool `json:"hasCltCpn"` + Goodsid int64 `json:"goodsId"` + Goodssign string `json:"goodsSign"` + Goodsname string `json:"goodsName"` + Goodsdesc string `json:"goodsDesc"` + Goodsimageurl string `json:"goodsImageUrl"` + Goodsthumbnailurl string `json:"goodsThumbnailUrl"` + Mingroupprice int `json:"minGroupPrice"` + Categoryid int `json:"categoryId"` + Categoryname string `json:"categoryName"` + Goodstype int `json:"goodsType"` + Subsidyamount interface{} `json:"subsidyAmount"` + Haspddcoupon interface{} `json:"hasPddCoupon"` + Hascoupon bool `json:"hasCoupon"` + Couponminorderamount int `json:"couponMinOrderAmount"` + Coupondiscount int `json:"couponDiscount"` + Coupontotalquantity int `json:"couponTotalQuantity"` + Couponremainquantity int `json:"couponRemainQuantity"` + Couponstarttime int `json:"couponStartTime"` + Couponendtime int `json:"couponEndTime"` + Mallclientable bool `json:"mallClientAble"` + Plantype int `json:"planType"` + Plantypeisbest interface{} `json:"planTypeIsBest"` + Zsduoid int `json:"zsDuoId"` + Plantypeall int `json:"planTypeAll"` + Promotionrate int `json:"promotionRate"` + Activitypromotionrate interface{} `json:"activityPromotionRate"` + Sharerate int `json:"shareRate"` + Mallrate int `json:"mallRate"` + Optid int `json:"optId"` + Collected bool `json:"collected"` + Marketfee int `json:"marketFee"` + Salestip string `json:"salesTip"` + Desctxt string `json:"descTxt"` + Servtxt string `json:"servTxt"` + Lgsttxt string `json:"lgstTxt"` + Issceneauth interface{} `json:"isSceneAuth"` + Inbigsale []int `json:"inBigSale"` + Haohuocouponlist interface{} `json:"haohuoCouponList"` + Brandcouponlist []interface{} `json:"brandCouponList"` + Isonsale bool `json:"isOnsale"` + Isbijia bool `json:"isBiJia"` + Isextramissiongoods bool `json:"isExtraMissionGoods"` + Unifiedtag struct { + Goodsid int64 `json:"goodsId"` + Tagdtos []struct { + Groupcode int `json:"groupCode"` + Tagseries int `json:"tagSeries"` + Tagid int `json:"tagId"` + Text string `json:"text"` + Color string `json:"color"` + URL interface{} `json:"url"` + Prefiximageurl interface{} `json:"prefixImageUrl"` + Link interface{} `json:"link"` + Width interface{} `json:"width"` + Height interface{} `json:"height"` + } `json:"tagDTOs"` + Icondtos []interface{} `json:"iconDTOs"` + Highlightdtos []interface{} `json:"highLightDTOs"` + Rankdtos []interface{} `json:"rankDTOs"` + } `json:"unifiedTag"` + Matchtype int `json:"matchType"` + Goodsgalleryurls interface{} `json:"goodsGalleryUrls"` + Hasmaterial bool `json:"hasMaterial"` + Withfixedrate bool `json:"withFixedRate"` + Nextlevelpromotionrate int `json:"nextLevelPromotionRate"` + Nextlevelmarketfee int `json:"nextLevelMarketFee"` + Extrainfovo interface{} `json:"extraInfoVO"` + } `json:"goodsList"` +} + +//获取官方活动 +func (a *API) ActivityOperationList() (activityOperationListResult []*ActivityOperationListResult, err error) { + result, err := a.AccessStorePage("https://jinbao.pinduoduo.com/network/api/activity/operation/list", map[string]interface{}{ + "inPrepare": false, + "pageNumber": 1, + "pageSize": 9, + }, true) + if err == nil { + utils.Map2StructByJson(result["result"].(map[string]interface{})["list"], &activityOperationListResult, false) + } + return activityOperationListResult, err +} diff --git a/platformapi/pddapi/union_test.go b/platformapi/pddapi/union_test.go index 53cf791c..dbc440c9 100644 --- a/platformapi/pddapi/union_test.go +++ b/platformapi/pddapi/union_test.go @@ -1,6 +1,7 @@ package pddapi import ( + "git.rosy.net.cn/baseapi/utils" "testing" ) @@ -11,3 +12,11 @@ func TestGoodsOPidGenerate(t *testing.T) { } //t.Log(utils.Format4Output(result, false)) } + +func TestActivityOperationList(t *testing.T) { + result, err := api.ActivityOperationList() + if err != nil { + t.Fatal(err) + } + t.Log(utils.Format4Output(result, false)) +}