From 9aaf6d909178c1e4721749788497184a9e616978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 3 Aug 2020 16:50:39 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E6=9E=9C=E5=9B=AD=E7=B1=BB=E5=88=ABid?= =?UTF-8?q?=E5=8F=98=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/jcqapi/jcqapi.go | 2 +- platformapi/mtwmapi/retail.go | 2 +- platformapi/mtwmapi/retail_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platformapi/jcqapi/jcqapi.go b/platformapi/jcqapi/jcqapi.go index 81448118..df60761c 100644 --- a/platformapi/jcqapi/jcqapi.go +++ b/platformapi/jcqapi/jcqapi.go @@ -36,12 +36,12 @@ const ( var ( TopicList = []string{ "open_message_order_order_pay", //订单付款 - // "open_message_pop_order_remk_chg", //POP订单备注变更 // "open_message_pop_order_out", //POP订单出库 // "open_message_pop_order_create", //POP订单创建 // "open_message_pop_order_change", //POP订单变更消息 // "open_message_order_order_finish", //订单完成 "open_message_order_order_cancel", //订单取消 + // "open_message_pop_order_remk_chg", //POP订单备注变更 } ) diff --git a/platformapi/mtwmapi/retail.go b/platformapi/mtwmapi/retail.go index e3572c1c..4df0a05d 100644 --- a/platformapi/mtwmapi/retail.go +++ b/platformapi/mtwmapi/retail.go @@ -21,7 +21,7 @@ const ( ) const ( - MtwmSkuAttr200002727 = `[{"attrId":1200000094,"attrName":"产地","valueList":[{"valueId":100000050,"value":"中国"}]},{"attrId":1200000132,"attrName":"国产/进口","valueList":[{"valueId":1300000003,"value":"国产"}]},{"attrId":1200000210,"attrName":"商品类别","valueList":[{"valueId":1300002991,"value":"水果混合切片"}]},{"attrId":1200000275,"attrName":"是否有机","valueList":[{"valueId":1300003874,"value":"无机"}]},{"attrId":1200000286,"attrName":"果品品牌","valueList":[{"valueId":1300003944,"value":"其他品牌"}]}]` + MtwmSkuAttr200002727 = `[{"attrId":1200000094,"attrName":"产地","valueList":[{"valueId":100000050,"value":"中国"}]},{"attrId":100001573,"attrName":"国产/进口","valueList":[{"valueId":100004788,"value":"国产"}]},{"attrId":1200000210,"attrName":"商品类别","valueList":[{"valueId":1300002991,"value":"水果混合切片"}]},{"attrId":100002401,"attrName":"是否有机","valueList":[{"valueId":100006169,"value":"无机"}]},{"attrId":100002085,"attrName":"果品品牌","valueList":[{"valueId":100006421,"value":"其他品牌"}]}]` MtwmSkuAttr200001555 = `[{"attrId":1200000088,"attrName":"品牌","valueList":[{"valueId":1002998,"value":"伊利"}]},{"attrId":1200000210,"attrName":"商品类别","valueList":[{"valueId":1300001219,"value":"冰激凌"}]}]` MtwmSkuAttr200002728 = `[{"attrId":1200000088,"attrName":"品牌","valueList":[{"valueId":1000001,"value":"其他品牌"}]},{"attrId":1200000094,"attrName":"产地","valueList":[{"valueId":100000050,"value":"中国"}]},{"attrId":1200000132,"attrName":"国产/进口","valueList":[{"valueId":1300000003,"value":"国产"}]},{"attrId":1200000275,"attrName":"是否有机","valueList":[{"valueId":1300003874,"value":"无机"}]},{"attrId":1200000286,"attrName":"果品品牌","valueList":[{"valueId":1300003944,"value":"其他品牌"}]},{"attrId":1200000210,"attrName":"商品类别","valueList":[{"valueId":1300003869,"value":"其他果捞"}]}]` //200001519 diff --git a/platformapi/mtwmapi/retail_test.go b/platformapi/mtwmapi/retail_test.go index 65a6af3d..b1131ee7 100644 --- a/platformapi/mtwmapi/retail_test.go +++ b/platformapi/mtwmapi/retail_test.go @@ -286,7 +286,7 @@ func TestRetailSellStatus(t *testing.T) { } func TestCategoryAttrList(t *testing.T) { - result, err := api.CategoryAttrList(200002728) + result, err := api.CategoryAttrList(200002727) if err != nil { t.Fatal(err) } From 21b7e204694987359c068a111e15f6ceaddafea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 4 Aug 2020 13:34:26 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E6=AF=94=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/jdshopapi/jdshopapi.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformapi/jdshopapi/jdshopapi.go b/platformapi/jdshopapi/jdshopapi.go index fd729689..e5f86575 100644 --- a/platformapi/jdshopapi/jdshopapi.go +++ b/platformapi/jdshopapi/jdshopapi.go @@ -62,7 +62,7 @@ const ( JdsBeefCatID = 13582 JdsBeefLastCatID = 17902 - JdsPayPercentage float64 = 0.97 + JdsPayPercentage float64 = 0.94 ) var ( From 6da48a714462d45891a00721a4569b36a729b73a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Tue, 4 Aug 2020 15:37:53 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E7=BE=8E=E5=9B=A2=E6=81=B6=E5=BF=83?= =?UTF-8?q?=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/mtwmapi/retail.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformapi/mtwmapi/retail.go b/platformapi/mtwmapi/retail.go index 4df0a05d..e3572c1c 100644 --- a/platformapi/mtwmapi/retail.go +++ b/platformapi/mtwmapi/retail.go @@ -21,7 +21,7 @@ const ( ) const ( - MtwmSkuAttr200002727 = `[{"attrId":1200000094,"attrName":"产地","valueList":[{"valueId":100000050,"value":"中国"}]},{"attrId":100001573,"attrName":"国产/进口","valueList":[{"valueId":100004788,"value":"国产"}]},{"attrId":1200000210,"attrName":"商品类别","valueList":[{"valueId":1300002991,"value":"水果混合切片"}]},{"attrId":100002401,"attrName":"是否有机","valueList":[{"valueId":100006169,"value":"无机"}]},{"attrId":100002085,"attrName":"果品品牌","valueList":[{"valueId":100006421,"value":"其他品牌"}]}]` + MtwmSkuAttr200002727 = `[{"attrId":1200000094,"attrName":"产地","valueList":[{"valueId":100000050,"value":"中国"}]},{"attrId":1200000132,"attrName":"国产/进口","valueList":[{"valueId":1300000003,"value":"国产"}]},{"attrId":1200000210,"attrName":"商品类别","valueList":[{"valueId":1300002991,"value":"水果混合切片"}]},{"attrId":1200000275,"attrName":"是否有机","valueList":[{"valueId":1300003874,"value":"无机"}]},{"attrId":1200000286,"attrName":"果品品牌","valueList":[{"valueId":1300003944,"value":"其他品牌"}]}]` MtwmSkuAttr200001555 = `[{"attrId":1200000088,"attrName":"品牌","valueList":[{"valueId":1002998,"value":"伊利"}]},{"attrId":1200000210,"attrName":"商品类别","valueList":[{"valueId":1300001219,"value":"冰激凌"}]}]` MtwmSkuAttr200002728 = `[{"attrId":1200000088,"attrName":"品牌","valueList":[{"valueId":1000001,"value":"其他品牌"}]},{"attrId":1200000094,"attrName":"产地","valueList":[{"valueId":100000050,"value":"中国"}]},{"attrId":1200000132,"attrName":"国产/进口","valueList":[{"valueId":1300000003,"value":"国产"}]},{"attrId":1200000275,"attrName":"是否有机","valueList":[{"valueId":1300003874,"value":"无机"}]},{"attrId":1200000286,"attrName":"果品品牌","valueList":[{"valueId":1300003944,"value":"其他品牌"}]},{"attrId":1200000210,"attrName":"商品类别","valueList":[{"valueId":1300003869,"value":"其他果捞"}]}]` //200001519 From 724b92c21c90425ea0e0767051a107f2c47f7ca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 7 Aug 2020 09:56:58 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/jdshopapi/order.go | 2 +- platformapi/jdshopapi/store_page_test.go | 18 +++++++++--------- platformapi/mtpsapi/shop_test.go | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/platformapi/jdshopapi/order.go b/platformapi/jdshopapi/order.go index 576bf368..591d6837 100644 --- a/platformapi/jdshopapi/order.go +++ b/platformapi/jdshopapi/order.go @@ -105,7 +105,7 @@ func (a *API) GetOrder(orderID int64, isStatus bool) (getOrderResult *GetOrderRe params["optional_fields"] = `orderType,payType,orderTotalPrice,orderSellerPrice, orderPayment,freightPrice,orderState,orderStateRemark, orderStartTime,orderEndTime,orderRemark,consigneeInfo, - itemInfoList,pauseBizInfo,pin,idSopShipmenttype` + itemInfoList,pauseBizInfo,pin,idSopShipmenttype,scDT` if isStatus { params["order_state"] = "WAIT_SELLER_STOCK_OUT,PAUSE,TRADE_CANCELED" } diff --git a/platformapi/jdshopapi/store_page_test.go b/platformapi/jdshopapi/store_page_test.go index bbe707ef..57151748 100644 --- a/platformapi/jdshopapi/store_page_test.go +++ b/platformapi/jdshopapi/store_page_test.go @@ -43,16 +43,16 @@ func TestNewInfoList(t *testing.T) { } func Test11(t *testing.T) { - type StrA struct { - Cat string `json:"cat"` - Dog int `json:"dog,omitempty"` - Mouse int `json:"mouse"` + change := func(s ...string) { + s[0] = "Go" + s = append(s, "playground") + fmt.Println(s) } - a := &StrA{ - Cat: "加菲", - } - fmt.Println(utils.Format4Output(a, false)) - fmt.Println(a.Dog == 0, a.Mouse) + + welcome := []string{"hello", "world"} + change(welcome...) + fmt.Println(welcome) + } func TestAllOrders(t *testing.T) { diff --git a/platformapi/mtpsapi/shop_test.go b/platformapi/mtpsapi/shop_test.go index 99732a22..4b307bc5 100644 --- a/platformapi/mtpsapi/shop_test.go +++ b/platformapi/mtpsapi/shop_test.go @@ -18,7 +18,7 @@ func TestShopQuery(t *testing.T) { // if err == nil { // t.Fatal("应该报错找不到门店") // } - shopInfo, err := api.ShopQuery("11732425") + shopInfo, err := api.ShopQuery("667446") if err != nil { t.Fatal(err) } From 59e0b131c12c203336b9c70ee17f30a36f7658ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 7 Aug 2020 10:01:55 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E4=B8=8D=E6=9F=A5=E6=9A=82=E5=81=9C?= =?UTF-8?q?=E7=9A=84=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/jdshopapi/order.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformapi/jdshopapi/order.go b/platformapi/jdshopapi/order.go index 591d6837..fb609036 100644 --- a/platformapi/jdshopapi/order.go +++ b/platformapi/jdshopapi/order.go @@ -107,7 +107,7 @@ func (a *API) GetOrder(orderID int64, isStatus bool) (getOrderResult *GetOrderRe orderStartTime,orderEndTime,orderRemark,consigneeInfo, itemInfoList,pauseBizInfo,pin,idSopShipmenttype,scDT` if isStatus { - params["order_state"] = "WAIT_SELLER_STOCK_OUT,PAUSE,TRADE_CANCELED" + params["order_state"] = "WAIT_SELLER_STOCK_OUT,TRADE_CANCELED" } result, err := a.AccessAPI("jingdong.pop.order.get", prodURL, params) if err == nil { From cf720c965c581c26af055e78cca9dead2832003e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 10 Aug 2020 09:36:57 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E9=A5=BF=E7=99=BE=E7=9A=84=E8=AF=84?= =?UTF-8?q?=E4=BB=B7=E5=B0=9D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/ebaiapi/store_page.go | 2 +- platformapi/jdshopapi/order.go | 19 ++++++++++++++++++- platformapi/jdshopapi/order_test.go | 8 ++++++++ platformapi/mtwmapi/order_test.go | 4 ++-- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/platformapi/ebaiapi/store_page.go b/platformapi/ebaiapi/store_page.go index 88d488ae..2fbeecd5 100644 --- a/platformapi/ebaiapi/store_page.go +++ b/platformapi/ebaiapi/store_page.go @@ -782,7 +782,7 @@ func (a *API) getCommentList(isElm bool, fromTime, toTime time.Time, shopID, sup } func (a *API) GetEleCommentList(fromTime, toTime time.Time, shopID, supplierID string, replyStatus, level, nonEmpty int) (commentList []map[string]interface{}, err error) { - return a.getCommentList(true, fromTime, toTime, shopID, supplierID, replyStatus, level, nonEmpty) + return a.getCommentList(false, fromTime, toTime, shopID, supplierID, replyStatus, level, nonEmpty) } func (a *API) GetCommentList(fromTime, toTime time.Time, shopID, supplierID string, replyStatus, level, nonEmpty int) (commentList []map[string]interface{}, err error) { diff --git a/platformapi/jdshopapi/order.go b/platformapi/jdshopapi/order.go index fb609036..e430cf50 100644 --- a/platformapi/jdshopapi/order.go +++ b/platformapi/jdshopapi/order.go @@ -16,6 +16,8 @@ const ( OrderStatusPause = "PAUSE" OrderStatusWait = "WAIT_SELLER_STOCK_OUT" OrderStatusCancel = "TRADE_CANCELED" + + IdSopShipmenttypeTC = "71" //同城配送,需要调其他接口获取期望送货时间 ) //订单出库 @@ -105,7 +107,7 @@ func (a *API) GetOrder(orderID int64, isStatus bool) (getOrderResult *GetOrderRe params["optional_fields"] = `orderType,payType,orderTotalPrice,orderSellerPrice, orderPayment,freightPrice,orderState,orderStateRemark, orderStartTime,orderEndTime,orderRemark,consigneeInfo, - itemInfoList,pauseBizInfo,pin,idSopShipmenttype,scDT` + itemInfoList,pauseBizInfo,pin,idSopShipmenttype` if isStatus { params["order_state"] = "WAIT_SELLER_STOCK_OUT,TRADE_CANCELED" } @@ -218,3 +220,18 @@ func (a *API) KeyGet() (keyGetResult *KeyGetResult, err error) { } return keyGetResult, err } + +//获取期望送货时间 +func (a *API) GetOrderExtInfoByOrderId() (err error) { + _, err = a.AccessAPI("jingdong.pop.order.getOrderExtInfoByOrderId", prodURL, map[string]interface{}{ + "orderId": "124162661622", + }) + if err == nil { + // data, err2 := base64.StdEncoding.DecodeString(result["jingdong_jos_voucher_info_get_responce"].(map[string]interface{})["response"].(map[string]interface{})["data"].(map[string]interface{})["voucher"].(string)) + // if err2 == nil { + // json.Unmarshal(data, &voucherInfoGetResult) + // } + // err = err2 + } + return err +} diff --git a/platformapi/jdshopapi/order_test.go b/platformapi/jdshopapi/order_test.go index 65fc3cc7..da8306fe 100644 --- a/platformapi/jdshopapi/order_test.go +++ b/platformapi/jdshopapi/order_test.go @@ -45,3 +45,11 @@ func TestKeyGet(t *testing.T) { } t.Log(utils.Format4Output(result, false)) } + +func TestGetOrderExtInfoByOrderId(t *testing.T) { + err := api.GetOrderExtInfoByOrderId() + if err != nil { + t.Fatal(err) + } + // t.Log(utils.Format4Output(result, false)) +} diff --git a/platformapi/mtwmapi/order_test.go b/platformapi/mtwmapi/order_test.go index 207afabb..b8ba09fa 100644 --- a/platformapi/mtwmapi/order_test.go +++ b/platformapi/mtwmapi/order_test.go @@ -16,7 +16,7 @@ func TestOrderViewStatus(t *testing.T) { } func TestOrderGetOrderDetail(t *testing.T) { - result, err := api.OrderGetOrderDetail(69760842061320598, false) + result, err := api.OrderGetOrderDetail(73322892924405911, false) if err != nil { t.Fatal(err) } @@ -27,7 +27,7 @@ func TestOrderGetOrderDetail(t *testing.T) { } func TestOrderGetOrderDetail2(t *testing.T) { - result, err := api.OrderGetOrderDetail2(69760842061320598, false) + result, err := api.OrderGetOrderDetail2(73322892924405911, false) if err != nil { t.Fatal(err) } From 21a579681f824bd9316e5eda9557d19a401537a4 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, 12 Aug 2020 09:17:26 +0800 Subject: [PATCH 07/11] bug --- platformapi/ebaiapi/store_page.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformapi/ebaiapi/store_page.go b/platformapi/ebaiapi/store_page.go index 2fbeecd5..74d8e2a1 100644 --- a/platformapi/ebaiapi/store_page.go +++ b/platformapi/ebaiapi/store_page.go @@ -760,7 +760,7 @@ func (a *API) getCommentList(isElm bool, fromTime, toTime time.Time, shopID, sup for { params["page_num"] = pageNo retVal, err2 := a.AccessStorePage(fixedURL, "", params, false) - if err = err2; err == nil { + if err = err2; err == nil && retVal != nil { for _, comment := range retVal["comment_list"].([]interface{}) { commentMap := comment.(map[string]interface{}) for _, orderComment := range commentMap["order_commentList"].([]interface{}) { From 0980b46796e279edf7414c34d66bbc4b884c99e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 11:28:24 +0800 Subject: [PATCH 08/11] jdshop orde --- platformapi/dadaapi/shop_test.go | 5 ++-- platformapi/jdshopapi/callback.go | 39 +++++++++++++------------ platformapi/jdshopapi/order.go | 31 ++++++++++++++------ platformapi/jdshopapi/order_test.go | 4 +-- platformapi/weixinapi/weixinapi_test.go | 2 +- 5 files changed, 47 insertions(+), 34 deletions(-) diff --git a/platformapi/dadaapi/shop_test.go b/platformapi/dadaapi/shop_test.go index 418da217..87acdab6 100644 --- a/platformapi/dadaapi/shop_test.go +++ b/platformapi/dadaapi/shop_test.go @@ -37,9 +37,8 @@ func TestShopAdd(t *testing.T) { func TestShopUpdate(t *testing.T) { shopInfo := &ShopInfo{ - OriginShopID: "18180948107", - StationName: "京西大本营234", - CityName: "包头市", + OriginShopID: "666872", + Status: 1, } err := dadaapi.ShopUpdate(shopInfo) if err != nil { diff --git a/platformapi/jdshopapi/callback.go b/platformapi/jdshopapi/callback.go index 40279a09..21875810 100644 --- a/platformapi/jdshopapi/callback.go +++ b/platformapi/jdshopapi/callback.go @@ -9,25 +9,26 @@ import ( ) type CallBackResult struct { - OrderStateRemark string `json:"orderStateRemark"` - OrderRemark string `json:"orderRemark"` - OrderSellerPrice string `json:"orderSellerPrice"` - OrderState string `json:"orderState"` - OrderType string `json:"orderType"` - OrderPayment string `json:"orderPayment"` - PayType string `json:"payType"` - StoreID string `json:"storeId"` - OrderTotalPrice string `json:"orderTotalPrice"` - OrderExt string `json:"orderExt"` - StoreOrder string `json:"storeOrder"` - OrderStartTime string `json:"orderStartTime"` - OrderID string `json:"orderId"` - OrderSource string `json:"orderSource"` - FreightPrice string `json:"freightPrice"` - MsgType string `json:"msgType"` - Pin string `json:"pin"` - ConsigneeInfo *CallBackConsigneeInfo `json:"consigneeInfo"` - ItemInfoList []*CallBackItemInfoList `json:"itemInfoList"` + OrderStateRemark string `json:"orderStateRemark"` + OrderRemark string `json:"orderRemark"` + OrderSellerPrice string `json:"orderSellerPrice"` + OrderState string `json:"orderState"` + OrderType string `json:"orderType"` + OrderPayment string `json:"orderPayment"` + PayType string `json:"payType"` + StoreID string `json:"storeId"` + OrderTotalPrice string `json:"orderTotalPrice"` + OrderExt string `json:"orderExt"` + StoreOrder string `json:"storeOrder"` + OrderStartTime string `json:"orderStartTime"` + OrderID string `json:"orderId"` + OrderSource string `json:"orderSource"` + FreightPrice string `json:"freightPrice"` + MsgType string `json:"msgType"` + Pin string `json:"pin"` + IDSopShipmenttype string `json:"idSopShipmenttype"` + ConsigneeInfo *CallBackConsigneeInfo `json:"consigneeInfo"` + ItemInfoList []*CallBackItemInfoList `json:"itemInfoList"` } type CallBackConsigneeInfo struct { diff --git a/platformapi/jdshopapi/order.go b/platformapi/jdshopapi/order.go index e430cf50..bd6156f5 100644 --- a/platformapi/jdshopapi/order.go +++ b/platformapi/jdshopapi/order.go @@ -6,6 +6,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "strings" "time" "git.rosy.net.cn/baseapi/utils" @@ -221,17 +222,29 @@ func (a *API) KeyGet() (keyGetResult *KeyGetResult, err error) { return keyGetResult, err } +type GetOrderExtInfoByOrderIdResult struct { + IDSopShipmentType string `json:"idSopShipmentType"` + OrderCreateDate string `json:"orderCreateDate"` + CodDate string `json:"codDate"` + SelectedItem string `json:"selectedItem"` + Batch string `json:"batch"` + DeliveryCodTime string `json:"deliveryCodTime"` + Speedhour string `json:"Speedhour"` +} + //获取期望送货时间 -func (a *API) GetOrderExtInfoByOrderId() (err error) { - _, err = a.AccessAPI("jingdong.pop.order.getOrderExtInfoByOrderId", prodURL, map[string]interface{}{ - "orderId": "124162661622", +func (a *API) GetOrderExtInfoByOrderId(orderId string) (time string, err error) { + getOrderExtInfoByOrderIdResult := &GetOrderExtInfoByOrderIdResult{} + result, err := a.AccessAPI("jingdong.pop.order.getOrderExtInfoByOrderId", prodURL, map[string]interface{}{ + "orderId": orderId, + "searchFileds": "deliveryInfo", }) if err == nil { - // data, err2 := base64.StdEncoding.DecodeString(result["jingdong_jos_voucher_info_get_responce"].(map[string]interface{})["response"].(map[string]interface{})["data"].(map[string]interface{})["voucher"].(string)) - // if err2 == nil { - // json.Unmarshal(data, &voucherInfoGetResult) - // } - // err = err2 + str := strings.ReplaceAll(result["jingdong_pop_order_getOrderExtInfoByOrderId_responce"].(map[string]interface{})["orderExtraInfoResultModel"].(map[string]interface{})["resultMap"].(map[string]interface{})["deliveryInfo"].(string), "\\", "") + err = json.Unmarshal([]byte(str), &getOrderExtInfoByOrderIdResult) + exTime := strings.Split(getOrderExtInfoByOrderIdResult.DeliveryCodTime, ",") + exTime2 := strings.Split(exTime[1], "-") + time = exTime[0] + " " + exTime2[1] + ":00" } - return err + return time, err } diff --git a/platformapi/jdshopapi/order_test.go b/platformapi/jdshopapi/order_test.go index da8306fe..8cdc8efd 100644 --- a/platformapi/jdshopapi/order_test.go +++ b/platformapi/jdshopapi/order_test.go @@ -47,9 +47,9 @@ func TestKeyGet(t *testing.T) { } func TestGetOrderExtInfoByOrderId(t *testing.T) { - err := api.GetOrderExtInfoByOrderId() + result, err := api.GetOrderExtInfoByOrderId("") if err != nil { t.Fatal(err) } - // t.Log(utils.Format4Output(result, false)) + t.Log(utils.Format4Output(result, false)) } diff --git a/platformapi/weixinapi/weixinapi_test.go b/platformapi/weixinapi/weixinapi_test.go index 244bebab..40368bfb 100644 --- a/platformapi/weixinapi/weixinapi_test.go +++ b/platformapi/weixinapi/weixinapi_test.go @@ -26,7 +26,7 @@ func init() { // prod api = New("wx2bb99eb5d2c9b82c", "6bbbed1443cc062c20a015a64c07a531") - api.CBSetToken("35_1ilNtBtqXwojmsYWgzpjn8Nn-1DuOfy0rTcsIuRz5RqXAcJRYCmcFP0oBQR6N6dBm6lOvg7j7O-YMKh_--zfbJ_4hBCfBbvI7svoeIc3l4W_UHA41LyT_asp731YpNKA9oRWkg0ftTJj0rHwLEDhAHAUNM") + api.CBSetToken("36_un9YOYENTdiNi4TVoDfrb2oiiU9XSugSgbm0B-uJ4TbhVk543aOi5UcBgYcujsCZ1gyCIMDbaKCON7oWMHtHRLCg1P2KzjRhxU3KoVbNZ04PPzdDOXStnigkoSLTxv-y9pbenFP0kHYHUeRHQEUeAHAJXN") } func handleError(t *testing.T, err error) { From f294d50a08d5c1084fe9e16b2d1b666143c5ce67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Thu, 13 Aug 2020 16:48:03 +0800 Subject: [PATCH 09/11] yujishijian --- platformapi/jdshopapi/order.go | 23 ++++++++++++++--------- platformapi/jdshopapi/order_test.go | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/platformapi/jdshopapi/order.go b/platformapi/jdshopapi/order.go index bd6156f5..fec13e2b 100644 --- a/platformapi/jdshopapi/order.go +++ b/platformapi/jdshopapi/order.go @@ -223,13 +223,14 @@ func (a *API) KeyGet() (keyGetResult *KeyGetResult, err error) { } type GetOrderExtInfoByOrderIdResult struct { - IDSopShipmentType string `json:"idSopShipmentType"` - OrderCreateDate string `json:"orderCreateDate"` - CodDate string `json:"codDate"` - SelectedItem string `json:"selectedItem"` - Batch string `json:"batch"` - DeliveryCodTime string `json:"deliveryCodTime"` - Speedhour string `json:"Speedhour"` + IDSopShipmentType string `json:"idSopShipmentType"` + OrderCreateDate string `json:"orderCreateDate"` + CodDate string `json:"codDate"` + SelectedItem string `json:"selectedItem"` + Batch string `json:"batch"` + DeliveryCodTime string `json:"deliveryCodTime"` + Speedhour string `json:"Speedhour"` + FinalDelieveredTime string `json:"finalDelieveredTime"` } //获取期望送货时间 @@ -243,8 +244,12 @@ func (a *API) GetOrderExtInfoByOrderId(orderId string) (time string, err error) str := strings.ReplaceAll(result["jingdong_pop_order_getOrderExtInfoByOrderId_responce"].(map[string]interface{})["orderExtraInfoResultModel"].(map[string]interface{})["resultMap"].(map[string]interface{})["deliveryInfo"].(string), "\\", "") err = json.Unmarshal([]byte(str), &getOrderExtInfoByOrderIdResult) exTime := strings.Split(getOrderExtInfoByOrderIdResult.DeliveryCodTime, ",") - exTime2 := strings.Split(exTime[1], "-") - time = exTime[0] + " " + exTime2[1] + ":00" + if len(exTime) < 2 { + time = getOrderExtInfoByOrderIdResult.FinalDelieveredTime + } else { + exTime2 := strings.Split(exTime[1], "-") + time = exTime[0] + " " + exTime2[1] + ":00" + } } return time, err } diff --git a/platformapi/jdshopapi/order_test.go b/platformapi/jdshopapi/order_test.go index 8cdc8efd..c1ec31f2 100644 --- a/platformapi/jdshopapi/order_test.go +++ b/platformapi/jdshopapi/order_test.go @@ -47,7 +47,7 @@ func TestKeyGet(t *testing.T) { } func TestGetOrderExtInfoByOrderId(t *testing.T) { - result, err := api.GetOrderExtInfoByOrderId("") + result, err := api.GetOrderExtInfoByOrderId("130427633633") if err != nil { t.Fatal(err) } From 9a07035b58a85f06e5edaeeb83af7a3b35050817 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 14 Aug 2020 17:21:21 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E7=BD=AE=E9=A1=B6?= =?UTF-8?q?=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- platformapi/jdapi/jdapi_test.go | 2 +- platformapi/jdapi/store_page.go | 28 ++++++++++++++++++++++++++++ platformapi/jdapi/store_page_test.go | 9 +++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/platformapi/jdapi/jdapi_test.go b/platformapi/jdapi/jdapi_test.go index 7722474e..e16601cb 100644 --- a/platformapi/jdapi/jdapi_test.go +++ b/platformapi/jdapi/jdapi_test.go @@ -28,7 +28,7 @@ func init() { // api = New("c45e6510-00ba-4be2-977e-bcb9c9792cc7", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26") // const cookieValue = "YYJV3NHVBPHLD36FWP6F3EM5PTXJ2XZQS7U4HWRIDPP4IWGUKUIB4XG5N26CZRDLDF7PKOXBPD6BNTUAJLETLZOIWMCVFI3K6MYZIY4QBIXIMXYDJNUKFGJVQTN5356SAD6WPCIHWNQAG7DDMF7L7S3SHCT3RM3CQG7IJIPUQ3THS5UIUYWMKINM7ETUOQB7OBPOPZVCT3ZJY55243TDVXLO25PP4UYSPTTPMNQ7HPMWOJKJ3BJWGVHD243MXH7NZWW264TKN5UOCJBSSSOKD2QQII" - const cookieValue = "YYJV3NHVBPHLD36FWP6F3EM5PTXJ2XZQS7U4HWRIDPP4IWGUKUIB4XG5N26CZRDLDF7PKOXBPD6BNTUAJLETLZOIWMCVFI3K6MYZIY4QBIXIMXYDJNUKFGJVQTN5356SAD6WPCIHWNQAG7DDMF7L7S3SHD6O37OTAHUCKU6ALXATYTGMHNFLM4XRLVSFUQAJR77M4URSZRKVO55243TDVXLO25PP4UYSPTTPMNRUFXDNP4WPE566Q6V4AH32F7HT" + const cookieValue = "OPJQMA7B3FTKCAUGO7FHCH5NMBGAWGGXYRNLEHYYZNGNPNIBCAM4IOEPG3NT3RIA44G5C3535Q5LGG4F4SR4AZVLGYKYTKFJJKEAOXENVBL5VXNILRP3GLNVVWA26XZ3VGSYOHA72RICMVZS3G53DTEH3J7VMEGG2RGQEK6VMGIWEIL3X66ZYUZZOKKUUBKAWCWZPLF745R6MSYFJJ6EXUPLU4UGKXFQWEBUCQAMIOV7EVR4JGDPUMIPCVZVKBP5XQU32N7XTB6LGOP5RZQCH7DRHM" api.SetJdCookie(cookieValue) api.SetCookie("user", "VCQUVHVJI4ELNGFZOYMCDYDUSHEJMPXZRZXSNBRB4MVBNENP72REAAZR3R4SGDJ5ZI4FLYLLN5EGBBMTFCWHZVESIWBNLKZPLHWD6UIBTPXOF5IXM6AVA3V6TUNZD5UJS43AROJ2IRPZWEN5AGZYBUEGD3MSKKBKBSRP3DSEQXLITYNBLFZCHXCA7L4KGOSJRMM7R5IQP7QGLGRQB27AOE4YMLRJ3UPTZADPWJOYB3UZ7UZHLBVZRREEX647O3WQUU4BYXUOFZPIPRR77W3PQV543E") } diff --git a/platformapi/jdapi/store_page.go b/platformapi/jdapi/store_page.go index 0118a8cf..6853617c 100644 --- a/platformapi/jdapi/store_page.go +++ b/platformapi/jdapi/store_page.go @@ -298,10 +298,12 @@ var ( regexpTable = regexp.MustCompile(`
SKU编码:(.*)
`) regexpJDUserID = regexp.MustCompile(`value="(.*)"`) regexpJDUserIsManager = regexp.MustCompile(`