From f987419ad73ad19ea098fb3f55a110c1c5a9c461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 19 Jan 2024 17:24:21 +0800 Subject: [PATCH 1/4] 1 --- platformapi/mtwmapi/act_test.go | 40 +++++++++++++++++++++++------ platformapi/mtwmapi/mtwmapi.go | 5 ++++ platformapi/mtwmapi/mtwmapi_test.go | 4 +-- 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/platformapi/mtwmapi/act_test.go b/platformapi/mtwmapi/act_test.go index 085e3300..eb3cedf6 100644 --- a/platformapi/mtwmapi/act_test.go +++ b/platformapi/mtwmapi/act_test.go @@ -66,15 +66,39 @@ func TestFulllDiscountShippingFeeList(t *testing.T) { } func TestRetailDiscountBatchSave(t *testing.T) { - result, _, err := api.RetailDiscountBatchSave2("18822904", 0, []*RetailDiscountActData{ + result, _, err := api.RetailDiscountBatchSave2("18702580", RetailActTypeDirectDown, []*RetailDiscountActData{ &RetailDiscountActData{ - AppFoodCode: "6094573", - StartTime: time.Now().Unix(), - EndTime: time.Now().Add(24 * time.Hour).Unix(), - OrderLimit: 1, - DayLimit: 9999, - SettingType: SettingTypeAsDiscount, - DiscountCoefficient: 9, + AppFoodCode: "6045386", + UserType: 0, + StartTime: 1705593600, + EndTime: 1717171199, + OrderLimit: 1, + DayLimit: -1, + SettingType: 1, + ActPrice: 0.5, + Sequence: 1, + }, + &RetailDiscountActData{ + AppFoodCode: "30700", + UserType: 0, + StartTime: 1705593600, + EndTime: 1717171199, + OrderLimit: 1, + DayLimit: -1, + SettingType: 1, + ActPrice: 0.8, + Sequence: 2, + }, + &RetailDiscountActData{ + AppFoodCode: "30686", + UserType: 0, + StartTime: 1705593600, + EndTime: 1717171199, + OrderLimit: 1, + DayLimit: -1, + SettingType: 1, + ActPrice: 1, + Sequence: 3, }, }) if err != nil { diff --git a/platformapi/mtwmapi/mtwmapi.go b/platformapi/mtwmapi/mtwmapi.go index ae6b76c0..b658f59e 100644 --- a/platformapi/mtwmapi/mtwmapi.go +++ b/platformapi/mtwmapi/mtwmapi.go @@ -5,6 +5,7 @@ import ( "crypto/md5" "fmt" "git.rosy.net.cn/baseapi/utils" + "git.rosy.net.cn/jx-callback/globals" "mime/multipart" "net/http" "net/url" @@ -145,6 +146,10 @@ func (a *API) AccessAPI2(cmd string, isGet bool, bizParams map[string]interface{ } signURL := a.genURL(cmd) + "?" params[signKey] = a.signParams(signURL, params) + if cmd == "act/retail/discount/batchsave" { + globals.SugarLogger.Debugf("========key := %s", params[signKey]) + globals.SugarLogger.Debugf("========key := %s", utils.Format4Output(params, false)) + } //globals.SugarLogger.Debugf("test mtCancelAct cmd=%s sig=%s", cmd, utils.Format4Output(params, false)) err = platformapi.AccessPlatformAPIWithRetry(a.client, func() *http.Request { diff --git a/platformapi/mtwmapi/mtwmapi_test.go b/platformapi/mtwmapi/mtwmapi_test.go index 5d2a6458..2d39bbea 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_qO_Kv9pX4lHVTb2IX19JzQ") //token_n4TwqCntWWuvQwAawzxC0w + //api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_qO_Kv9pX4lHVTb2IX19JzQ") //token_n4TwqCntWWuvQwAawzxC0w cookieStr := ` acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1; ` From be9ca465fad59e441c2586fc3a249aa11a5710c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 19 Jan 2024 18:04:30 +0800 Subject: [PATCH 2/4] 1 --- platformapi/mtwmapi/mtwmapi.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/platformapi/mtwmapi/mtwmapi.go b/platformapi/mtwmapi/mtwmapi.go index b658f59e..ae6b76c0 100644 --- a/platformapi/mtwmapi/mtwmapi.go +++ b/platformapi/mtwmapi/mtwmapi.go @@ -5,7 +5,6 @@ import ( "crypto/md5" "fmt" "git.rosy.net.cn/baseapi/utils" - "git.rosy.net.cn/jx-callback/globals" "mime/multipart" "net/http" "net/url" @@ -146,10 +145,6 @@ func (a *API) AccessAPI2(cmd string, isGet bool, bizParams map[string]interface{ } signURL := a.genURL(cmd) + "?" params[signKey] = a.signParams(signURL, params) - if cmd == "act/retail/discount/batchsave" { - globals.SugarLogger.Debugf("========key := %s", params[signKey]) - globals.SugarLogger.Debugf("========key := %s", utils.Format4Output(params, false)) - } //globals.SugarLogger.Debugf("test mtCancelAct cmd=%s sig=%s", cmd, utils.Format4Output(params, false)) err = platformapi.AccessPlatformAPIWithRetry(a.client, func() *http.Request { From 1da30493ccc05b911a992c98db969b0134d3da86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 22 Jan 2024 10:25:58 +0800 Subject: [PATCH 3/4] 1 --- platformapi/mtpsapi/shop_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platformapi/mtpsapi/shop_test.go b/platformapi/mtpsapi/shop_test.go index c4e9d052..40550f12 100644 --- a/platformapi/mtpsapi/shop_test.go +++ b/platformapi/mtpsapi/shop_test.go @@ -49,9 +49,10 @@ func TestShopCreate(t *testing.T) { func TestShopUpdate(t *testing.T) { shopInfo := &ShopInfo{ - ShopID: "667018", - ShopLng: 113015935, - ShopLat: 25776427, + ShopID: "667071", + ShopLng: 117122952, + ShopLat: 34244733, + ShopAddress: "徐州市泉山区临湖路与乐雅路湖西雅苑C区6栋扎堆地酒店对面", } _, err := api.ShopUpdate(shopInfo) if err != nil { From ba9335578b4caf68940457b2592856202aad5627 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 22 Jan 2024 15:45:45 +0800 Subject: [PATCH 4/4] 1 --- platformapi/mtwmapi/order_test.go | 2 +- platformapi/mtwmapi/shipping.go | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/platformapi/mtwmapi/order_test.go b/platformapi/mtwmapi/order_test.go index 0f837856..31236471 100644 --- a/platformapi/mtwmapi/order_test.go +++ b/platformapi/mtwmapi/order_test.go @@ -29,7 +29,7 @@ func getTimeFromTimestamp(timeStamp int64) time.Time { } func TestOrderGetOrderDetail(t *testing.T) { - result, err := api.OrderGetOrderDetail(1100830463015735279, false) + result, err := api.OrderGetOrderDetail(3800909491353265371, false) if err != nil { t.Fatal(err) } diff --git a/platformapi/mtwmapi/shipping.go b/platformapi/mtwmapi/shipping.go index 2770a509..55a98369 100644 --- a/platformapi/mtwmapi/shipping.go +++ b/platformapi/mtwmapi/shipping.go @@ -13,19 +13,20 @@ const ( ) const ( - PeiSongTypeSelf = "0000" // 商家自配 - PeiSongTypeQuHuo = "0002" // 趣活 - PeiSongTypeDada = "0016" // 达达 - PeiSongTypeE = "0033" // E代送 - PeiSongTypeMTZSJM = "1001" // 美团专送-加盟 - PeiSongTypeMTZSZJ = "1002" // 美团专送-自建 - PeiSongTypeMTZSPT = "1003" // 美团跑腿(原众包) - PeiSongTypeMTZSDL = "1004" // 美团专送-城市代理 - PeiSongTypeJiaoMa = "2001" // 角马 - PeiSongTypeKuaiDi = "2002" // 快送 - PeiSongTypeWholeCity = "2010" // 全城送 - PeiSongTypeMixed = "3001" // 混合送(即美团专送+快送) - PeiSongTypeQiKe = "4015" // 企客远距离配送 + PeiSongTypeSelf = "0000" // 商家自配 + PeiSongTypeQuHuo = "0002" // 趣活 + PeiSongTypeDada = "0016" // 达达 + PeiSongTypeE = "0033" // E代送 + PeiSongTypeMTZSJM = "1001" // 美团专送-加盟 + PeiSongTypeMTZSZJ = "1002" // 美团专送-自建 + PeiSongTypeMTZSPT = "1003" // 美团跑腿(原众包) + PeiSongTypeMTZSDL = "1004" // 美团专送-城市代理 + PeiSongTypeJiaoMa = "2001" // 角马 + PeiSongTypeKuaiDi = "2002" // 快送 + PeiSongTypeWholeCity = "2010" // 全城送 + PeiSongTypeMixed = "3001" // 混合送(即美团专送+快送) + PeiSongTypeQiKe = "4015" // 企客远距离配送 + PeiSongTypeMixedExpressQiKe = "30012002" // 混合快送 ) func (a *API) ShippingSave(poiCode string, area string, minPrice, shippingFee float32) (err error) {