- export low level jdapi.
- access jd order info.
This commit is contained in:
@@ -1,18 +1,63 @@
|
||||
package jdapi
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
type LegacyJDOrderInfo struct {
|
||||
Code string `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
Result map[string]interface{} `json:"result"`
|
||||
Detail string `json:"detail"`
|
||||
Success bool `json:"success"`
|
||||
OrderStatus int `json:"-"`
|
||||
OrderStatusTime string `json:"-"`
|
||||
}
|
||||
|
||||
func (j JDAPI) OrderQuery(jdParams map[string]string) (retVal []interface{}, err error) {
|
||||
retVal, err = j.accessJDQueryHavePage("order/es/query", jdParams, nil, nil, nil)
|
||||
retVal, err = j.AccessJDQueryHavePage("order/es/query", jdParams, nil, nil, nil)
|
||||
return
|
||||
}
|
||||
|
||||
func (j JDAPI) QuerySignleOrder(orderId string) ([]interface{}, error) {
|
||||
func (j JDAPI) QuerySingleOrder(orderId string) ([]interface{}, error) {
|
||||
jdParams := make(map[string]string)
|
||||
jdParams["orderId"] = orderId
|
||||
return j.accessJDQueryHavePage("order/es/query", jdParams, nil, nil, nil)
|
||||
return j.AccessJDQueryHavePage("order/es/query", jdParams, nil, nil, nil)
|
||||
}
|
||||
|
||||
func (j JDAPI) LegacyQuerySingleOrder(orderId string) (*LegacyJDOrderInfo, error) {
|
||||
jdParams := make(map[string]string)
|
||||
jdParams["orderId"] = orderId
|
||||
|
||||
result, err := j.AccessJDQuery("order/es/query", jdParams)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dataStr, _ := result["data"].(string)
|
||||
var data map[string]interface{}
|
||||
utils.UnmarshalUseNumber([]byte(dataStr), &data)
|
||||
|
||||
resultList, _ := NormalJDQueryHavePageResultParser(data, 0)
|
||||
orderInfo, _ := resultList[0].(map[string]interface{})
|
||||
orderStatus64, _ := orderInfo["orderStatus"].(json.Number).Int64()
|
||||
|
||||
var dataResult map[string]interface{}
|
||||
utils.UnmarshalUseNumber([]byte(data["result"].(string)), &dataResult)
|
||||
dataResult["resultList"] = resultList
|
||||
|
||||
retVal := &LegacyJDOrderInfo{}
|
||||
retVal.OrderStatus = int(orderStatus64)
|
||||
retVal.OrderStatusTime = orderInfo["orderStatusTime"].(string)
|
||||
retVal.Code = result["code"].(string)
|
||||
retVal.Msg = result["msg"].(string)
|
||||
|
||||
retVal.Result = dataResult
|
||||
retVal.Success = true
|
||||
|
||||
return retVal, nil
|
||||
}
|
||||
|
||||
func (j JDAPI) OrderAcceptOperate(orderId string, isAgreed bool) (interface{}, error) {
|
||||
@@ -21,5 +66,5 @@ func (j JDAPI) OrderAcceptOperate(orderId string, isAgreed bool) (interface{}, e
|
||||
"isAgreed": utils.Bool2String(isAgreed),
|
||||
"operator": getJDOperator(),
|
||||
}
|
||||
return j.accessJDQueryNoPage("order/es/query", jdParams, nil, nil)
|
||||
return j.AccessJDQueryNoPage("order/es/query", jdParams, nil, nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user