From f52ffa5a89f7cc59099afaec7cbeba00120a78c7 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Fri, 8 Sep 2023 14:54:43 +0800 Subject: [PATCH 1/7] 1 --- platformapi/mtwmapi/retail_test.go | 6 +++++- platformapi/sfps2/sf_model.go | 18 ++++++++++++++++-- platformapi/tao_vegetable/store_test.go | 10 ++++++---- 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/platformapi/mtwmapi/retail_test.go b/platformapi/mtwmapi/retail_test.go index 1011db01..20c2689f 100644 --- a/platformapi/mtwmapi/retail_test.go +++ b/platformapi/mtwmapi/retail_test.go @@ -387,10 +387,14 @@ func TestCategoryAttrList(t *testing.T) { //特殊属性查询 func TestCategoryAttrValueList(t *testing.T) { - result, err := api.CategoryAttrValueList(1200000088, "散装糖果") + result, err := api.CategoryAttrValueList(1200000088, "【常用调味】干花椒 红花椒 ") + if len(result) > 0 { + fmt.Println("jejeje") + } if err != nil { t.Fatal(err) } + t.Log(utils.Format4Output(result, false)) } diff --git a/platformapi/sfps2/sf_model.go b/platformapi/sfps2/sf_model.go index 61896fab..32731930 100644 --- a/platformapi/sfps2/sf_model.go +++ b/platformapi/sfps2/sf_model.go @@ -20,7 +20,7 @@ const ( DefaultVersion = 19 //参照文档主版本号填写 如:文档版本号1.9,version=19,推荐使用版本19 ) -//各城市正式店铺id +// SFCityStoreIDs 各城市正式店铺id var SFCityStoreIDs = map[string]string{ "怀化市": "3270454065601", "郴州市": "3270454085329", @@ -51,7 +51,7 @@ var SFCityStoreIDs = map[string]string{ "许昌市": "3270458247585", "开封市": "3270458296977", "商丘市": "3270641341457", - "驻马店市": "3270641372769", + "驻马市": "3270641372769", "新乡市": "3270641398977", "信阳市": "3270641464177", "安阳市": "3270641489553", @@ -67,6 +67,20 @@ var SFCityStoreIDs = map[string]string{ "承德市": "3270459200625", "秦皇岛市": "3270459223617", "张家口市": "3270459240321", + "武汉市": "3270468391969", + "襄阳市": "3270468418785", + "宜昌市": "3270468434017", + "荆州市": "3270468445137", + "荆门市": "3270468456545", + "孝感市": "3270468472897", + "鄂州店": "3270527285137", + "黄石市": "3270527303521", + "南宁市": "3270650685793", + "桂林市": "3270650714881", + "三亚市": "3270650742017", + "海口市": "3270650813681", + "柳州市": "3270650844193", + "北海市": "3270650890577", } const ( diff --git a/platformapi/tao_vegetable/store_test.go b/platformapi/tao_vegetable/store_test.go index f9aa2a8e..f8472323 100644 --- a/platformapi/tao_vegetable/store_test.go +++ b/platformapi/tao_vegetable/store_test.go @@ -138,10 +138,12 @@ func TestUpdateStoreTest(t *testing.T) { } func TestShopUpdateStatus(t *testing.T) { - err := apiTao.ShopUpdateStatus("JX667321", 1) - if err != nil { - fmt.Println(err) - } + value := int(172736400) + fmt.Println(float64(value) / 1000000) + //err := apiTao.ShopUpdateStatus("JX667321", 1) + //if err != nil { + // fmt.Println(err) + //} } func TestSFStore(t *testing.T) { From 48cb5b9d4275efea2b59e813bd78d98ab3253a65 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Fri, 8 Sep 2023 16:38:41 +0800 Subject: [PATCH 2/7] 1 --- platformapi/sfps2/callback.go | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/platformapi/sfps2/callback.go b/platformapi/sfps2/callback.go index 44a2eff0..6f00161c 100644 --- a/platformapi/sfps2/callback.go +++ b/platformapi/sfps2/callback.go @@ -64,20 +64,20 @@ type RiderRecall struct { // OrderComplete 订单完成回调 type OrderComplete struct { - OperatorName string `json:"operator_name"` //配送员姓名 - OperatorPhone string `json:"operator_phone"` //配送员电话 - OrderStatus float64 `json:"order_status"` //17配送员点击完成 - PushTime int `json:"push_time"` //完成时间 - ReceiptType float64 `json:"receipt_type"` //1:正常签收, 2:商家退回签收 - RiderLng string `json:"rider_lng"` //配送员位置经度 - RiderLat string `json:"rider_lat"` //配送员位置纬度 - SFOrderID string `json:"sf_order_id"` //顺丰订单ID - SFUCode string `json:"sf_ucode"` - ShopId float64 `json:"shop_id"` // 店铺ID - ShopOrderID string `json:"shop_order_id"` //商家订单ID - UrlIndex string `json:"url_index"` //回调url前缀 - StatusDesc string `json:"status_desc"` //状态描述 - //PickUpPic string `json:"pickup_pic"` //只有在店铺打开妥投照片回调开关且有妥投照片时才有此字段 + OperatorName string `json:"operator_name"` //配送员姓名 + //OperatorPhone string `json:"operator_phone"` //配送员电话 + OrderStatus float64 `json:"order_status"` //17配送员点击完成 + PushTime int `json:"push_time"` //完成时间 + ReceiptType float64 `json:"receipt_type"` //1:正常签收, 2:商家退回签收 + RiderLng string `json:"rider_lng"` //配送员位置经度 + RiderLat string `json:"rider_lat"` //配送员位置纬度 + SFOrderID string `json:"sf_order_id"` //顺丰订单ID + SFUCode string `json:"sf_ucode"` + ShopId float64 `json:"shop_id"` // 店铺ID + ShopOrderID string `json:"shop_order_id"` //商家订单ID + UrlIndex string `json:"url_index"` //回调url前缀 + StatusDesc string `json:"status_desc"` //状态描述 + PickUpPic string `json:"pickup_pic"` //只有在店铺打开妥投照片回调开关且有妥投照片时才有此字段 } From 419df0dc52c6ca9185c9606327971f82546239be Mon Sep 17 00:00:00 2001 From: richboo111 Date: Fri, 8 Sep 2023 17:11:38 +0800 Subject: [PATCH 3/7] 1 --- platformapi/sfps2/callback.go | 35 ++++++++++++++++++++--------------- platformapi/sfps2/sf_test.go | 12 +++++++----- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/platformapi/sfps2/callback.go b/platformapi/sfps2/callback.go index 6f00161c..36a780fd 100644 --- a/platformapi/sfps2/callback.go +++ b/platformapi/sfps2/callback.go @@ -64,21 +64,26 @@ type RiderRecall struct { // OrderComplete 订单完成回调 type OrderComplete struct { - OperatorName string `json:"operator_name"` //配送员姓名 - //OperatorPhone string `json:"operator_phone"` //配送员电话 - OrderStatus float64 `json:"order_status"` //17配送员点击完成 - PushTime int `json:"push_time"` //完成时间 - ReceiptType float64 `json:"receipt_type"` //1:正常签收, 2:商家退回签收 - RiderLng string `json:"rider_lng"` //配送员位置经度 - RiderLat string `json:"rider_lat"` //配送员位置纬度 - SFOrderID string `json:"sf_order_id"` //顺丰订单ID - SFUCode string `json:"sf_ucode"` - ShopId float64 `json:"shop_id"` // 店铺ID - ShopOrderID string `json:"shop_order_id"` //商家订单ID - UrlIndex string `json:"url_index"` //回调url前缀 - StatusDesc string `json:"status_desc"` //状态描述 - PickUpPic string `json:"pickup_pic"` //只有在店铺打开妥投照片回调开关且有妥投照片时才有此字段 - + 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"` } // SFCancel 顺丰原因订单取消回调 diff --git a/platformapi/sfps2/sf_test.go b/platformapi/sfps2/sf_test.go index cf58b84c..cba6cf29 100644 --- a/platformapi/sfps2/sf_test.go +++ b/platformapi/sfps2/sf_test.go @@ -7,8 +7,8 @@ import ( "testing" ) -//var api = New(AppID, AppKey)//测试 -var api = New(AppID2, AppKey2) //正式 +var api = New(AppID, AppKey) //测试 +//var api = New(AppID2, AppKey2) //正式 const ( //正式环境 @@ -64,11 +64,13 @@ func TestCreateOrder(t *testing.T) { param := &CreateOrderReq{ DevId: AppID, ShopId: TestSFStoreID, - ShopOrderId: "20230525Test", + ShopType: 1, + ShopOrderId: "20230908Test", OrderSequence: "测试", OrderSource: OrderSourceELM, - OrderTime: 1684997166, - PushTime: 1684997166, + OrderTime: 1694163550, + LbsType: LbsTypeGD, + PushTime: 1694163550, Version: 19, ReturnFlag: 511, Receive: &ReceiveAddress{ From 678545131a0d792da759b457954aa0ac1fac28e7 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Fri, 8 Sep 2023 17:33:48 +0800 Subject: [PATCH 4/7] 1 --- platformapi/sfps2/callback.go | 12 ++++++++---- platformapi/sfps2/sf_test.go | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/platformapi/sfps2/callback.go b/platformapi/sfps2/callback.go index 36a780fd..38284583 100644 --- a/platformapi/sfps2/callback.go +++ b/platformapi/sfps2/callback.go @@ -147,17 +147,21 @@ func (a *API) GetCallbackUrlIndex(request *http.Request) (map[string]interface{} } var ( - urlIndex = "" - temp = map[string]interface{}{} + urlIndex = "" + orderStatus float64 + 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) - fmt.Println(urlIndex) + orderStatus = temp["order_status"].(float64) + globals.SugarLogger.Debugf("GetCallbackUrlIndex urlIndex=%s,orderStatus=%d", urlIndex, orderStatus) } result := make(map[string]interface{}, 0) - + if orderStatus == OrderStatusFinished { + urlIndex = UrlIndexOrderComplete + } switch urlIndex { case UrlIndexRiderStatus: retVal := RiderStatus{} diff --git a/platformapi/sfps2/sf_test.go b/platformapi/sfps2/sf_test.go index cba6cf29..0dcaaef7 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: "20230908Test", + ShopOrderId: "20230908-2", OrderSequence: "测试", OrderSource: OrderSourceELM, - OrderTime: 1694163550, + OrderTime: 1694165402, LbsType: LbsTypeGD, - PushTime: 1694163550, + PushTime: 1694165402, Version: 19, ReturnFlag: 511, Receive: &ReceiveAddress{ From 7e72d7e819828028f421f08a9c09b48c9a4a05aa Mon Sep 17 00:00:00 2001 From: richboo111 Date: Fri, 8 Sep 2023 17:45:45 +0800 Subject: [PATCH 5/7] 1 --- platformapi/sfps2/callback.go | 5 +++-- platformapi/sfps2/sf_test.go | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/platformapi/sfps2/callback.go b/platformapi/sfps2/callback.go index 38284583..0df542b6 100644 --- a/platformapi/sfps2/callback.go +++ b/platformapi/sfps2/callback.go @@ -155,12 +155,13 @@ func (a *API) GetCallbackUrlIndex(request *http.Request) (map[string]interface{} 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, orderStatus) + globals.SugarLogger.Debugf("GetCallbackUrlIndex urlIndex=%s,orderStatus=%d", urlIndex, int(orderStatus)) } result := make(map[string]interface{}, 0) - if orderStatus == OrderStatusFinished { + if orderStatus == utils.Int2Float64(OrderStatusFinished) { urlIndex = UrlIndexOrderComplete + globals.SugarLogger.Debugf("我在这 urlIndex=%s", urlIndex) } switch urlIndex { case UrlIndexRiderStatus: diff --git a/platformapi/sfps2/sf_test.go b/platformapi/sfps2/sf_test.go index 0dcaaef7..cf2b09ef 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-2", + ShopOrderId: "20230908-3", OrderSequence: "测试", OrderSource: OrderSourceELM, - OrderTime: 1694165402, + OrderTime: 1694165716, LbsType: LbsTypeGD, - PushTime: 1694165402, + PushTime: 1694165716, Version: 19, ReturnFlag: 511, Receive: &ReceiveAddress{ From 2f1bfa45f4e20fdd7fe22b0a705fd1627d122bba Mon Sep 17 00:00:00 2001 From: richboo111 Date: Fri, 8 Sep 2023 18:19:16 +0800 Subject: [PATCH 6/7] 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{ From c76c787b46f9cfabd4d3885cbf06ca8039a3fe83 Mon Sep 17 00:00:00 2001 From: richboo111 Date: Fri, 8 Sep 2023 18:30:33 +0800 Subject: [PATCH 7/7] 1 --- platformapi/sfps2/callback.go | 7 ------- platformapi/sfps2/sf_test.go | 6 +++--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/platformapi/sfps2/callback.go b/platformapi/sfps2/callback.go index 46ef48cf..f7bc65b9 100644 --- a/platformapi/sfps2/callback.go +++ b/platformapi/sfps2/callback.go @@ -144,17 +144,10 @@ func (a *API) GetCallbackUrlIndex(request *http.Request) (map[string]interface{} 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", urlIndex) } result := make(map[string]interface{}, 0) - //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 1df2ba97..0389259a 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: "2023090805", + ShopOrderId: "2023090806", OrderSequence: "测试", OrderSource: OrderSourceELM, - OrderTime: 1694167348, + OrderTime: 1694168441, LbsType: LbsTypeGD, - PushTime: 1694167348, + PushTime: 1694168441, Version: 19, ReturnFlag: 511, Receive: &ReceiveAddress{