From 2f1bfa45f4e20fdd7fe22b0a705fd1627d122bba Mon Sep 17 00:00:00 2001 From: richboo111 Date: Fri, 8 Sep 2023 18:19:16 +0800 Subject: [PATCH] 1 --- platformapi/sfps2/callback.go | 50 +++++++++++++++-------------------- platformapi/sfps2/sf_test.go | 6 ++--- 2 files changed, 24 insertions(+), 32 deletions(-) diff --git a/platformapi/sfps2/callback.go b/platformapi/sfps2/callback.go index 0df542b6..46ef48cf 100644 --- a/platformapi/sfps2/callback.go +++ b/platformapi/sfps2/callback.go @@ -64,26 +64,19 @@ type RiderRecall struct { // OrderComplete 订单完成回调 type OrderComplete struct { - OrderID string `json:"order_id"` - ShopId float64 `json:"shop_id"` // 店铺ID - OutOrderID string `json:"out_order_id"` - OrderStatus float64 `json:"order_status"` //17配送员点击完成 - StatusDesc string `json:"status_desc"` //状态描述 - RiderName string `json:"rider_name"` - RiderPhone string `json:"rider_phone"` - PushTime int `json:"push_time"` //完成时间 - TotalPrice float64 `json:"total_price"` - DeliveryDistanceMeter float64 `json:"delivery_distance_meter"` - WeightGram float64 `json:"weight_gram"` - StartTime int `json:"start_time"` - ExpectTime int `json:"expect_time"` - TotalPayMoney float64 `json:"total_pay_money"` - RealPayMoney float64 `json:"real_pay_money"` - CouponsTotalFee float64 `json:"coupons_total_fee"` - SettlementType float64 `json:"settlement_type"` - PckUpCode float64 `json:"pck_up_code"` - CompleteCode float64 `json:"complete_code"` - OverflowFee float64 `json:"overflow_fee"` + OperatorName string `json:"operator_name"` //配送员姓名 + OperatorPhone string `json:"operator_phone"` //配送员电话 + OrderStatus float64 `json:"order_status"` //17配送员点击完成 + PushTime int `json:"push_time"` //完成时间 + ReceiRptType float64 `json:"receiRpt_type"` + RiderLat float64 `json:"rider_lat"` + RiderLng float64 `json:"rider_lng"` + SfOrderID string `json:"sf_order_id"` + SfUcode string `json:"sf_ucode"` + ShopId float64 `json:"shop_id"` // 店铺ID + ShopOrderID string `json:"shop_order_id"` + StatusDesc string `json:"status_desc"` //状态描述 + UrlIndex string `json:"url_index"` } // SFCancel 顺丰原因订单取消回调 @@ -147,22 +140,21 @@ func (a *API) GetCallbackUrlIndex(request *http.Request) (map[string]interface{} } var ( - urlIndex = "" - orderStatus float64 - temp = map[string]interface{}{} + urlIndex = "" + temp = map[string]interface{}{} ) if err = json.Unmarshal(data, &temp); err == nil { globals.SugarLogger.Debugf("GetCallbackUrlIndex temp=%s", utils.Format4Output(temp, false)) urlIndex = temp["url_index"].(string) - orderStatus = temp["order_status"].(float64) - globals.SugarLogger.Debugf("GetCallbackUrlIndex urlIndex=%s,orderStatus=%d", urlIndex, int(orderStatus)) + //orderStatus = temp["order_status"].(float64) + globals.SugarLogger.Debugf("GetCallbackUrlIndex urlIndex=%s", urlIndex) } result := make(map[string]interface{}, 0) - if orderStatus == utils.Int2Float64(OrderStatusFinished) { - urlIndex = UrlIndexOrderComplete - globals.SugarLogger.Debugf("我在这 urlIndex=%s", urlIndex) - } + //if orderStatus == utils.Int2Float64(OrderStatusFinished) { + // urlIndex = UrlIndexOrderComplete + // globals.SugarLogger.Debugf("我在这 urlIndex=%s", urlIndex) + //} switch urlIndex { case UrlIndexRiderStatus: retVal := RiderStatus{} diff --git a/platformapi/sfps2/sf_test.go b/platformapi/sfps2/sf_test.go index cf2b09ef..1df2ba97 100644 --- a/platformapi/sfps2/sf_test.go +++ b/platformapi/sfps2/sf_test.go @@ -65,12 +65,12 @@ func TestCreateOrder(t *testing.T) { DevId: AppID, ShopId: TestSFStoreID, ShopType: 1, - ShopOrderId: "20230908-3", + ShopOrderId: "2023090805", OrderSequence: "测试", OrderSource: OrderSourceELM, - OrderTime: 1694165716, + OrderTime: 1694167348, LbsType: LbsTypeGD, - PushTime: 1694165716, + PushTime: 1694167348, Version: 19, ReturnFlag: 511, Receive: &ReceiveAddress{