京东商城订单修改
This commit is contained in:
@@ -25,6 +25,10 @@ const (
|
|||||||
JdsStoreStatusOnline = 1
|
JdsStoreStatusOnline = 1
|
||||||
JdsStoreStatusDisable = 2
|
JdsStoreStatusDisable = 2
|
||||||
|
|
||||||
|
JdsOrderStatusPause = 5
|
||||||
|
JdsOrderStatusWaittingExport = 8
|
||||||
|
JdsOrderStatusWaittingPay = -2
|
||||||
|
|
||||||
CreateCatType = "3"
|
CreateCatType = "3"
|
||||||
UpdateCatType = "1"
|
UpdateCatType = "1"
|
||||||
|
|
||||||
@@ -52,6 +56,8 @@ const (
|
|||||||
JdsOtherMeatCatID = 15245
|
JdsOtherMeatCatID = 15245
|
||||||
JdsBeefCatID = 13582
|
JdsBeefCatID = 13582
|
||||||
JdsBeefLastCatID = 17902
|
JdsBeefLastCatID = 17902
|
||||||
|
|
||||||
|
JdsPayPercentage float64 = 0.97
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ func init() {
|
|||||||
baseapi.Init(sugarLogger)
|
baseapi.Init(sugarLogger)
|
||||||
api = New("de8157b447584885910f429011e49cb93yjq", "E1D746D42474D5F1F1A10CECE75D99F6", "efa7e1d1a22640fa990e6cf164b28608")
|
api = New("de8157b447584885910f429011e49cb93yjq", "E1D746D42474D5F1F1A10CECE75D99F6", "efa7e1d1a22640fa990e6cf164b28608")
|
||||||
api.SetCookieWithStr(`
|
api.SetCookieWithStr(`
|
||||||
thor=00513FC363111586B2C0E065A90E33C1356AC072AA79A28628FF01BE8B2903995775FF61D2F25840E8BAFB9ED95AF7978DAEDCE30A5A110010D64FEA48F85BB83677488A7432DE90F646CFF6D42A4BAD652ACAF7AE179C5C698CBB31F65EFECCAD53871820D05835E7F794768F7F046E75BE2E9350A2E78AC98970EEB4FCBD6EE51EF9DB61864A5777850F88564E7D42;
|
thor=00513FC363111586B2C0E065A90E33C12B3DB5AF76E18DEC4599554F59EFEB73FC0087764E39454B497E643E3FA637624CA63BEADEDBA6B21C79BC276EA4BBBAE97117AD7E5406A3C336B0DF5BDC8E247E0619CC24640201DBC9E1B2B4299675BD66F01F55A50E782904AAA3F75FA73E203988B3E04DB9D68FAA27BCDAAE08258D143E4E3FB374F6BB1EC9C4DA7BD548;
|
||||||
`)
|
`)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ func TestFindVendorCategories(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFindAttrs(t *testing.T) {
|
func TestFindAttrs(t *testing.T) {
|
||||||
result, err := api.FindAttrs(15245)
|
result, err := api.FindAttrs(13582)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ func TestFindAttrs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFindValuesByAttrId(t *testing.T) {
|
func TestFindValuesByAttrId(t *testing.T) {
|
||||||
result, no, err := api.FindValuesByAttrId(123060)
|
result, no, err := api.FindValuesByAttrId(150390)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ var (
|
|||||||
regexpOrderDetailTable = regexp.MustCompile(`<table id="receiveData">([\s\S]*?)</table>`)
|
regexpOrderDetailTable = regexp.MustCompile(`<table id="receiveData">([\s\S]*?)</table>`)
|
||||||
regexpOrderDetailTd = regexp.MustCompile(`<td colspan="2">(.*?)</td>`)
|
regexpOrderDetailTd = regexp.MustCompile(`<td colspan="2">(.*?)</td>`)
|
||||||
regexpOrderDetailMobile = regexp.MustCompile(`<span id="mobile">(.*?)</span>`)
|
regexpOrderDetailMobile = regexp.MustCompile(`<span id="mobile">(.*?)</span>`)
|
||||||
|
regexpOrderDetailDay = regexp.MustCompile(`<td class="pubwhite">配送日期:</td>[\s\S]*?<td colspan="2">(.*?)</td>`)
|
||||||
|
regexpOrderDetailPay = regexp.MustCompile(`<td class="pubwhite">应支付金额:</td>[\s\S]*?<td>[\s\S]*?¥(.*?[\s\S]*?)</td>`)
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -384,10 +386,11 @@ func (a *API) AllOrders(allOrdersParam *AllOrdersParam) (allOrdersResult *AllOrd
|
|||||||
}
|
}
|
||||||
|
|
||||||
type OrderDetailResult struct {
|
type OrderDetailResult struct {
|
||||||
ConsigneeName string `json:"consigneeName"`
|
ConsigneeName string `json:"consigneeName"`
|
||||||
ConsigneeAddress string `json:"consigneeAddress"`
|
ConsigneeAddress string `json:"consigneeAddress"`
|
||||||
ConsigneeMobile string `json:"consigneeMobile"`
|
ConsigneeMobile string `json:"consigneeMobile"`
|
||||||
OrderCreatedAt string `json:"orderCreatedAt"`
|
ExpectedDeliveredTime string `json:"expectedDeliveredTime"`
|
||||||
|
ActualPayPrice int64 `json:"actualPayPrice"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//订单详情
|
//订单详情
|
||||||
@@ -399,6 +402,8 @@ func (a *API) OrderDetail(orderId string) (orderDetailResult *OrderDetailResult,
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
orderDetailResult = &OrderDetailResult{}
|
orderDetailResult = &OrderDetailResult{}
|
||||||
body := result["fakeData"].(string)
|
body := result["fakeData"].(string)
|
||||||
|
expectedDeliveredTime := regexpOrderDetailDay.FindStringSubmatch(body)
|
||||||
|
actualPayPrice := regexpOrderDetailPay.FindStringSubmatch(body)
|
||||||
consigneeTable := regexpOrderDetailTable.FindStringSubmatch(body)
|
consigneeTable := regexpOrderDetailTable.FindStringSubmatch(body)
|
||||||
if len(consigneeTable) > 0 {
|
if len(consigneeTable) > 0 {
|
||||||
consigneeTd := regexpOrderDetailTd.FindAllStringSubmatch(consigneeTable[1], -1)
|
consigneeTd := regexpOrderDetailTd.FindAllStringSubmatch(consigneeTable[1], -1)
|
||||||
@@ -411,6 +416,13 @@ func (a *API) OrderDetail(orderId string) (orderDetailResult *OrderDetailResult,
|
|||||||
orderDetailResult.ConsigneeMobile = consigneeMobiles[1]
|
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
|
return orderDetailResult, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,13 +67,14 @@ func TestAllOrders(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestOrderDetail(t *testing.T) {
|
func TestOrderDetail(t *testing.T) {
|
||||||
// result1, result2, result3, err := api.OrderDetail("122367441996")
|
result, err := api.OrderDetail("117078663807")
|
||||||
// if err != nil {
|
if err != nil {
|
||||||
// t.Fatal(err)
|
t.Fatal(err)
|
||||||
// }
|
}
|
||||||
// fmt.Println("test1", result1, result2, result3)
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestBB(t *testing.T) {
|
func TestCC(t *testing.T) {
|
||||||
fmt.Println(utils.Str2Time("2020-05-30 00:00:00"))
|
fmt.Println(utils.Str2Float64("14.00
|
||||||
|
"))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user