From 28b52e4536738400b40d8edda8b55f7e757ddda9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Wed, 17 Jun 2020 15:21:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E=E9=A2=84?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=8C=B9=E9=85=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/jdapi/promotion_sku_test.go | 66 ++---------------------- platformapi/jdshopapi/jxshopapi_test.go | 2 +- platformapi/jdshopapi/store_page.go | 11 ++-- platformapi/jdshopapi/store_page_test.go | 13 +++-- platformapi/jdshopapi/store_test.go | 9 +++- 5 files changed, 27 insertions(+), 74 deletions(-) diff --git a/platformapi/jdapi/promotion_sku_test.go b/platformapi/jdapi/promotion_sku_test.go index 44eb1135..6130f431 100644 --- a/platformapi/jdapi/promotion_sku_test.go +++ b/platformapi/jdapi/promotion_sku_test.go @@ -78,68 +78,8 @@ func TestCreatePromotionSkuLimitTime(t *testing.T) { } func TestCancelPromotion(t *testing.T) { - promotionIDs := []int64{ - 24636389, - 24753178, - 24754087, - 24970355, - 24970383, - 24970389, - 25439508, - 25444342, - 25869363, - 25871946, - 26291079, - 27036663, - 27407558, - 27407649, - 27424152, - 27424181, - 27424247, - 27424568, - 27508490, - 27555133, - 27674289, - 30969372, - 41809699, - 41810076, - 41810296, - 41811111, - 44179379, - 54080816, - 54080829, - 54080842, - 55346987, - 55347123, - 55347340, - 55348499, - 55348706, - 55348999, - 55349177, - 56723852, - 56724283, - 56725840, - 56725955, - 56726053, - 60713479, - 60714768, - 60719242, - 68818338, - } - - for _, v := range promotionIDs { - promotionInfo, err := api.QueryPromotionInfo(v) - if err != nil { - t.Fatal(err) - } - // t.Log(promotionInfo.PromotionType) - if promotionInfo.PromotionType == PromotionTypeLimitedTime { - err = api.CancelPromotionLimitTime(v, "", utils.GetUUID()) - } else { - err = api.CancelPromotionSingle(v, "", utils.GetUUID()) - } - if err != nil { - t.Fatal(err) - } + err := api.CancelPromotionSingle(334831149, "", utils.GetUUID()) + if err != nil { + t.Fatal(err) } } diff --git a/platformapi/jdshopapi/jxshopapi_test.go b/platformapi/jdshopapi/jxshopapi_test.go index d417110c..d4dfbcd9 100644 --- a/platformapi/jdshopapi/jxshopapi_test.go +++ b/platformapi/jdshopapi/jxshopapi_test.go @@ -16,6 +16,6 @@ func init() { baseapi.Init(sugarLogger) api = New("de8157b447584885910f429011e49cb93yjq", "E1D746D42474D5F1F1A10CECE75D99F6", "efa7e1d1a22640fa990e6cf164b28608") api.SetCookieWithStr(` - thor=80FAF09E9A09B6E618A68057BDFCFCB81E6C186883AB46A9F4A4D44F89DF482B3B39F419A8731615D5DBB85B9F4595752D431AE9A98EF1EF640306D0A749B9CFECCD1AB4A086A54D885995E5B44BF3C8810880D168DFCF087B93ADC23F163D84CCEE1B79D0FF55AD9197DB0AAACB1DDFFE656ECA7BED9E1CD2720A0501358F4A2E7DC0D494E2F7347697EF19125EF3A3; + thor=80FAF09E9A09B6E618A68057BDFCFCB82CCFD5645F40A144C6CA92A0B84FE8EFE9869C996F2E8961897A27841241639DB35880508820C0CA9E10513471C69F54E4AB811C98D045B848501CAE165D62FEC731B43499E9A86C821179ED3A0B2D683E5472D06BF5D30DC8D029682A30858FC22FC228246002C368B0A689F25113A240E0B8EDB9D8C99915526D3E34C84A82; `) } diff --git a/platformapi/jdshopapi/store_page.go b/platformapi/jdshopapi/store_page.go index ecebde85..28b5af61 100644 --- a/platformapi/jdshopapi/store_page.go +++ b/platformapi/jdshopapi/store_page.go @@ -422,12 +422,11 @@ func (a *API) OrderDetail(orderId string) (orderDetailResult *OrderDetailResult, } if len(expectedDeliveredTime) > 0 { orderDetailResult.ExpectedDeliveredTime = expectedDeliveredTime[1][:strings.LastIndex(expectedDeliveredTime[1], "-")] + ":00" - if orderDetailResult.ExpectedDeliveredTime == "" { - expectedDeliveredTime2 := regexpOrderDetailDay2.FindStringSubmatch(body) - if len(expectedDeliveredTime2) > 0 { - times := strings.Split(expectedDeliveredTime2[1], ",") - orderDetailResult.ExpectedDeliveredTime = times[0] + " " + times[1][:strings.Index(times[1], ":")] + ":00:00" - } + } else { + expectedDeliveredTime2 := regexpOrderDetailDay2.FindStringSubmatch(body) + if len(expectedDeliveredTime2) > 0 { + times := strings.Split(expectedDeliveredTime2[1], ",") + orderDetailResult.ExpectedDeliveredTime = times[0] + " " + times[1][:strings.Index(times[1], ":")] + ":00:00" } } if len(actualPayPrice) > 0 { diff --git a/platformapi/jdshopapi/store_page_test.go b/platformapi/jdshopapi/store_page_test.go index 9d303b66..91c9d23e 100644 --- a/platformapi/jdshopapi/store_page_test.go +++ b/platformapi/jdshopapi/store_page_test.go @@ -70,7 +70,7 @@ func TestAllOrders(t *testing.T) { } func TestOrderDetail(t *testing.T) { - result, err := api.OrderDetail("117078663807") + result, err := api.OrderDetail("124350112427") if err != nil { t.Fatal(err) } @@ -102,8 +102,15 @@ func TestTryGetCookie(t *testing.T) { } func TestAAADS(t *testing.T) { - var s float64 = 200 - fmt.Println(strings.TrimRight(fmt.Sprintf("%.2f", s), "0.")) + var s = ` 配送日期: + 2020-06-17,13:00-14:00 +` + expectedDeliveredTime2 := regexpOrderDetailDay2.FindStringSubmatch(s) + if len(expectedDeliveredTime2) > 0 { + times := strings.Split(expectedDeliveredTime2[1], ",") + ss := times[0] + " " + times[1][:strings.Index(times[1], ":")] + ":00:00" + fmt.Println(ss) + } } func DecryptDESECB(d, key []byte) string { diff --git a/platformapi/jdshopapi/store_test.go b/platformapi/jdshopapi/store_test.go index 769146b9..5c258d93 100644 --- a/platformapi/jdshopapi/store_test.go +++ b/platformapi/jdshopapi/store_test.go @@ -2,6 +2,7 @@ package jdshopapi import ( "encoding/base64" + "fmt" "testing" "git.rosy.net.cn/baseapi/utils" @@ -63,7 +64,7 @@ func TestGetCounty(t *testing.T) { } func TestFindSkuSiteStock(t *testing.T) { - result, err := api.FindSkuSiteStock(24339305, 69353498265) + result, err := api.FindSkuSiteStock(24339305, 69353570679) if err != nil { t.Fatal(err) } @@ -93,3 +94,9 @@ func TestFindStoreInfoByExtStoreId(t *testing.T) { } t.Log(utils.Format4Output(result, false)) } + +func TestWIREHL(t *testing.T) { + data := "http://image.jxc4.com/image/f8578c9ee724408d514bbbfac3461142.tem.png" + res := base64.URLEncoding.EncodeToString([]byte(data)) + fmt.Println(res) +}