diff --git a/platformapi/jdshopapi/jdshopapi.go b/platformapi/jdshopapi/jdshopapi.go
index 5c245d21..24188b0b 100644
--- a/platformapi/jdshopapi/jdshopapi.go
+++ b/platformapi/jdshopapi/jdshopapi.go
@@ -25,6 +25,10 @@ const (
JdsStoreStatusOnline = 1
JdsStoreStatusDisable = 2
+ JdsOrderStatusPause = 5
+ JdsOrderStatusWaittingExport = 8
+ JdsOrderStatusWaittingPay = -2
+
CreateCatType = "3"
UpdateCatType = "1"
@@ -52,6 +56,8 @@ const (
JdsOtherMeatCatID = 15245
JdsBeefCatID = 13582
JdsBeefLastCatID = 17902
+
+ JdsPayPercentage float64 = 0.97
)
var (
diff --git a/platformapi/jdshopapi/jxshopapi_test.go b/platformapi/jdshopapi/jxshopapi_test.go
index 566034e9..a56ed79d 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=00513FC363111586B2C0E065A90E33C1356AC072AA79A28628FF01BE8B2903995775FF61D2F25840E8BAFB9ED95AF7978DAEDCE30A5A110010D64FEA48F85BB83677488A7432DE90F646CFF6D42A4BAD652ACAF7AE179C5C698CBB31F65EFECCAD53871820D05835E7F794768F7F046E75BE2E9350A2E78AC98970EEB4FCBD6EE51EF9DB61864A5777850F88564E7D42;
+ thor=00513FC363111586B2C0E065A90E33C12B3DB5AF76E18DEC4599554F59EFEB73FC0087764E39454B497E643E3FA637624CA63BEADEDBA6B21C79BC276EA4BBBAE97117AD7E5406A3C336B0DF5BDC8E247E0619CC24640201DBC9E1B2B4299675BD66F01F55A50E782904AAA3F75FA73E203988B3E04DB9D68FAA27BCDAAE08258D143E4E3FB374F6BB1EC9C4DA7BD548;
`)
}
diff --git a/platformapi/jdshopapi/sku_test.go b/platformapi/jdshopapi/sku_test.go
index e63cdfd2..dbfc107c 100644
--- a/platformapi/jdshopapi/sku_test.go
+++ b/platformapi/jdshopapi/sku_test.go
@@ -231,7 +231,7 @@ func TestFindVendorCategories(t *testing.T) {
}
func TestFindAttrs(t *testing.T) {
- result, err := api.FindAttrs(15245)
+ result, err := api.FindAttrs(13582)
if err != nil {
t.Fatal(err)
}
@@ -239,7 +239,7 @@ func TestFindAttrs(t *testing.T) {
}
func TestFindValuesByAttrId(t *testing.T) {
- result, no, err := api.FindValuesByAttrId(123060)
+ result, no, err := api.FindValuesByAttrId(150390)
if err != nil {
t.Fatal(err)
}
diff --git a/platformapi/jdshopapi/store_page.go b/platformapi/jdshopapi/store_page.go
index 988ecd8b..a258bfab 100644
--- a/platformapi/jdshopapi/store_page.go
+++ b/platformapi/jdshopapi/store_page.go
@@ -16,6 +16,8 @@ var (
regexpOrderDetailTable = regexp.MustCompile(`
`)
regexpOrderDetailTd = regexp.MustCompile(`(.*?) | `)
regexpOrderDetailMobile = regexp.MustCompile(`(.*?)`)
+ regexpOrderDetailDay = regexp.MustCompile(`配送日期: | [\s\S]*?(.*?) | `)
+ regexpOrderDetailPay = regexp.MustCompile(`应支付金额: | [\s\S]*?[\s\S]*?¥(.*?[\s\S]*?) | `)
)
const (
@@ -384,10 +386,11 @@ func (a *API) AllOrders(allOrdersParam *AllOrdersParam) (allOrdersResult *AllOrd
}
type OrderDetailResult struct {
- ConsigneeName string `json:"consigneeName"`
- ConsigneeAddress string `json:"consigneeAddress"`
- ConsigneeMobile string `json:"consigneeMobile"`
- OrderCreatedAt string `json:"orderCreatedAt"`
+ ConsigneeName string `json:"consigneeName"`
+ ConsigneeAddress string `json:"consigneeAddress"`
+ ConsigneeMobile string `json:"consigneeMobile"`
+ ExpectedDeliveredTime string `json:"expectedDeliveredTime"`
+ ActualPayPrice int64 `json:"actualPayPrice"`
}
//订单详情
@@ -399,6 +402,8 @@ func (a *API) OrderDetail(orderId string) (orderDetailResult *OrderDetailResult,
if err == nil {
orderDetailResult = &OrderDetailResult{}
body := result["fakeData"].(string)
+ expectedDeliveredTime := regexpOrderDetailDay.FindStringSubmatch(body)
+ actualPayPrice := regexpOrderDetailPay.FindStringSubmatch(body)
consigneeTable := regexpOrderDetailTable.FindStringSubmatch(body)
if len(consigneeTable) > 0 {
consigneeTd := regexpOrderDetailTd.FindAllStringSubmatch(consigneeTable[1], -1)
@@ -411,6 +416,13 @@ func (a *API) OrderDetail(orderId string) (orderDetailResult *OrderDetailResult,
orderDetailResult.ConsigneeMobile = consigneeMobiles[1]
}
}
+ if len(expectedDeliveredTime) > 0 {
+ times := strings.Split(expectedDeliveredTime[1], ",")
+ orderDetailResult.ExpectedDeliveredTime = times[0] + " " + times[1][:strings.Index(times[1], ":")] + ":30:00"
+ }
+ if len(actualPayPrice) > 0 {
+ orderDetailResult.ActualPayPrice = utils.Float64TwoInt64(utils.Str2Float64(strings.TrimSpace(actualPayPrice[1])) * 100)
+ }
}
return orderDetailResult, err
}
diff --git a/platformapi/jdshopapi/store_page_test.go b/platformapi/jdshopapi/store_page_test.go
index 81fd0989..352e1e55 100644
--- a/platformapi/jdshopapi/store_page_test.go
+++ b/platformapi/jdshopapi/store_page_test.go
@@ -67,13 +67,14 @@ func TestAllOrders(t *testing.T) {
}
func TestOrderDetail(t *testing.T) {
- // result1, result2, result3, err := api.OrderDetail("122367441996")
- // if err != nil {
- // t.Fatal(err)
- // }
- // fmt.Println("test1", result1, result2, result3)
+ result, err := api.OrderDetail("117078663807")
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Log(utils.Format4Output(result, false))
}
-func TestBB(t *testing.T) {
- fmt.Println(utils.Str2Time("2020-05-30 00:00:00"))
+func TestCC(t *testing.T) {
+ fmt.Println(utils.Str2Float64("14.00
+ "))
}