京东物流
This commit is contained in:
@@ -20,6 +20,8 @@ const (
|
||||
JdsImgDescURL = `<img src=" //img10.360buyimg.com/imgzone/jfs/t1/111969/32/6692/171733/5ebbb9daE5bedb5b2/38350dca19e2b9d2.jpg" style="width: auto; height: auto; max-width: 100%;">`
|
||||
JdsStoreImg = "http://image.jxc4.com/image/2659335b16e3880e367759b8fc675933.tem.png"
|
||||
JdsStoreCategoryName = "pop-mendian-Selfdelivery"
|
||||
JdsMobileKey = "5a8f3244786ea9b8"
|
||||
JdsMobileToken = `j9ma4js4tphmu2ajmlr1590716634146mdnd~NmZeSyVEbFNSdH58dlVdAH50AAlpRHpTBiUjb35DFm5vLUROOBEzLUF7G28iAAFBKBgVFA1EPwIVKDclGENXbm8iVlQiAwpTTx1lKSsTCG5vfmsaZlRiQVodZWEYQwtub35rGmgCY0laIiF+JlRcBX4lBFppUGcUVSBweHYEC1AudwFaZwUuEz9jaxFmCB5fEWYNZHMANx0QJBtvaD1PWj4waxprOnQfBjYoPyAEHxw+LFhIfwwyXwAuKhFmTTEQPSprGms6dF4MMyMoNk4CQCkhRXw0EjcYDx1lYRhDHUYRZg1kcw4iBRMyfRFmTTEQPS1rGms6dEBVbXRhdk1fAGFwGw1nOnQMQW1lKCAFHlVvfhVeIVMhU09jJD5mW08KPjROVjQPIRNQdj4oNwUaQj50BktpFiACCTE0fDAPAloqJgAafUQ1U1ljKnk9GAxePi1aSihWZgZWOHV7PFBYC31wBwhmX2BGWnN2dTxUTx5vIERWc1x0RQEqcHUrUBgQYWZeS3NcdEBBbWUnLQJPCG99DgFoRCs=|~1591240251425~1~20200318~eyJ2aXdlIjoiMCIsImJhaW4iOnsiaWMiOiIxIiwibGUiOiIxMDAiLCJjdCI6IjAiLCJkdCI6ImkifX0=~1~-776~giiz|1d3o-m7,ki,m7,ki;gw4;1df8l-m8,u5,m8,u5;1d9-lc,tr,gu,d;1d7-ke,tc,fw,1i;1de-i3,sb,dl,h;1d8-gw,ru,ce,0;1d8-fs,rb,bb,g;1dg-db,qi,db,py;1d8-c2,q2,ax,8c;1d8-av,pl,u,2c;1d8-9u,p6,8,76;1dg-7x,ok,6i,6k;1d8-74,oa,5p,6a;1d8-6g,nx,50,1f;1d8-5q,no,4a,16;1dg-4h,ms,31,a;1d8-3u,mb,2f,4b;1d8-3a,lw,3,h;1d8-2q,li,1b,3;1dg-1r,kw,c,p;1d8-1l,ku,6,n;1d8-1i,ks,3,l;1d1l-1i,kt,3,m;1d7-1i,kv,3,o;1d8-1l,kv,6,o;1d8-1q,kw,b,p;1d8-1x,kw,i,p;1dg-2t,kw,1e,p;1d8-38,kw,1,p;1d9-3q,kw,j,p;1d4f-7k,l5,4d,y;1d15-7p,ld,4i,16;1d2v-7t,ls,g,d;bd2j-7t,ls,g,d;doei:,1,1,0,0,1,1000,-1000,1000,-1000;dmei:,1,1,1,1000,-1000,1000,-1000,1000,-1000;emc:,d:62;emmm:,d:28-0;emcf:,d:62;ivli:;iivl:;ivcvj:;scvje:;ewhi:;1591240230712,1591240251421,0,0,35,35,0,32,0,0,0;1gxs`
|
||||
|
||||
JdsStoreStatusRest = 6
|
||||
JdsStoreStatusOnline = 1
|
||||
|
||||
@@ -16,6 +16,6 @@ func init() {
|
||||
baseapi.Init(sugarLogger)
|
||||
api = New("de8157b447584885910f429011e49cb93yjq", "E1D746D42474D5F1F1A10CECE75D99F6", "efa7e1d1a22640fa990e6cf164b28608")
|
||||
api.SetCookieWithStr(`
|
||||
thor=00513FC363111586B2C0E065A90E33C12B3DB5AF76E18DEC4599554F59EFEB73FC0087764E39454B497E643E3FA637624CA63BEADEDBA6B21C79BC276EA4BBBAE97117AD7E5406A3C336B0DF5BDC8E247E0619CC24640201DBC9E1B2B4299675BD66F01F55A50E782904AAA3F75FA73E203988B3E04DB9D68FAA27BCDAAE08258D143E4E3FB374F6BB1EC9C4DA7BD548;
|
||||
thor=80FAF09E9A09B6E618A68057BDFCFCB81E6C186883AB46A9F4A4D44F89DF482B3B39F419A8731615D5DBB85B9F4595752D431AE9A98EF1EF640306D0A749B9CFECCD1AB4A086A54D885995E5B44BF3C8810880D168DFCF087B93ADC23F163D84CCEE1B79D0FF55AD9197DB0AAACB1DDFFE656ECA7BED9E1CD2720A0501358F4A2E7DC0D494E2F7347697EF19125EF3A3;
|
||||
`)
|
||||
}
|
||||
|
||||
@@ -13,11 +13,12 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
regexpOrderDetailTable = regexp.MustCompile(`<table id="receiveData">([\s\S]*?)</table>`)
|
||||
regexpOrderDetailTd = regexp.MustCompile(`<td colspan="2">(.*?)</td>`)
|
||||
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>`)
|
||||
regexpOrderDetailTable = regexp.MustCompile(`<table id="receiveData">([\s\S]*?)</table>`)
|
||||
regexpOrderDetailTd = regexp.MustCompile(`<td colspan="2">(.*?)</td>`)
|
||||
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>`)
|
||||
regexpOrderDetailMobileKey = regexp.MustCompile(`accesskey="(.*?)"`)
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -391,6 +392,7 @@ type OrderDetailResult struct {
|
||||
ConsigneeMobile string `json:"consigneeMobile"`
|
||||
ExpectedDeliveredTime string `json:"expectedDeliveredTime"`
|
||||
ActualPayPrice int64 `json:"actualPayPrice"`
|
||||
MobileKey string `json:"mobileKey"`
|
||||
}
|
||||
|
||||
//订单详情
|
||||
@@ -405,6 +407,7 @@ func (a *API) OrderDetail(orderId string) (orderDetailResult *OrderDetailResult,
|
||||
expectedDeliveredTime := regexpOrderDetailDay.FindStringSubmatch(body)
|
||||
actualPayPrice := regexpOrderDetailPay.FindStringSubmatch(body)
|
||||
consigneeTable := regexpOrderDetailTable.FindStringSubmatch(body)
|
||||
mobileKey := regexpOrderDetailMobileKey.FindStringSubmatch(body)
|
||||
if len(consigneeTable) > 0 {
|
||||
consigneeTd := regexpOrderDetailTd.FindAllStringSubmatch(consigneeTable[1], -1)
|
||||
consigneeMobiles := regexpOrderDetailMobile.FindStringSubmatch(consigneeTable[1])
|
||||
@@ -423,6 +426,24 @@ func (a *API) OrderDetail(orderId string) (orderDetailResult *OrderDetailResult,
|
||||
if len(actualPayPrice) > 0 {
|
||||
orderDetailResult.ActualPayPrice = utils.Float64TwoInt64(utils.Str2Float64(strings.TrimSpace(actualPayPrice[1])) * 100)
|
||||
}
|
||||
if len(mobileKey) > 0 {
|
||||
orderDetailResult.MobileKey = mobileKey[1]
|
||||
}
|
||||
}
|
||||
return orderDetailResult, err
|
||||
}
|
||||
|
||||
//尝试获取订单的真实手机号
|
||||
//https://https://neworder.shop.jd.com/order/json/phoneSensltiveInfo
|
||||
func (a *API) PhoneSensltiveInfo(orderId, accessKey string) (fakeMobile string, err error) {
|
||||
result, err := a.AccessStorePage("https://neworder.shop.jd.com/order/json/phoneSensltiveInfo", map[string]interface{}{
|
||||
"orderId": orderId,
|
||||
"accessKey": accessKey,
|
||||
"accessType": "0",
|
||||
"token": JdsMobileToken,
|
||||
}, true)
|
||||
if err == nil {
|
||||
fakeMobile = result["model"].(map[string]interface{})["phone"].(string)
|
||||
}
|
||||
return fakeMobile, err
|
||||
}
|
||||
|
||||
@@ -73,3 +73,11 @@ func TestOrderDetail(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestPhoneSensltiveInfo(t *testing.T) {
|
||||
result, err := api.PhoneSensltiveInfo("122792618177", "1e608a10060e75be7fc6c85645d6b2b7")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user