- mtwmapi.OrderGetOrderDetail2
This commit is contained in:
@@ -163,7 +163,7 @@ func TestOrderAcceptOperate(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestOrderJDZBDelivery(t *testing.T) {
|
func TestOrderJDZBDelivery(t *testing.T) {
|
||||||
result, err := api.OrderJDZBDelivery("813344594000041", "")
|
result, err := api.OrderJDZBDelivery("911350836000622", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err.Error())
|
t.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,15 @@ func TestDeliveryEndOrder(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetAfsService(t *testing.T) {
|
func TestGetAfsService(t *testing.T) {
|
||||||
result, err := api.GetAfsService2("22534674")
|
result, err := api.GetAfsService("22565438")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err.Error())
|
||||||
|
}
|
||||||
|
sugarLogger.Debug(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetAfsService2(t *testing.T) {
|
||||||
|
result, err := api.GetAfsService2("22565438")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err.Error())
|
t.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,21 +38,19 @@ type CallbackResponse struct {
|
|||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CallbackSysInfo struct {
|
// 全额退款没有Food, FoodList, Money项
|
||||||
|
type CallbackRefundInfo struct {
|
||||||
Timestamp int64 `json:"timestamp"`
|
Timestamp int64 `json:"timestamp"`
|
||||||
AppID string `json:"app_id"`
|
AppID string `json:"app_id"`
|
||||||
Sig string `json:"sig"`
|
Sig string `json:"sig"`
|
||||||
}
|
|
||||||
|
|
||||||
// 全额退款没有Food, FoodList, Money项
|
OrderID int64 `json:"order_id"`
|
||||||
type CallbackRefundInfo struct {
|
NotifyType string `json:"notify_type"`
|
||||||
CallbackSysInfo
|
Reason string `json:"reason"`
|
||||||
OrderID int64 `json:"order_id"`
|
ResType int `json:"res_type"`
|
||||||
NotifyType string `json:"notify_type"`
|
IsAppeal int `json:"is_appeal"`
|
||||||
Reason string `json:"reason"`
|
Pictures string `json:"pictures"`
|
||||||
ResType int `json:"res_type"`
|
PictureList []string `json:"pictureList"`
|
||||||
IsAppeal int `json:"is_appeal"`
|
|
||||||
Pictures string `json:"pictures"`
|
|
||||||
|
|
||||||
Food string `json:"food"`
|
Food string `json:"food"`
|
||||||
FoodList []*RefundSkuDetail `json:"foodList"`
|
FoodList []*RefundSkuDetail `json:"foodList"`
|
||||||
@@ -116,6 +114,9 @@ func (a *API) GetCallbackMsg(request *http.Request) (msg *CallbackMsg, callbackR
|
|||||||
if refundData.Food != "" {
|
if refundData.Food != "" {
|
||||||
utils.UnmarshalUseNumber([]byte(refundData.Food), &refundData.FoodList)
|
utils.UnmarshalUseNumber([]byte(refundData.Food), &refundData.FoodList)
|
||||||
}
|
}
|
||||||
|
if refundData.Pictures != "" {
|
||||||
|
utils.UnmarshalUseNumber([]byte(refundData.Pictures), &refundData.PictureList)
|
||||||
|
}
|
||||||
msg.Data = refundData
|
msg.Data = refundData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,6 +108,58 @@ type RefundOrderDetail struct {
|
|||||||
WmOrderIDView int64 `json:"wm_order_id_view"`
|
WmOrderIDView int64 `json:"wm_order_id_view"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type OrderInfo struct {
|
||||||
|
AppOrderCode string `json:"app_order_code"`
|
||||||
|
AppPoiCode string `json:"app_poi_code"`
|
||||||
|
AvgSendTime int `json:"avg_send_time"`
|
||||||
|
BackupRecipientPhone string `json:"backup_recipient_phone"`
|
||||||
|
Caution string `json:"caution"`
|
||||||
|
CityID int `json:"city_id"`
|
||||||
|
Ctime int64 `json:"ctime"`
|
||||||
|
DaySeq int `json:"day_seq"`
|
||||||
|
DeliveryTime int `json:"delivery_time"`
|
||||||
|
Detail string `json:"detail"`
|
||||||
|
DinnersNumber int `json:"dinners_number"`
|
||||||
|
ExpectDeliverTime int `json:"expect_deliver_time"`
|
||||||
|
Extras string `json:"extras"`
|
||||||
|
HasInvoiced int `json:"has_invoiced"`
|
||||||
|
InvoiceTitle string `json:"invoice_title"`
|
||||||
|
IsFavorites bool `json:"is_favorites"`
|
||||||
|
IsPoiFirstOrder bool `json:"is_poi_first_order"`
|
||||||
|
IsPre int `json:"is_pre"`
|
||||||
|
IsThirdShipping int `json:"is_third_shipping"`
|
||||||
|
Latitude float64 `json:"latitude"`
|
||||||
|
LogisticsCode string `json:"logistics_code"`
|
||||||
|
Longitude float64 `json:"longitude"`
|
||||||
|
OrderCompletedTime int `json:"order_completed_time"`
|
||||||
|
OrderConfirmTime int `json:"order_confirm_time"`
|
||||||
|
OrderID int64 `json:"order_id"`
|
||||||
|
OrderSendTime int `json:"order_send_time"`
|
||||||
|
OriginalPrice float64 `json:"original_price"`
|
||||||
|
PackageBagMoney int `json:"package_bag_money"`
|
||||||
|
PayType int `json:"pay_type"`
|
||||||
|
PickType int `json:"pick_type"`
|
||||||
|
PoiReceiveDetail string `json:"poi_receive_detail"`
|
||||||
|
RecipientAddress string `json:"recipient_address"`
|
||||||
|
RecipientName string `json:"recipient_name"`
|
||||||
|
RecipientPhone string `json:"recipient_phone"`
|
||||||
|
Remark string `json:"remark"`
|
||||||
|
Result string `json:"result"`
|
||||||
|
ShipperPhone string `json:"shipper_phone"`
|
||||||
|
ShippingFee int `json:"shipping_fee"`
|
||||||
|
ShippingType int `json:"shipping_type"`
|
||||||
|
SourceID int `json:"source_id"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
TaxpayerID string `json:"taxpayer_id"`
|
||||||
|
Total float64 `json:"total"`
|
||||||
|
Utime int64 `json:"utime"`
|
||||||
|
WmOrderIDView int64 `json:"wm_order_id_view"`
|
||||||
|
WmPoiAddress string `json:"wm_poi_address"`
|
||||||
|
WmPoiID int `json:"wm_poi_id"`
|
||||||
|
WmPoiName string `json:"wm_poi_name"`
|
||||||
|
WmPoiPhone string `json:"wm_poi_phone"`
|
||||||
|
}
|
||||||
|
|
||||||
func (a *API) OrderReceived(orderID int64) (err error) {
|
func (a *API) OrderReceived(orderID int64) (err error) {
|
||||||
_, err = a.AccessAPI("order/poi_received", true, map[string]interface{}{
|
_, err = a.AccessAPI("order/poi_received", true, map[string]interface{}{
|
||||||
KeyOrderID: orderID,
|
KeyOrderID: orderID,
|
||||||
@@ -195,6 +247,14 @@ func (a *API) OrderGetOrderDetail(orderID int64, isMTLogistics bool) (orderInfo
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *API) OrderGetOrderDetail2(orderID int64, isMTLogistics bool) (orderInfo *OrderInfo, err error) {
|
||||||
|
orderMap, err := a.OrderGetOrderDetail(orderID, isMTLogistics)
|
||||||
|
if err == nil {
|
||||||
|
err = utils.Map2StructByJson(orderMap, &orderInfo, false)
|
||||||
|
}
|
||||||
|
return orderInfo, err
|
||||||
|
}
|
||||||
|
|
||||||
func (a *API) OrderLogisticsPush(orderID int64, reason string) (err error) {
|
func (a *API) OrderLogisticsPush(orderID int64, reason string) (err error) {
|
||||||
_, err = a.AccessAPI("order/logistics/push", true, map[string]interface{}{
|
_, err = a.AccessAPI("order/logistics/push", true, map[string]interface{}{
|
||||||
KeyOrderID: orderID,
|
KeyOrderID: orderID,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ func TestOrderViewStatus(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestOrderGetOrderDetail(t *testing.T) {
|
func TestOrderGetOrderDetail(t *testing.T) {
|
||||||
result, err := api.OrderGetOrderDetail(25236872740350976, false)
|
result, err := api.OrderGetOrderDetail(69299961008767093, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@@ -25,6 +25,14 @@ func TestOrderGetOrderDetail(t *testing.T) {
|
|||||||
t.Log(utils.Format4Output(result, false))
|
t.Log(utils.Format4Output(result, false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestOrderGetOrderDetail2(t *testing.T) {
|
||||||
|
result, err := api.OrderGetOrderDetail2(68689721416501384, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Log(utils.Format4Output(result, false))
|
||||||
|
}
|
||||||
|
|
||||||
func TestOrderReceived(t *testing.T) {
|
func TestOrderReceived(t *testing.T) {
|
||||||
err := api.OrderReceived(25236872740350976)
|
err := api.OrderReceived(25236872740350976)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -486,6 +486,7 @@ func Struct2FlatMap(obj interface{}) map[string]interface{} {
|
|||||||
return FlatMap(m)
|
return FlatMap(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// !!! 此函数好像不支持struct是内嵌结构的
|
||||||
func Map2StructByJson(inObj interface{}, outObjAddr interface{}, weaklyTypedInput bool) (err error) {
|
func Map2StructByJson(inObj interface{}, outObjAddr interface{}, weaklyTypedInput bool) (err error) {
|
||||||
decoder, _ := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
decoder, _ := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||||
TagName: "json",
|
TagName: "json",
|
||||||
|
|||||||
Reference in New Issue
Block a user