- weimob order and callback
This commit is contained in:
53
platformapi/weimobapi/order.go
Normal file
53
platformapi/weimobapi/order.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package weimobapi
|
||||
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"github.com/fatih/structs"
|
||||
)
|
||||
|
||||
type DeliveryOrderItem struct {
|
||||
ItemId int64 `json:"itemId"`
|
||||
SkuId int64 `json:"skuId"`
|
||||
SkuNum int `json:"skuNum"`
|
||||
}
|
||||
|
||||
type DeliveryOrder struct {
|
||||
OrderNo int64 `json:"orderNo"`
|
||||
DeliveryNo string `json:"deliveryNo"`
|
||||
DeliveryCompanyCode string `json:"deliveryCompanyCode"`
|
||||
DeliveryCompanyName string `json:"deliveryCompanyName"`
|
||||
IsNeedLogistics bool `json:"isNeedLogistics"`
|
||||
IsSplitPackage bool `json:"isSplitPackage"`
|
||||
DeliveryRemark string `json:"deliveryRemark"`
|
||||
DeliveryOrderItemList []*DeliveryOrderItem `json:"deliveryOrderItemList"`
|
||||
}
|
||||
|
||||
func (a *API) QueryOrderDetail(orderNo int64, needInvoiceInfo bool) (retVal map[string]interface{}, err error) {
|
||||
result, err := a.AccessAPI("order/queryOrderDetail", map[string]interface{}{
|
||||
"orderNo": orderNo,
|
||||
"needInvoiceInfo": needInvoiceInfo,
|
||||
})
|
||||
if err == nil {
|
||||
return result.(map[string]interface{}), nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
func (a *API) CancelOrder(orderNo int64, specificCancelReason string) (err error) {
|
||||
apiParams := map[string]interface{}{
|
||||
"orderNo": orderNo,
|
||||
}
|
||||
if specificCancelReason != "" {
|
||||
apiParams["specificCancelReason"] = specificCancelReason
|
||||
}
|
||||
_, err = a.AccessAPI("order/cancelOrder", apiParams)
|
||||
return err
|
||||
}
|
||||
|
||||
func (a *API) DeliveryOrder(orderDeliveryInfo *DeliveryOrder) (err error) {
|
||||
apiParams := structs.Map(orderDeliveryInfo)
|
||||
baseapi.SugarLogger.Debug(utils.Format4Output(apiParams, false))
|
||||
_, err = a.AccessAPI("order/deliveryOrder", apiParams)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user