- OrderGetPartRefundFoods
This commit is contained in:
@@ -122,6 +122,34 @@ type OrderExtraInfo struct {
|
||||
Type int `json:"type,omitempty"`
|
||||
}
|
||||
|
||||
type FoodInfo struct {
|
||||
AppFoodCode string `json:"app_food_code"`
|
||||
BoxNum int `json:"box_num"`
|
||||
BoxPrice int `json:"box_price"`
|
||||
CartID int `json:"cart_id"`
|
||||
FoodDiscount int `json:"food_discount"`
|
||||
FoodName string `json:"food_name"`
|
||||
FoodProperty string `json:"food_property"`
|
||||
Price float64 `json:"price"`
|
||||
Quantity int `json:"quantity"`
|
||||
SkuID string `json:"sku_id"`
|
||||
Spec string `json:"spec"`
|
||||
Unit string `json:"unit"`
|
||||
}
|
||||
|
||||
type CanRefundFoodInfo struct {
|
||||
AppFoodCode string `json:"app_food_code"`
|
||||
BoxNum float64 `json:"box_num"`
|
||||
BoxPrice float64 `json:"box_price"`
|
||||
Count int `json:"count"`
|
||||
FoodName string `json:"food_name"`
|
||||
FoodPrice float64 `json:"food_price"`
|
||||
IsRefundDifference int `json:"is_refund_difference"`
|
||||
OriginFoodPrice float64 `json:"origin_food_price"`
|
||||
RefundPrice float64 `json:"refund_price"`
|
||||
SkuID string `json:"sku_id"`
|
||||
}
|
||||
|
||||
type OrderInfo struct {
|
||||
AppOrderCode string `json:"app_order_code"`
|
||||
AppPoiCode string `json:"app_poi_code"`
|
||||
@@ -133,6 +161,7 @@ type OrderInfo struct {
|
||||
DaySeq int `json:"day_seq"`
|
||||
DeliveryTime int `json:"delivery_time"`
|
||||
Detail string `json:"detail"`
|
||||
DetailList []*FoodInfo `json:"detailList"`
|
||||
DinnersNumber int `json:"dinners_number"`
|
||||
ExpectDeliverTime int `json:"expect_deliver_time"`
|
||||
Extras string `json:"extras"`
|
||||
@@ -265,12 +294,25 @@ func (a *API) OrderGetOrderDetail2(orderID int64, isMTLogistics bool) (orderInfo
|
||||
orderMap, err := a.OrderGetOrderDetail(orderID, isMTLogistics)
|
||||
if err == nil {
|
||||
if err = utils.Map2StructByJson(orderMap, &orderInfo, false); err == nil {
|
||||
err = utils.UnmarshalUseNumber([]byte(orderInfo.Extras), &orderInfo.ExtraList)
|
||||
if err = utils.UnmarshalUseNumber([]byte(orderInfo.Detail), &orderInfo.DetailList); err == nil && orderInfo.Extras != "" {
|
||||
err = utils.UnmarshalUseNumber([]byte(orderInfo.Extras), &orderInfo.ExtraList)
|
||||
}
|
||||
}
|
||||
}
|
||||
return orderInfo, err
|
||||
}
|
||||
|
||||
func (a *API) OrderGetPartRefundFoods(orderID int64) (canRefundFoodList []*CanRefundFoodInfo, err error) {
|
||||
params := map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
}
|
||||
result, err := a.AccessAPI("order/getPartRefundFoods", true, params)
|
||||
if err == nil {
|
||||
err = utils.Map2StructByJson(result, &canRefundFoodList, false)
|
||||
}
|
||||
return canRefundFoodList, err
|
||||
}
|
||||
|
||||
func (a *API) OrderLogisticsPush(orderID int64, reason string) (err error) {
|
||||
_, err = a.AccessAPI("order/logistics/push", true, map[string]interface{}{
|
||||
KeyOrderID: orderID,
|
||||
|
||||
@@ -33,6 +33,14 @@ func TestOrderGetOrderDetail2(t *testing.T) {
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestOrderGetPartRefundFoods(t *testing.T) {
|
||||
result, err := api.OrderGetPartRefundFoods(25236870562694625)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestOrderReceived(t *testing.T) {
|
||||
err := api.OrderReceived(25236872740350976)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user