From 8a60851d4d87035f4b2a99067828343545a9c02d Mon Sep 17 00:00:00 2001 From: suyl <770236076@qq.com> Date: Tue, 17 Aug 2021 10:46:35 +0800 Subject: [PATCH] aa --- platformapi/dingdingapi/callback.go | 12 +++ platformapi/ebaiapi/order_test.go | 2 +- platformapi/ebaiapi/shop_test.go | 21 ++--- platformapi/jdapi/promotion_audit_test.go | 2 +- platformapi/jdshopapi/store_page_test.go | 77 ++++++++++++++++++- platformapi/mtwmapi/act_test.go | 2 +- platformapi/mtwmapi/mtwmapi_test.go | 4 +- .../tonglianpayapi/tonglianpayapi_test.go | 5 +- 8 files changed, 107 insertions(+), 18 deletions(-) diff --git a/platformapi/dingdingapi/callback.go b/platformapi/dingdingapi/callback.go index 82ab8aa2..40afb86f 100644 --- a/platformapi/dingdingapi/callback.go +++ b/platformapi/dingdingapi/callback.go @@ -44,6 +44,18 @@ func (a *API) Err2CallbackResponse(err error) *CallbackResponse { return a.PackCallbackResult(err.Error()) } +func (a *API) SetCallbackToken(token string) { + a.locker.RLock() + defer a.locker.RUnlock() + a.callbackToken = token +} + +func (a *API) SetCallbackAESKey(b []byte) { + a.locker.RLock() + defer a.locker.RUnlock() + a.callbackAESKey = b +} + func (a *API) GetCallbackToken() string { a.locker.RLock() defer a.locker.RUnlock() diff --git a/platformapi/ebaiapi/order_test.go b/platformapi/ebaiapi/order_test.go index a115d3de..52516a48 100644 --- a/platformapi/ebaiapi/order_test.go +++ b/platformapi/ebaiapi/order_test.go @@ -7,7 +7,7 @@ import ( ) func TestOrderGet(t *testing.T) { - result, err := api.OrderGet("2157781636259071682") + result, err := api.OrderGet("5032717275039729232") if err != nil { t.Fatal(err) } else { diff --git a/platformapi/ebaiapi/shop_test.go b/platformapi/ebaiapi/shop_test.go index 10394985..f6226d81 100644 --- a/platformapi/ebaiapi/shop_test.go +++ b/platformapi/ebaiapi/shop_test.go @@ -79,16 +79,17 @@ func TestShopAptitudeGet(t *testing.T) { func TestShopUpdate(t *testing.T) { params := map[string]interface{}{ - KeyName: "好菜鲜生-测试店", - KeyPhone: "13812345678", - KeyBaiduShopID: testShopBaiduID, - "longitude": 116.307884, - "latitude": 40.036828, - "coord_type": "amap", - "province": "131", - "city": "131", - "county": "1960", - "address": "北京市海淀区上地信息路甲9号", + //KeyName: "好菜鲜生(龙宫市场店)", + //KeyPhone: "13812345678", + KeyBaiduShopID: "32267358118", + //"longitude": 116.307884, + //"latitude": 40.036828, + //"coord_type": "amap", + //"province": "131", + //"city": "131", + //"county": "1960", + //"address": "北京市海淀区上地信息路甲9号", + "shop_logo": "http://image.jxc4.com/image/e078b225d7b232b4497a689dbf65159e.jpg", } err := api.ShopUpdate(params) if err != nil { diff --git a/platformapi/jdapi/promotion_audit_test.go b/platformapi/jdapi/promotion_audit_test.go index 70ec955a..2527640d 100644 --- a/platformapi/jdapi/promotion_audit_test.go +++ b/platformapi/jdapi/promotion_audit_test.go @@ -24,7 +24,7 @@ func TestQueryPromotionInfo(t *testing.T) { func TestQueryPromotionSku(t *testing.T) { skuIDs := []int64{ - 2023335105, + 2022336911, // 2023335104, // 2023335088, // 2023335057, diff --git a/platformapi/jdshopapi/store_page_test.go b/platformapi/jdshopapi/store_page_test.go index 837e7acd..7668723d 100644 --- a/platformapi/jdshopapi/store_page_test.go +++ b/platformapi/jdshopapi/store_page_test.go @@ -226,7 +226,82 @@ func TestUpdateDeliveryPromise(t *testing.T) { } func TestUploadImageNew(t *testing.T) { - fmt.Println(int(utils.Str2Time("2021-03-09 23:59:59").Sub(utils.Str2Time("2021-03-07 00:00:00")).Hours()) / 24) + s := "PLLPLA" + fmt.Println(checkRecord(s)) +} + +func checkRecord(s string) bool { + countL := 0 + countA := 0 + for _, v := range s { + if v == 'A' { + countA++ + if countA > 1 { + return false + } + } + if v == 'L' { + countL++ + if countL > 2 { + return false + } + } else { + countL = 0 + } + } + return true +} + +func sink(array []int, length int) { + start := 0 + for { + //2*n+1 可以画图就知道为什么了,是左边子节点 + next := 2*start + 1 + if next > length { + break + } + if next+1 <= length && array[next+1] < array[next] { + next++ + } + + //上层小于下面,不用互换了 + if array[start] <= array[next] { + break + } + //互换继续下沉 + array[start], array[next] = array[next], array[start] + start = next + } +} + +//堆 +//top k +func topk(s []int, k, i int) { + for { + left := i*2 + 1 + right := i*2 + 2 + if i < 0 { + break + } + if right == k { + if s[i] < s[left] { + s[i], s[left] = s[left], s[i] + } + } else { + if s[i] < s[left] || s[i] < s[right] { + if s[left] < s[right] { + s[i], s[right] = s[right], s[i] + } else { + s[i], s[left] = s[left], s[i] + } + } + } + if i-1 < 0 { + break + } + i = (i - 1) / 2 + } + fmt.Println("loop s", s) } //给定一个包含正整数、加(+)、减(-)、乘(*)、除(/)的算数表达式(括号除外),计算其结果。 diff --git a/platformapi/mtwmapi/act_test.go b/platformapi/mtwmapi/act_test.go index d04421b6..97ff0209 100644 --- a/platformapi/mtwmapi/act_test.go +++ b/platformapi/mtwmapi/act_test.go @@ -154,7 +154,7 @@ func TestRetailDiscountBatchSave(t *testing.T) { } func TestRetailDiscountList(t *testing.T) { - result, err := api.RetailDiscountList("12405467", RetailActTypeDirectDown) + result, err := api.RetailDiscountList("8040309", RetailActTypeDirectDown) if err != nil { t.Fatal(err) } diff --git a/platformapi/mtwmapi/mtwmapi_test.go b/platformapi/mtwmapi/mtwmapi_test.go index 90a7f319..d71f6c90 100644 --- a/platformapi/mtwmapi/mtwmapi_test.go +++ b/platformapi/mtwmapi/mtwmapi_test.go @@ -19,13 +19,13 @@ func init() { baseapi.Init(sugarLogger) // 菜市 - //api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "") + api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "") // 果园 //api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "") //商超 - api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_gbUPuDi9v0BKfnjdFz5IYw") //token_nH_IlcWQKAkZBqklwItNRw + //api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_gbUPuDi9v0BKfnjdFz5IYw") //token_nH_IlcWQKAkZBqklwItNRw cookieStr := ` acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1; ` diff --git a/platformapi/tonglianpayapi/tonglianpayapi_test.go b/platformapi/tonglianpayapi/tonglianpayapi_test.go index bb74b0a1..607f088a 100644 --- a/platformapi/tonglianpayapi/tonglianpayapi_test.go +++ b/platformapi/tonglianpayapi/tonglianpayapi_test.go @@ -37,9 +37,10 @@ func TestCreateUnitorderOrder(t *testing.T) { func TestCreateH5UnitorderOrder(t *testing.T) { api.CreateH5UnitorderOrder(&CreateH5UnitorderOrderParam{ - Reqsn: "88320943177180", + Reqsn: "88320943177180_4", Trxamt: 1, - NotifyUrl: "http://callback.test.jxc4.com/tlpay/msg/", + NotifyUrl: "https://print.jxc4.com/callback/msg", + Returl: "https://print.jxc4.com", Charset: "UTF-8", Body: "test", })