diff --git a/platformapi/ebaiapi/order.go b/platformapi/ebaiapi/order.go index 3780bb78..b7b8190f 100644 --- a/platformapi/ebaiapi/order.go +++ b/platformapi/ebaiapi/order.go @@ -73,6 +73,8 @@ const ( const ( OrderFromBaidu = "1" OrderFromElm = "2" + + OrderSkuDiscountTypeZhe = "g_zhe" ) const ( @@ -116,6 +118,126 @@ type ProductSubsidyInfo struct { UserRate int `json:"user_rate"` } +type OrderProductInfo struct { + BaiduProductID string `json:"baidu_product_id"` + SkuID string `json:"sku_id"` // 部分退款信息中是这个而不是BaiduProductID + + CustomSkuID string `json:"custom_sku_id"` + + PackageAmount int `json:"package_amount"` + Number int `json:"number"` // 部分退款信息中是这个而不是PackageAmount + + PackageFee int `json:"package_fee"` + PackagePrice int `json:"package_price"` + PrescriptionID string `json:"prescription_id"` + ProductAmount int `json:"product_amount"` + ProductAttr []interface{} `json:"product_attr"` + ProductCustomIndex string `json:"product_custom_index"` + ProductFeatures []interface{} `json:"product_features"` + ProductFee int `json:"product_fee"` + ProductName string `json:"product_name"` + ProductPrice int `json:"product_price"` + ProductSubsidy *ProductSubsidyInfo `json:"product_subsidy"` + ProductType int `json:"product_type"` + SupplyType int `json:"supply_type"` + TotalFee int `json:"total_fee"` + TotalWeight int `json:"total_weight"` + Upc string `json:"upc"` + WeightType int `json:"weight_type"` +} + +type OrderDetailInfo struct { + Discount []*struct { + ActivityID string `json:"activity_id"` + AgentRate int `json:"agent_rate"` + BaiduRate int `json:"baidu_rate"` + Desc string `json:"desc"` + Fee int `json:"fee"` + LogisticsRate int `json:"logistics_rate"` + Products []*struct { + ActivityID string `json:"activity_id"` + ActivityProductNum int `json:"activity_product_num"` + BaiduProductID int64 `json:"baidu_product_id"` + NowPrice int `json:"now_price"` + OrigPrice int `json:"orig_price"` + SavePrice int `json:"save_price"` + } `json:"products,omitempty"` + RuleID string `json:"rule_id"` + ShopRate int `json:"shop_rate"` + Type string `json:"type"` + UserRate int `json:"user_rate,omitempty"` + } `json:"discount"` + Order *struct { + AtshopTime int `json:"atshop_time"` + CancelTime string `json:"cancel_time"` + ColdBoxFee string `json:"cold_box_fee"` + Commission int `json:"commission"` + ConfirmTime string `json:"confirm_time"` + CreateTime string `json:"create_time"` + DeliveryParty int `json:"delivery_party"` + DeliveryPhone string `json:"delivery_phone"` + DeliveryTime int `json:"delivery_time"` + DiscountFee int `json:"discount_fee"` + DownFlag int `json:"down_flag"` + ElemeOrderID string `json:"eleme_order_id"` + ExpectTimeMode int `json:"expect_time_mode"` + Ext struct { + TaoxiFlag int `json:"taoxi_flag"` + } `json:"ext"` + FinishedTime string `json:"finished_time"` + InvoiceTitle string `json:"invoice_title"` + IsColdBoxOrder int `json:"is_cold_box_order"` + IsPrivate int `json:"is_private"` + LatestSendTime int `json:"latest_send_time"` + MealNum string `json:"meal_num"` + NeedInvoice int `json:"need_invoice"` + OrderFlag int `json:"order_flag"` + OrderFrom string `json:"order_from"` + OrderID string `json:"order_id"` + OrderIndex string `json:"order_index"` + PackageFee int `json:"package_fee"` + PayStatus int `json:"pay_status"` + PayType int `json:"pay_type"` + PickupTime int `json:"pickup_time"` + Remark string `json:"remark"` + ResponsibleParty string `json:"responsible_party"` + SendFee int `json:"send_fee"` + SendImmediately int `json:"send_immediately"` + SendTime int `json:"send_time"` + ShopFee int `json:"shop_fee"` + Status int `json:"status"` + TaxerID string `json:"taxer_id"` + TotalFee int `json:"total_fee"` + UserFee int `json:"user_fee"` + } `json:"order"` + Products [][]*OrderProductInfo `json:"products"` + Shop *struct { + BaiduShopID string `json:"baidu_shop_id"` + ID string `json:"id"` + Name string `json:"name"` + } `json:"shop"` + Source string `json:"source"` + User *struct { + Address string `json:"address"` + City string `json:"city"` + Coord *struct { + Latitude string `json:"latitude"` + Longitude string `json:"longitude"` + } `json:"coord"` + CoordAmap *struct { + Latitude string `json:"latitude"` + Longitude string `json:"longitude"` + } `json:"coord_amap"` + District string `json:"district"` + Gender string `json:"gender"` + Name string `json:"name"` + Phone string `json:"phone"` + PrivacyPhone string `json:"privacy_phone"` + Province string `json:"province"` + UserID string `json:"user_id"` + } `json:"user"` +} + type RefundOrderDetailInfo struct { CustomSkuID string `json:"custom_sku_id"` Name string `json:"name"` @@ -251,6 +373,16 @@ func (a *API) OrderGet(orderID string) (orderMap map[string]interface{}, err err return nil, err } +func (a *API) OrderGet2(orderID string) (order *OrderDetailInfo, err error) { + result, err := a.AccessAPI("order.get", map[string]interface{}{ + "order_id": orderID, + }) + if err == nil { + err = utils.Map2StructByJson(result.Data, &order, true) + } + return order, err +} + // 设置订单快递单号 func (a *API) OrderExpressCreate(shopID string, expressList []*ExpressInfo) (status int, err error) { result, err := a.AccessAPI("order.express.create", map[string]interface{}{ @@ -359,13 +491,13 @@ func (a *API) OrderPartRefundGet(orderID string) (orderMap map[string]interface{ return nil, err } -func (a *API) OrderPartRefundGet2(orderID string) (partRefundInfo *CBPartRefundInfo, err error) { - result, err := a.OrderPartRefundGet(orderID) - if err == nil { - err = utils.Map2StructByJson(result, &partRefundInfo, true) - } - return partRefundInfo, err -} +// func (a *API) OrderPartRefundGet2(orderID string) (partRefundInfo *CBPartRefundInfo, err error) { +// result, err := a.OrderPartRefundGet(orderID) +// if err == nil { +// err = utils.Map2StructByJson(result, &partRefundInfo, true) +// } +// return partRefundInfo, err +// } func (a *API) SmartOrderIdConvert(orderID string) (convertedOrderID string, err error) { return a.OrderIdConvert(orderID, isOrderIDEleme(orderID)) diff --git a/platformapi/ebaiapi/order_test.go b/platformapi/ebaiapi/order_test.go index b4927392..16142693 100644 --- a/platformapi/ebaiapi/order_test.go +++ b/platformapi/ebaiapi/order_test.go @@ -7,7 +7,16 @@ import ( ) func TestOrderGet(t *testing.T) { - result, err := api.OrderGet("1556530656022029520") + result, err := api.OrderGet("1560213937227424971") + if err != nil { + t.Fatal(err) + } else { + t.Log(utils.Format4Output(result, false)) + } +} + +func TestOrderGet2(t *testing.T) { + result, err := api.OrderGet2("1560213937227424971") if err != nil { t.Fatal(err) } else { @@ -33,14 +42,14 @@ func TestOrderPartRefundGet(t *testing.T) { } } -func TestOrderPartRefundGet2(t *testing.T) { - result, err := api.OrderPartRefundGet2("1557459492221457830") - if err != nil { - t.Fatal(err) - } else { - t.Log(utils.Format4Output(result, false)) - } -} +// func TestOrderPartRefundGet2(t *testing.T) { +// result, err := api.OrderPartRefundGet2("1557459492221457830") +// if err != nil { +// t.Fatal(err) +// } else { +// t.Log(utils.Format4Output(result, false)) +// } +// } func TestOrderCallDelivery(t *testing.T) { err := api.OrderCallDelivery("1556617836226053651") diff --git a/platformapi/mtwmapi/order.go b/platformapi/mtwmapi/order.go index 5f1d35d9..ff5799ff 100644 --- a/platformapi/mtwmapi/order.go +++ b/platformapi/mtwmapi/order.go @@ -77,6 +77,10 @@ const ( const ( ExtrasPromotionTypeTaoCanZeng = 4 // 套餐赠 ExtrasPromotionTypeManZeng = 5 // 满赠 + + ExtrasPromotionTypeTeJiaCai = 7 // 特价菜 + ExtrasPromotionTypeZheKouCai = 17 // 折扣菜 + ExtrasPromotionTypeSecondHalfPrice = 20 // 第2份半价活动 ) type RefundSku struct { @@ -120,6 +124,8 @@ type OrderExtraInfo struct { ReduceFee float64 `json:"reduce_fee,omitempty"` Remark string `json:"remark,omitempty"` Type int `json:"type,omitempty"` + + RiderFee float64 `json:"rider_fee,omitempty"` } type FoodInfo struct {