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 {
|
||||||
|
|||||||
@@ -9,25 +9,26 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type CallBackResult struct {
|
type CallBackResult struct {
|
||||||
OrderStateRemark string `json:"orderStateRemark"`
|
OrderStateRemark string `json:"orderStateRemark"`
|
||||||
OrderRemark string `json:"orderRemark"`
|
OrderRemark string `json:"orderRemark"`
|
||||||
OrderSellerPrice string `json:"orderSellerPrice"`
|
OrderSellerPrice string `json:"orderSellerPrice"`
|
||||||
OrderState string `json:"orderState"`
|
OrderState string `json:"orderState"`
|
||||||
OrderType string `json:"orderType"`
|
OrderType string `json:"orderType"`
|
||||||
OrderPayment string `json:"orderPayment"`
|
OrderPayment string `json:"orderPayment"`
|
||||||
PayType string `json:"payType"`
|
PayType string `json:"payType"`
|
||||||
StoreID string `json:"storeId"`
|
StoreID string `json:"storeId"`
|
||||||
OrderTotalPrice string `json:"orderTotalPrice"`
|
OrderTotalPrice string `json:"orderTotalPrice"`
|
||||||
OrderExt string `json:"orderExt"`
|
OrderExt string `json:"orderExt"`
|
||||||
StoreOrder string `json:"storeOrder"`
|
StoreOrder string `json:"storeOrder"`
|
||||||
OrderStartTime string `json:"orderStartTime"`
|
OrderStartTime string `json:"orderStartTime"`
|
||||||
OrderID string `json:"orderId"`
|
OrderID string `json:"orderId"`
|
||||||
OrderSource string `json:"orderSource"`
|
OrderSource string `json:"orderSource"`
|
||||||
FreightPrice string `json:"freightPrice"`
|
FreightPrice string `json:"freightPrice"`
|
||||||
MsgType string `json:"msgType"`
|
MsgType string `json:"msgType"`
|
||||||
Pin string `json:"pin"`
|
Pin string `json:"pin"`
|
||||||
ConsigneeInfo *CallBackConsigneeInfo `json:"consigneeInfo"`
|
IDSopShipmenttype string `json:"idSopShipmenttype"`
|
||||||
ItemInfoList []*CallBackItemInfoList `json:"itemInfoList"`
|
ConsigneeInfo *CallBackConsigneeInfo `json:"consigneeInfo"`
|
||||||
|
ItemInfoList []*CallBackItemInfoList `json:"itemInfoList"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CallBackConsigneeInfo struct {
|
type CallBackConsigneeInfo struct {
|
||||||
|
|||||||
@@ -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