jdshop orde
This commit is contained in:
@@ -37,9 +37,8 @@ func TestShopAdd(t *testing.T) {
|
|||||||
|
|
||||||
func TestShopUpdate(t *testing.T) {
|
func TestShopUpdate(t *testing.T) {
|
||||||
shopInfo := &ShopInfo{
|
shopInfo := &ShopInfo{
|
||||||
OriginShopID: "18180948107",
|
OriginShopID: "666872",
|
||||||
StationName: "京西大本营234",
|
Status: 1,
|
||||||
CityName: "包头市",
|
|
||||||
}
|
}
|
||||||
err := dadaapi.ShopUpdate(shopInfo)
|
err := dadaapi.ShopUpdate(shopInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ type CallBackResult struct {
|
|||||||
FreightPrice string `json:"freightPrice"`
|
FreightPrice string `json:"freightPrice"`
|
||||||
MsgType string `json:"msgType"`
|
MsgType string `json:"msgType"`
|
||||||
Pin string `json:"pin"`
|
Pin string `json:"pin"`
|
||||||
|
IDSopShipmenttype string `json:"idSopShipmenttype"`
|
||||||
ConsigneeInfo *CallBackConsigneeInfo `json:"consigneeInfo"`
|
ConsigneeInfo *CallBackConsigneeInfo `json:"consigneeInfo"`
|
||||||
ItemInfoList []*CallBackItemInfoList `json:"itemInfoList"`
|
ItemInfoList []*CallBackItemInfoList `json:"itemInfoList"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/utils"
|
"git.rosy.net.cn/baseapi/utils"
|
||||||
@@ -221,17 +222,29 @@ func (a *API) KeyGet() (keyGetResult *KeyGetResult, err error) {
|
|||||||
return keyGetResult, err
|
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) {
|
func (a *API) GetOrderExtInfoByOrderId(orderId string) (time string, err error) {
|
||||||
_, err = a.AccessAPI("jingdong.pop.order.getOrderExtInfoByOrderId", prodURL, map[string]interface{}{
|
getOrderExtInfoByOrderIdResult := &GetOrderExtInfoByOrderIdResult{}
|
||||||
"orderId": "124162661622",
|
result, err := a.AccessAPI("jingdong.pop.order.getOrderExtInfoByOrderId", prodURL, map[string]interface{}{
|
||||||
|
"orderId": orderId,
|
||||||
|
"searchFileds": "deliveryInfo",
|
||||||
})
|
})
|
||||||
if err == nil {
|
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))
|
str := strings.ReplaceAll(result["jingdong_pop_order_getOrderExtInfoByOrderId_responce"].(map[string]interface{})["orderExtraInfoResultModel"].(map[string]interface{})["resultMap"].(map[string]interface{})["deliveryInfo"].(string), "\\", "")
|
||||||
// if err2 == nil {
|
err = json.Unmarshal([]byte(str), &getOrderExtInfoByOrderIdResult)
|
||||||
// json.Unmarshal(data, &voucherInfoGetResult)
|
exTime := strings.Split(getOrderExtInfoByOrderIdResult.DeliveryCodTime, ",")
|
||||||
// }
|
exTime2 := strings.Split(exTime[1], "-")
|
||||||
// err = err2
|
time = exTime[0] + " " + exTime2[1] + ":00"
|
||||||
}
|
}
|
||||||
return err
|
return time, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ func TestKeyGet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetOrderExtInfoByOrderId(t *testing.T) {
|
func TestGetOrderExtInfoByOrderId(t *testing.T) {
|
||||||
err := api.GetOrderExtInfoByOrderId()
|
result, err := api.GetOrderExtInfoByOrderId("")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
// t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ func init() {
|
|||||||
|
|
||||||
// prod
|
// prod
|
||||||
api = New("wx2bb99eb5d2c9b82c", "6bbbed1443cc062c20a015a64c07a531")
|
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) {
|
func handleError(t *testing.T, err error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user