京东商城预订单匹配修改

This commit is contained in:
苏尹岚
2020-06-17 15:21:51 +08:00
parent 3d1c0b3ab0
commit 28b52e4536
5 changed files with 27 additions and 74 deletions

View File

@@ -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)
}
}

View File

@@ -16,6 +16,6 @@ func init() {
baseapi.Init(sugarLogger)
api = New("de8157b447584885910f429011e49cb93yjq", "E1D746D42474D5F1F1A10CECE75D99F6", "efa7e1d1a22640fa990e6cf164b28608")
api.SetCookieWithStr(`
thor=80FAF09E9A09B6E618A68057BDFCFCB81E6C186883AB46A9F4A4D44F89DF482B3B39F419A8731615D5DBB85B9F4595752D431AE9A98EF1EF640306D0A749B9CFECCD1AB4A086A54D885995E5B44BF3C8810880D168DFCF087B93ADC23F163D84CCEE1B79D0FF55AD9197DB0AAACB1DDFFE656ECA7BED9E1CD2720A0501358F4A2E7DC0D494E2F7347697EF19125EF3A3;
thor=80FAF09E9A09B6E618A68057BDFCFCB82CCFD5645F40A144C6CA92A0B84FE8EFE9869C996F2E8961897A27841241639DB35880508820C0CA9E10513471C69F54E4AB811C98D045B848501CAE165D62FEC731B43499E9A86C821179ED3A0B2D683E5472D06BF5D30DC8D029682A30858FC22FC228246002C368B0A689F25113A240E0B8EDB9D8C99915526D3E34C84A82;
`)
}

View File

@@ -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 {

View File

@@ -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 = ` <td class="pubwhite">配送日期:</td>
<td colspan="2">2020-06-17,13:00-14:00</td>
`
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 {

View File

@@ -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)
}