+weimobapi.QueryOrderDetail2

This commit is contained in:
gazebo
2019-10-30 13:52:24 +08:00
parent 27bd01862c
commit d4dc1d3fbb
2 changed files with 142 additions and 3 deletions

View File

@@ -11,8 +11,8 @@ const (
)
type DeliveryOrderItem struct {
ItemId int64 `json:"itemId"`
SkuId int64 `json:"skuId"`
ItemID int64 `json:"itemId"`
SkuID int64 `json:"skuId"`
SkuNum int `json:"skuNum"`
}
@@ -27,6 +27,134 @@ type DeliveryOrder struct {
DeliveryOrderItemList []*DeliveryOrderItem `json:"deliveryOrderItemList"`
}
type OrderDetail struct {
AutoCancelTime int `json:"autoCancelTime"`
BizInfo struct {
BizType int `json:"bizType"`
BizTypeName string `json:"bizTypeName"`
} `json:"bizInfo"`
BizSourceType int `json:"bizSourceType"`
BuyerInfo struct {
UserNickname string `json:"userNickname"`
Wid int `json:"wid"`
} `json:"buyerInfo"`
BuyerRemark string `json:"buyerRemark"`
ChannelTypeName string `json:"channelTypeName"`
CreateTime int64 `json:"createTime"`
DeliveryAmount float64 `json:"deliveryAmount"`
DeliveryDetail struct {
DeliveryType int `json:"deliveryType"`
DeliveryTypeName string `json:"deliveryTypeName"`
LogisticsDeliveryDetail struct {
ExpectDeliveryTime string `json:"expectDeliveryTime"`
ExpectDeliveryType int `json:"expectDeliveryType"`
LogisticsOrderList []interface{} `json:"logisticsOrderList"`
ReceiverAddress string `json:"receiverAddress"`
ReceiverArea string `json:"receiverArea"`
ReceiverCity string `json:"receiverCity"`
ReceiverCounty string `json:"receiverCounty"`
ReceiverLatitude string `json:"receiverLatitude"`
ReceiverLongitude string `json:"receiverLongitude"`
ReceiverMobile string `json:"receiverMobile"`
ReceiverName string `json:"receiverName"`
ReceiverProvince string `json:"receiverProvince"`
ReceiverZip string `json:"receiverZip"`
} `json:"logisticsDeliveryDetail"`
} `json:"deliveryDetail"`
DeliveryPaymentAmount float64 `json:"deliveryPaymentAmount"`
DiscountInfo struct {
MerchantDiscountAmount int `json:"merchantDiscountAmount"`
} `json:"discountInfo"`
EnableDelivery int `json:"enableDelivery"`
ExistingInvoice bool `json:"existingInvoice"`
ExpandLabelInfo struct {
VirtualWid bool `json:"virtualWid"`
} `json:"expandLabelInfo"`
GoodsAmount float64 `json:"goodsAmount"`
GoodsPromotionInfo struct {
CycleOrderInfo struct {
CyclePackageList []interface{} `json:"cyclePackageList"`
} `json:"cycleOrderInfo"`
GoodsDistributionType int `json:"goodsDistributionType"`
PromotionType int `json:"promotionType"`
} `json:"goodsPromotionInfo"`
GoodsSellMode int `json:"goodsSellMode"`
GoodsSourceType int `json:"goodsSourceType"`
GuideInfo struct {
GoodsGuideType int `json:"goodsGuideType"`
} `json:"guideInfo"`
InvoiceTexAmount int `json:"invoiceTexAmount"`
InvoiceTexDiscountAmount int `json:"invoiceTexDiscountAmount"`
InvoiceTexPaymentAmount int `json:"invoiceTexPaymentAmount"`
ItemList []struct {
BaseDiscountInfo struct {
} `json:"baseDiscountInfo"`
BizInfo struct {
} `json:"bizInfo"`
CostPrice float64 `json:"costPrice"`
GoodsDiscountInfo struct {
} `json:"goodsDiscountInfo"`
GoodsID int64 `json:"goodsId"`
GoodsSellMode int `json:"goodsSellMode"`
GoodsSourceType int `json:"goodsSourceType"`
GoodsTitle string `json:"goodsTitle"`
GoodsType int `json:"goodsType"`
HadDeliveryItemNum int `json:"hadDeliveryItemNum"`
ID int `json:"id"`
ImageURL string `json:"imageUrl"`
OriginalPrice float64 `json:"originalPrice"`
PaymentAmount float64 `json:"paymentAmount"`
PointDeductRatio int `json:"pointDeductRatio"`
Price float64 `json:"price"`
PrimaryCategory string `json:"primaryCategory"`
SecondaryCategory string `json:"secondaryCategory"`
ShouldPaymentAmount float64 `json:"shouldPaymentAmount"`
SkuAmount float64 `json:"skuAmount"`
SkuCode string `json:"skuCode"`
SkuID int64 `json:"skuId"`
SkuNum int `json:"skuNum"`
TagInfo struct {
ActivityTag []interface{} `json:"activityTag"`
GoodsBizTag []interface{} `json:"goodsBizTag"`
} `json:"tagInfo"`
TotalAmount float64 `json:"totalAmount"`
WarehouseID int `json:"warehouseId"`
WarehouseName string `json:"warehouseName"`
WarehouseType int `json:"warehouseType"`
} `json:"itemList"`
MerchantInfo struct {
MerchantTitle string `json:"merchantTitle"`
Pid int64 `json:"pid"`
ProcessStoreID int `json:"processStoreId"`
ProcessStoreTitle string `json:"processStoreTitle"`
StoreID int `json:"storeId"`
StoreTitle string `json:"storeTitle"`
} `json:"merchantInfo"`
OperationList []struct {
Name string `json:"name"`
OperationType int `json:"operationType"`
PermissionCode string `json:"permissionCode"`
} `json:"operationList"`
OrderNo int64 `json:"orderNo"`
OrderStatus int `json:"orderStatus"`
OrderStatusName string `json:"orderStatusName"`
OrderType int `json:"orderType"`
PaymentAmount float64 `json:"paymentAmount"`
PaymentInfo struct {
PaymentStatus int `json:"paymentStatus"`
PaymentType int `json:"paymentType"`
PaymentTypeName string `json:"paymentTypeName"`
} `json:"paymentInfo"`
ProcessStoreID int `json:"processStoreId"`
ProcessStoreTitle string `json:"processStoreTitle"`
ShouldPaymentAmount float64 `json:"shouldPaymentAmount"`
StoreTitle string `json:"storeTitle"`
TotalAmount float64 `json:"totalAmount"`
TransferStatus int `json:"transferStatus"`
TransferType int `json:"transferType"`
UpdateTime int64 `json:"updateTime"`
}
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,
@@ -38,6 +166,17 @@ func (a *API) QueryOrderDetail(orderNo int64, needInvoiceInfo bool) (retVal map[
return nil, err
}
func (a *API) QueryOrderDetail2(orderNo int64, needInvoiceInfo bool) (order *OrderDetail, err error) {
result, err := a.AccessAPI("order/queryOrderDetail", map[string]interface{}{
"orderNo": orderNo,
"needInvoiceInfo": needInvoiceInfo,
})
if err == nil {
err = utils.Map2StructByJson(result, &order, false)
}
return order, err
}
func (a *API) CancelOrder(orderNo int64, specificCancelReason string) (err error) {
apiParams := map[string]interface{}{
"orderNo": orderNo,

View File

@@ -8,7 +8,7 @@ import (
)
func TestQueryOrderDetail(t *testing.T) {
result, err := api.QueryOrderDetail(5287873015048, false)
result, err := api.QueryOrderDetail2(21446006011548, false)
if err != nil {
t.Fatal(err)
}