jdshop orde

This commit is contained in:
苏尹岚
2020-08-13 11:28:24 +08:00
parent 21a579681f
commit 0980b46796
5 changed files with 47 additions and 34 deletions

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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
}

View File

@@ -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))
}

View File

@@ -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) {