push config

This commit is contained in:
richboo111
2023-07-06 10:18:41 +08:00
parent 4debcc1c5d
commit da87f4e2f4
7 changed files with 83 additions and 46 deletions

View File

@@ -1,9 +1,11 @@
package im
import (
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"strings"
"git.rosy.net.cn/jx-callback/business/model"
@@ -110,6 +112,9 @@ func ReadMsgFromVendor(vendorID int, elmAppID string, msg []byte) error {
if vendorID == VendorIDMT {
var PushContentReq = mtwmapi.PushContentReq{}
err = json.Unmarshal(msg, &PushContentReq)
if FilterIm(PushContentReq.AppID, PushContentReq.MsgContent) { //自动回复消息过滤
return nil
}
jxMsg = &JXMsg{
SendType: SendTypeMt,
MsgContent: PushContentReq,
@@ -343,3 +348,30 @@ func DelRedisByKey(keys []string) {
}
return
}
var rel = map[int]string{
589: "a81eb3df418d83d6a1a4b7c572156d2f",
5873: "41c479790a76f86326f89e8048964739",
4123: "df2c88338b85f830cebce2a9eab56628",
}
// DecryptIm 解密操作
func DecryptIm(appID int, msg string) (string, error) {
data, _ := base64.StdEncoding.DecodeString(msg)
key := utils.LimitUTF8StringLen2(rel[appID], 16)
res, err := utils.AESCBC16Decrypt(data, []byte(key), []byte(key))
if len(string(res)) > 0 && err == nil {
return string(res), nil
}
return "", err
}
// FilterIm 过滤操作
func FilterIm(appID int, msg string) bool {
var check = "[自动回复]"
data, _ := DecryptIm(appID, msg)
if len(data) > 0 && strings.Contains(data, check) {
return true
}
return false
}