京东商城订单增加
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
package jdshopapi
|
||||
|
||||
//查询单个订单
|
||||
//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{}{
|
||||
// "order_id": orderID,
|
||||
// "optional_fields": "orderType,payType",
|
||||
// }
|
||||
// data, _ := json.Marshal(dataMap)
|
||||
_, err = a.AccessAPI("jingdong.pop.order.shipment", prodURL, map[string]interface{}{
|
||||
"orderId": orderID,
|
||||
import "fmt"
|
||||
|
||||
//订单出库
|
||||
//https://open.jd.com/home/home#/doc/api?apiCateId=55&apiId=1948&apiName=jingdong.pop.order.shipment
|
||||
func (a *API) OrderShipment(orderID int64, logiCoprId, logiNo string) (err error) {
|
||||
result, err := a.AccessAPI("jingdong.pop.order.shipment", prodURL, map[string]interface{}{
|
||||
"orderId": orderID,
|
||||
"logiCoprId": logiCoprId,
|
||||
"logiNo": logiNo,
|
||||
})
|
||||
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
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
)
|
||||
|
||||
func TestEnGet(t *testing.T) {
|
||||
err := api.EnGet(116925931738)
|
||||
err := api.OrderShipment(1, "logiCoprId", "logiNo")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -418,7 +418,7 @@ func (a *API) OrderDetail(orderId string) (orderDetailResult *OrderDetailResult,
|
||||
}
|
||||
if len(expectedDeliveredTime) > 0 {
|
||||
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 {
|
||||
orderDetailResult.ActualPayPrice = utils.Float64TwoInt64(utils.Str2Float64(strings.TrimSpace(actualPayPrice[1])) * 100)
|
||||
|
||||
@@ -73,8 +73,3 @@ func TestOrderDetail(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestCC(t *testing.T) {
|
||||
fmt.Println(utils.Str2Float64("14.00
|
||||
"))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user