京东商城订单增加

This commit is contained in:
苏尹岚
2020-06-03 11:18:16 +08:00
parent 0e9840fc3c
commit a71f902289
4 changed files with 16 additions and 17 deletions

View File

@@ -1,15 +1,19 @@
package jdshopapi package jdshopapi
//查询单个订单 import "fmt"
//https://open.jd.com/home/home#/doc/api?apiCateId=55&apiId=2389&apiName=jingdong.pop.order.enGet
func (a *API) EnGet(orderID int64) (err error) { //订单出库
// dataMap := map[string]interface{}{ //https://open.jd.com/home/home#/doc/api?apiCateId=55&apiId=1948&apiName=jingdong.pop.order.shipment
// "order_id": orderID, func (a *API) OrderShipment(orderID int64, logiCoprId, logiNo string) (err error) {
// "optional_fields": "orderType,payType", result, err := a.AccessAPI("jingdong.pop.order.shipment", prodURL, map[string]interface{}{
// } "orderId": orderID,
// data, _ := json.Marshal(dataMap) "logiCoprId": logiCoprId,
_, err = a.AccessAPI("jingdong.pop.order.shipment", prodURL, map[string]interface{}{ "logiNo": logiNo,
"orderId": orderID,
}) })
if err == nil {
if !result["jingdong_pop_order_shipment_responce"].(map[string]interface{})["sopjosshipment_result"].(map[string]interface{})["success"].(bool) {
return fmt.Errorf("OrderShipment error: %v", result["jingdong_pop_order_shipment_responce"].(map[string]interface{})["sopjosshipment_result"].(map[string]interface{})["chineseErrCode"])
}
}
return err return err
} }

View File

@@ -5,7 +5,7 @@ import (
) )
func TestEnGet(t *testing.T) { func TestEnGet(t *testing.T) {
err := api.EnGet(116925931738) err := api.OrderShipment(1, "logiCoprId", "logiNo")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@@ -418,7 +418,7 @@ func (a *API) OrderDetail(orderId string) (orderDetailResult *OrderDetailResult,
} }
if len(expectedDeliveredTime) > 0 { if len(expectedDeliveredTime) > 0 {
times := strings.Split(expectedDeliveredTime[1], ",") times := strings.Split(expectedDeliveredTime[1], ",")
orderDetailResult.ExpectedDeliveredTime = times[0] + " " + times[1][:strings.Index(times[1], ":")] + ":30:00" orderDetailResult.ExpectedDeliveredTime = times[0] + " " + times[1][:strings.Index(times[1], ":")] + ":00:00"
} }
if len(actualPayPrice) > 0 { if len(actualPayPrice) > 0 {
orderDetailResult.ActualPayPrice = utils.Float64TwoInt64(utils.Str2Float64(strings.TrimSpace(actualPayPrice[1])) * 100) orderDetailResult.ActualPayPrice = utils.Float64TwoInt64(utils.Str2Float64(strings.TrimSpace(actualPayPrice[1])) * 100)

View File

@@ -73,8 +73,3 @@ func TestOrderDetail(t *testing.T) {
} }
t.Log(utils.Format4Output(result, false)) t.Log(utils.Format4Output(result, false))
} }
func TestCC(t *testing.T) {
fmt.Println(utils.Str2Float64("14.00
"))
}