- 修正各平台与拉取订单相关的API的bug

This commit is contained in:
gazebo
2019-07-18 18:35:59 +08:00
parent e29e30604e
commit 061e906d17
8 changed files with 210 additions and 23 deletions

View File

@@ -177,6 +177,139 @@ type OrderSettlementInfo struct {
VenderSkuGoodsDiscountMoney int64 `json:"venderSkuGoodsDiscountMoney"`
}
type OrderProductInfo struct {
AdjustMode int `json:"adjustMode"`
CanteenMoney int `json:"canteenMoney"`
CategoryID string `json:"categoryId"`
FirstCategoryName string `json:"firstCategoryName"`
IsGift bool `json:"isGift"`
PromotionType int `json:"promotionType"`
SkuCount int `json:"skuCount"`
SkuID int `json:"skuId"`
SkuJdPrice int `json:"skuJdPrice"`
SkuName string `json:"skuName"`
SkuSpuID int `json:"skuSpuId"`
SkuStockOwner int `json:"skuStockOwner"`
SkuStorePrice int `json:"skuStorePrice"`
SkuWeight float64 `json:"skuWeight"`
UpcCode string `json:"upcCode,omitempty"`
SpecialServiceTag string `json:"specialServiceTag,omitempty"`
}
type OrderInfo struct {
AdjustCount int `json:"adjustCount"`
AdjustID int `json:"adjustId"`
AdjustIsExists bool `json:"adjustIsExists"`
AppVersion string `json:"appVersion"`
ArtificerPortraitURL string `json:"artificerPortraitUrl"`
BusinessTag string `json:"businessTag"`
BusinessType int `json:"businessType"`
BuyerCity string `json:"buyerCity"`
BuyerCityName string `json:"buyerCityName"`
BuyerCoordType int `json:"buyerCoordType"`
BuyerCountry string `json:"buyerCountry"`
BuyerCountryName string `json:"buyerCountryName"`
BuyerFullAddress string `json:"buyerFullAddress"`
BuyerFullName string `json:"buyerFullName"`
BuyerIP int `json:"buyerIp"`
BuyerLat float64 `json:"buyerLat"`
BuyerLng float64 `json:"buyerLng"`
BuyerMobile string `json:"buyerMobile"`
BuyerPin string `json:"buyerPin"`
BuyerPinType int `json:"buyerPinType"`
BuyerPoi string `json:"buyerPoi"`
BuyerProvince string `json:"buyerProvince"`
CancelDeadline string `json:"cancelDeadline"`
CancelOperator string `json:"cancelOperator"`
CancelOrderIsReadable bool `json:"cancelOrderIsReadable"`
CancelRequestTime string `json:"cancelRequestTime"`
ClientOrderPreStartDeliveryTime string `json:"clientOrderPreStartDeliveryTime"`
DeliveryBillNo string `json:"deliveryBillNo"`
DeliveryCarrierName string `json:"deliveryCarrierName"`
DeliveryCarrierNo string `json:"deliveryCarrierNo"`
DeliveryDelayAgreed int `json:"deliveryDelayAgreed"`
DeliveryPackageVolume float64 `json:"deliveryPackageVolume"`
DeliveryPackageWeight float64 `json:"deliveryPackageWeight"`
DeliveryStationName string `json:"deliveryStationName"`
DeliveryStationNo string `json:"deliveryStationNo"`
DeliveryStationNoIsv string `json:"deliveryStationNoIsv"`
DeliveryType int `json:"deliveryType"`
EquipmentID string `json:"equipmentId"`
GrabMark int `json:"grabMark"`
IndustryTag int `json:"industryTag"`
IsDeleted bool `json:"isDeleted"`
IsGroupon bool `json:"isGroupon"`
IsJDGetCash bool `json:"isJDGetCash"`
LastFourDigitsOfBuyerMobile string `json:"lastFourDigitsOfBuyerMobile"`
LocalDeliveryMoney int `json:"localDeliveryMoney"`
MerchantPaymentDistanceFreightMoney int `json:"merchantPaymentDistanceFreightMoney"`
OrderAcceptTime string `json:"orderAcceptTime"`
OrderAdditionFreightMoney int `json:"orderAdditionFreightMoney"`
OrderAgingType int `json:"orderAgingType"`
OrderBalanceUsed int `json:"orderBalanceUsed"`
OrderBaseFreightMoney int `json:"orderBaseFreightMoney"`
OrderBaseReceivableFreight int `json:"orderBaseReceivableFreight"`
OrderBuyerPayableMoney int `json:"orderBuyerPayableMoney"`
OrderBuyerRemark string `json:"orderBuyerRemark"`
OrderCancelRemark string `json:"orderCancelRemark"`
OrderCancelTime string `json:"orderCancelTime"`
OrderDiscountMoney int `json:"orderDiscountMoney"`
OrderDistanceStepFreight int `json:"orderDistanceStepFreight"`
OrderFinanceOrgCode int `json:"orderFinanceOrgCode"`
OrderFreightMoney int `json:"orderFreightMoney"`
OrderGoodsMoney int `json:"orderGoodsMoney"`
OrderID int64 `json:"orderId"`
OrderInvoiceOpenMark int `json:"orderInvoiceOpenMark"`
OrderIsClosed bool `json:"orderIsClosed"`
OrderJingdouMoney int `json:"orderJingdouMoney"`
OrderLadderFreightMoney int `json:"orderLadderFreightMoney"`
OrderNum int `json:"orderNum"`
OrderPayType int `json:"orderPayType"`
OrderPreDeliveryTime string `json:"orderPreDeliveryTime"`
OrderPreEndDeliveryTime string `json:"orderPreEndDeliveryTime"`
OrderPreStartDeliveryTime string `json:"orderPreStartDeliveryTime"`
OrderPurchaseTime string `json:"orderPurchaseTime"`
OrderReceivableFreight int `json:"orderReceivableFreight"`
OrderSkuType int `json:"orderSkuType"`
OrderStartTime string `json:"orderStartTime"`
OrderStatus int `json:"orderStatus"`
OrderStatusTime string `json:"orderStatusTime"`
OrderStockOwner int `json:"orderStockOwner"`
OrderTakeSelfCode string `json:"orderTakeSelfCode"`
OrderTotalMoney int `json:"orderTotalMoney"`
OrderType int `json:"orderType"`
OrderVenderChargeMoney int `json:"orderVenderChargeMoney"`
OrgCode string `json:"orgCode"`
PackagingMoney int `json:"packagingMoney"`
PayChannel int `json:"payChannel"`
PickDeadline string `json:"pickDeadline"`
PickMark int `json:"pickMark"`
PlatformPointsDeductionMoney int `json:"platformPointsDeductionMoney"`
PrescriptionDTO struct {
IsRigorous bool `json:"isRigorous"`
} `json:"prescriptionDTO"`
PrintMark int `json:"printMark"`
ProduceStationName string `json:"produceStationName"`
ProduceStationNo string `json:"produceStationNo"`
ProduceStationNoIsv string `json:"produceStationNoIsv"`
Product []*OrderProductInfo `json:"product"`
SrcInnerOrderID int `json:"srcInnerOrderId"`
SrcInnerType int `json:"srcInnerType"`
SrcOrderID string `json:"srcOrderId"`
SrcOrderType int `json:"srcOrderType"`
SrcPlatID int `json:"srcPlatId"`
StoreLat float64 `json:"storeLat"`
StoreLng float64 `json:"storeLng"`
Tips int `json:"tips"`
Ts string `json:"ts"`
UpdatePin string `json:"updatePin"`
UserTip int `json:"userTip"`
VenderBalanceDeductMoney int `json:"venderBalanceDeductMoney"`
VenderIntegralDeductMoney int `json:"venderIntegralDeductMoney"`
VenderProcessResult string `json:"venderProcessResult"`
Yn bool `json:"yn"`
}
var (
ErrCanNotFindOrder = errors.New("can not find order")
)
@@ -203,6 +336,14 @@ func (a *API) OrderQuery(jdParams map[string]interface{}) (retVal []interface{},
return retVal, totalCount, err
}
func (a *API) OrderQuery2(jdParams map[string]interface{}) (retVal []*OrderInfo, totalCount int, err error) {
orderList, totalCount, err := a.OrderQuery(jdParams)
if err == nil {
err = utils.Map2StructByJson(orderList, &retVal, true)
}
return retVal, totalCount, err
}
// orderFreightMoney 基础运费
// tips 商家承担小费
// merchantPaymentDistanceFreightMoney 取件服务费(开票)(正向单展示远距离运费;售后单则展示达达售后运费)
@@ -220,27 +361,6 @@ func (a *API) QuerySingleOrder(orderId string) (map[string]interface{}, error) {
return result[0].(map[string]interface{}), nil
}
func (a *API) LegacyQuerySingleOrder(orderId string) (map[string]interface{}, error) {
jdParams := make(map[string]interface{})
jdParams["orderId"] = orderId
result, err := a.AccessAPI("order/es/query", jdParams)
if err != nil {
return nil, err
}
dataStr, _ := result["data"].(string)
var data map[string]interface{}
utils.UnmarshalUseNumber([]byte(dataStr), &data)
result["data"] = data
var dataResult map[string]interface{}
utils.UnmarshalUseNumber([]byte(data["result"].(string)), &dataResult)
data["result"] = dataResult
return result, nil
}
// 商家确认接单接口
// https://opendj.jd.com/staticnew/widgets/resources.html?groupid=169&apiid=c1a15129d1374e9da7fa35487f878604
func (a *API) OrderAcceptOperate(orderId string, isAgreed bool, userName string) error {

View File

@@ -31,6 +31,7 @@ func TestOrderQuery(t *testing.T) {
if err != nil {
t.Fatalf("OrderQuery return error:%v", err)
}
t.Log(utils.Format4Output(result, false))
if len(result) == 0 || totalCount == 0 {
t.Fatal("OrderQuery return empty data")