From e685418345183ec2e906aa1304feaf1909fecdbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 17 Jan 2024 15:38:18 +0800 Subject: [PATCH] 1 --- platformapi/mtwmapi/mtwmapi_test.go | 4 +- platformapi/mtwmapi/order.go | 37 +++-------------- platformapi/mtwmapi/order_page.go | 49 +++++++++++++++++++++++ platformapi/mtwmapi/order_test.go | 61 ++++++----------------------- 4 files changed, 68 insertions(+), 83 deletions(-) diff --git a/platformapi/mtwmapi/mtwmapi_test.go b/platformapi/mtwmapi/mtwmapi_test.go index 107fbc1f..5d2a6458 100644 --- a/platformapi/mtwmapi/mtwmapi_test.go +++ b/platformapi/mtwmapi/mtwmapi_test.go @@ -20,13 +20,13 @@ func init() { baseapi.Init(sugarLogger) // 菜市 - api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "") + //api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "") // 果园 //api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "") //商超 - //api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_u368I2OxTY4ys4wWuVVMOQ") //token_n4TwqCntWWuvQwAawzxC0w + api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_qO_Kv9pX4lHVTb2IX19JzQ") //token_n4TwqCntWWuvQwAawzxC0w cookieStr := ` acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1; ` diff --git a/platformapi/mtwmapi/order.go b/platformapi/mtwmapi/order.go index 8587a931..86d1b88a 100644 --- a/platformapi/mtwmapi/order.go +++ b/platformapi/mtwmapi/order.go @@ -765,6 +765,12 @@ func (a *API) OrderStatusAndPsInfo(params map[string]interface{}) (err error) { return err } +// ApplyCompensation 取消的订单申请订单赔付 +func (a *API) ApplyCompensation(param *ApplyCompensationRes) (err error) { + _, err = a.AccessAPI2("order/applyCompensation", false, utils.Struct2MapByJson(param), resultKeySuccessMsg, "") + return err +} + // 获取取消跑腿理由刘表 // https://open-shangou.meituan.com/home/docDetail/482 func (a *API) GetCancelDeliveryReason(orderId int64, appPoiCode string) (string, error) { @@ -784,21 +790,6 @@ func (a *API) GetCancelDeliveryReason(orderId int64, appPoiCode string) (string, return string(list), nil } -type DeliveryData struct { - Code int `json:"code"` - Title string `json:"title"` - ReasonList []*ReasonList `json:"reasonList"` - Msg string `json:"msg"` - DeliveryStatus int `json:"deliveryStatus"` -} - -type ReasonList struct { - Code string `json:"code"` - Content string `json:"content"` - PreCancelCode int `json:"preCancelCode"` - PreCancelMsg string `json:"preCancelMsg"` -} - // 取消跑腿配送 func (a *API) CancelLogisticsByWmOrderId(reasonCode, detailContent, appPoiCode, orderId string) error { param := &CancelOrderParam{ @@ -821,19 +812,3 @@ func (a *API) CancelLogisticsByWmOrderId(reasonCode, detailContent, appPoiCode, } return nil } - -type ResultMsg struct { - Data string `json:"data"` - Error *struct { - Code int `json:"code"` - Msg string `json:"msg"` - } -} - -// 取消跑腿配送请求参数 -type CancelOrderParam struct { - ReasonCode string `json:"reason_code"` // 取消原因code 请开发者一定要先调用 - DetailContent string `json:"detail_content"` // 取消原因 - AppPoiCode string `json:"app_poi_code"` // 门店号 - OrderId string `json:"order_id"` // 订单id -} diff --git a/platformapi/mtwmapi/order_page.go b/platformapi/mtwmapi/order_page.go index 11ccd2cd..ffad9e71 100644 --- a/platformapi/mtwmapi/order_page.go +++ b/platformapi/mtwmapi/order_page.go @@ -5,6 +5,11 @@ import ( "git.rosy.net.cn/baseapi/utils" ) +const ( + ApplyCompensationStatusOne = 110 // 第一次申请赔付 + ApplyCompensationStatusTwo = 120 // 第二次申请赔付 +) + type DistributeOrderDetail struct { WmOrderID int `json:"wm_order_id"` WmPoiID int `json:"wm_poi_id"` @@ -39,6 +44,50 @@ type DistributeOrderDetail struct { DelayPushSecond int `json:"delay_push_second"` } +type DeliveryData struct { + Code int `json:"code"` + Title string `json:"title"` + ReasonList []*ReasonList `json:"reasonList"` + Msg string `json:"msg"` + DeliveryStatus int `json:"deliveryStatus"` +} + +type ReasonList struct { + Code string `json:"code"` + Content string `json:"content"` + PreCancelCode int `json:"preCancelCode"` + PreCancelMsg string `json:"preCancelMsg"` +} + +type ResultMsg struct { + Data string `json:"data"` + Error *struct { + Code int `json:"code"` + Msg string `json:"msg"` + } +} + +// ApplyCompensationRes 申请赔付 +type ApplyCompensationRes struct { + OrderId int64 `json:"order_id"` // 订单id + Reason string `json:"reason"` // 原因 + ApplyStatus int `json:"apply_status"` // 申请状态类型:110-第一次申请;120-第二次申诉。 + Amount float64 `json:"amount"` // 申请赔付金额,单位是元 + //FoodData []FoodDataList `json:"food_data"` // 惨损商品列表 +} +type FoodDataList struct { + AppSpuCode string `json:"app_spu_code"` // 即商家中台系统里商品的编码 + SkuId string `json:"sku_id"` // SKU码(商家的规格编码) +} + +// 取消跑腿配送请求参数 +type CancelOrderParam struct { + ReasonCode string `json:"reason_code"` // 取消原因code 请开发者一定要先调用 + DetailContent string `json:"detail_content"` // 取消原因 + AppPoiCode string `json:"app_poi_code"` // 门店号 + OrderId string `json:"order_id"` // 订单id +} + //美团骑手修改小费,单位为元,最多小数点后一位 //order/receive/processed/w/distribute/tipAmount/v2?ignoreSetRouterProxy=true func (a *API) OrderModityTips(orderID, poiCode string, tipAmount float64) (err error) { diff --git a/platformapi/mtwmapi/order_test.go b/platformapi/mtwmapi/order_test.go index a4e593ff..0f837856 100644 --- a/platformapi/mtwmapi/order_test.go +++ b/platformapi/mtwmapi/order_test.go @@ -7,7 +7,6 @@ import ( "strings" "testing" "time" - "unicode" ) func TestOrderViewStatus(t *testing.T) { @@ -228,54 +227,16 @@ func TestOrderDelivering(t *testing.T) { t.Fatal(err) } -// 88 67 【组合菜】尖椒茄子(茄子500g 青尖椒200g)700g/组(茄子500g 青椒200g) -// 90 60 -func TestLen(t *testing.T) { - aa := "【组合菜】尖椒茄子(茄子500g 青尖椒200g)700g/组(茄子500g 青椒200g)" - var count int // 中文 - var punctZh int // 中文标点 - var punctEn int // 英文标点 - var punctAZ int // 字母 - var punctNum int // 字母 - var spance int // 空格 - for _, v := range aa { - if unicode.Is(unicode.Han, v) { // 中文 - count++ - continue - } - if unicode.IsPunct(v) { // 字符 - if v >= 1000 { - fmt.Println(v) - punctZh++ - } else { - punctEn++ - } - continue - } - if unicode.IsLetter(v) { - punctAZ++ - continue - } - if unicode.IsNumber(v) { - punctNum++ - continue - } - if unicode.IsSpace(v) { - spance++ - continue - } +func TestApplyCompensation(t *testing.T) { + param := &ApplyCompensationRes{ + OrderId: 3500902110034359123, + Reason: "申请退款", + ApplyStatus: 110, + Amount: 35.31, + //FoodData: nil, + } + err := api.ApplyCompensation(param) + if err != nil { + fmt.Println(err.Error()) } - fmt.Println("count:= ", count) - fmt.Println("count:= ", punctZh) - fmt.Println("count:= ", punctEn) - fmt.Println("count:= ", punctAZ) - fmt.Println("count:= ", punctNum) - - fmt.Println("all = ", (count*2)+(punctZh*2)+punctEn+punctAZ+punctNum+spance) -} - -func TestName(t *testing.T) { - data := map[int]int{101: 1, 102: 1, 103: 1} - - fmt.Println(data[1] == 1) }