From cda0c6e9f3b810509f857af3fe45f52abe49692d Mon Sep 17 00:00:00 2001 From: richboo111 Date: Wed, 24 Jan 2024 17:37:27 +0800 Subject: [PATCH] 1 --- platformapi/ebaiapi/im.go | 2 +- platformapi/ebaiapi/im_test.go | 2 +- platformapi/mtwmapi/im_test.go | 33 ++++++++++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/platformapi/ebaiapi/im.go b/platformapi/ebaiapi/im.go index 23c1bd98..df586034 100644 --- a/platformapi/ebaiapi/im.go +++ b/platformapi/ebaiapi/im.go @@ -31,7 +31,7 @@ type BusinessSendMsgReq struct { PlatformShopId string `json:"platformShopId"` // 平台门店id BizType string `json:"bizType"` // 业务类型,IM消息。默认值:IM SubBizType string `json:"subBizType"` // 子业务类型,发送消息。默认值:SEND_MESSAGE - Payload BusinessMsgPayload `json:"payload"` + PayLoad BusinessMsgPayload `json:"payLoad"` } type BusinessMsgPayload struct { diff --git a/platformapi/ebaiapi/im_test.go b/platformapi/ebaiapi/im_test.go index 4beb6fe7..3c999746 100644 --- a/platformapi/ebaiapi/im_test.go +++ b/platformapi/ebaiapi/im_test.go @@ -29,7 +29,7 @@ func TestSendMsg(t *testing.T) { PlatformShopId: "1157916361", BizType: IMType, SubBizType: IMTypeSendMsg, - Payload: BusinessMsgPayload{ + PayLoad: BusinessMsgPayload{ GroupId: "$2$13205337818$PNM", ReceiverIds: []string{"301157916361", "10154538612", "321921188187760"}, Content: "{\"text\": \"现在是20231027 10:04:44\"}", diff --git a/platformapi/mtwmapi/im_test.go b/platformapi/mtwmapi/im_test.go index baadcbdf..92f36ad7 100644 --- a/platformapi/mtwmapi/im_test.go +++ b/platformapi/mtwmapi/im_test.go @@ -4,6 +4,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "git.rosy.net.cn/baseapi/platformapi/ebaiapi" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/baseapi/utils/errlist" "github.com/go-redis/redis" @@ -150,5 +151,35 @@ func TestAPI_SetPoiIMOnlineStatus(t *testing.T) { func TestRdbSet2(t *testing.T) { - rdb.Set("111", "2", 0) + //rdb.Set("111", "UtW1wOoLXSzMGK0u4X94jP+hkbHLdXcWHySxc1Todu1/Bi1ooOIY4wwOMIcAE6mq84gDXb7IfXJLbgjqFeQT5UQ4L+pvTJjlh1nYrWoyrm97+wGEoGONSxn7XNCfgGVzacDLNG5/0yJ7ElXthxHVXB4LcVBYV4wQAaMUYLYmALXFmAASGd8TlqNWojTSvOw6PZmB3A7aL14abJeSTil4yiWrU/RSFhnoAgijLFtaAdv0RcWQ+ipMa/BLNpxr+Qrd6HUzVO26IZaxMFQVwuTgEbmt2vQ9AILpgS2bnY2BLPk=", 0) + temp := rdb.Get("111") + fmt.Println(temp) + fmt.Println(temp.String()) +} + +var rel = map[int]string{ + 589: "a81eb3df418d83d6a1a4b7c572156d2f", + 5873: "41c479790a76f86326f89e8048964739", + 4123: "df2c88338b85f830cebce2a9eab56628", +} + +func TestEncryptIm(t *testing.T) { + //msg := "您好,特殊天气或节假日可能出现骑手变少,配送延迟等情况,烦请耐心等待,售后及其他问题请联系店长,电话:" + //key := utils.LimitUTF8StringLen2(rel[589], 16) + //if data, err := utils.AESCBCEncpryt([]byte(msg), []byte(key), []byte(key)); err == nil { + // retVal := base64.StdEncoding.EncodeToString(data) + // fmt.Println(retVal) + //} + //var num = "17812345678" + //str := num[:3] + "-" + num[3:7] + "-" + num[7:] + //fmt.Println(str) + + str := "\"{\\\"text\\\":\\\"\\\\\\\"您好,特殊天气或节假日可能出现骑手变少,配送延迟等情况,烦请耐心等待,售后及其他问题请联系店长,电话:136-5807-8848\\\\\\\"\\\"}\"" + s1 := ebaiapi.Content{} + s2 := "" + t1 := json.Unmarshal([]byte(str), &s1) + fmt.Println(t1) + t2 := json.Unmarshal([]byte(s1.Text), &s2) + fmt.Println(t2) + }