修改企业微信

This commit is contained in:
邹宗楠
2022-06-23 10:35:09 +08:00
parent a4a9309e97
commit 55c810e929
4 changed files with 70 additions and 34 deletions

View File

@@ -8,6 +8,7 @@ import (
"encoding/base64"
"encoding/binary"
"encoding/json"
"encoding/xml"
"fmt"
"math/rand"
"sort"
@@ -47,9 +48,9 @@ func NewCryptError(err_code int, err_msg string) *CryptError {
}
type WXBizJsonMsg4Recv struct {
Tousername string `json:"tousername"`
Encrypt string `json:"encrypt"`
Agentid string `json:"agentid"`
Tousername string `xml:"ToUserName"`
Encrypt string `xml:"Encrypt"`
Agentid string `xml:"AgentID"`
}
type WXBizJsonMsg4Send struct {
@@ -80,7 +81,7 @@ type JsonProcessor struct {
func (self *JsonProcessor) parse(src_data []byte) (*WXBizJsonMsg4Recv, *CryptError) {
var msg4_recv WXBizJsonMsg4Recv
err := json.Unmarshal(src_data, &msg4_recv)
err := xml.Unmarshal(src_data, &msg4_recv)
if nil != err {
fmt.Println("Unmarshal fail", err)
return nil, NewCryptError(ParseJsonError, "json to msg fail")