diff --git a/platformapi/enterprise_wechat/enterprise_callback.go b/platformapi/enterprise_wechat/enterprise_callback.go index 0e4acd04..06fc79cd 100644 --- a/platformapi/enterprise_wechat/enterprise_callback.go +++ b/platformapi/enterprise_wechat/enterprise_callback.go @@ -1,7 +1,7 @@ package enterprise_wechat import ( - "encoding/json" + "encoding/xml" "git.rosy.net.cn/jx-callback/globals" "io/ioutil" "net/http" @@ -9,10 +9,14 @@ import ( // 回调参数 type SuiteTicketInfo struct { - SuiteId string // 第三方应用的SuiteId - InfoType string // suite_ticket - TimeStamp int64 // 时间戳 - SuiteTicket string // Ticket内容,最长为512字节 + SuiteId string `xml:"SuiteId"` // 第三方应用的SuiteId + InfoType string `xml:"InfoType"` // suite_ticket + TimeStamp int64 `xml:"TimeStamp"` // 时间戳 + SuiteTicket string `xml:"SuiteTicket"` // Ticket内容,最长为512字节 +} + +type SuiteTicketXml struct { + Xml *SuiteTicketInfo `xml:"xml"` } func (a *API) GetEnterpriseMsg(request *http.Request) (*SuiteTicketInfo, error) { @@ -21,10 +25,12 @@ func (a *API) GetEnterpriseMsg(request *http.Request) (*SuiteTicketInfo, error) return nil, err } globals.SugarLogger.Debug("data============enterprise", data) + globals.SugarLogger.Debug("data============enterprise", string(data)) suite := &SuiteTicketInfo{} - if err := json.Unmarshal(data, suite); err != nil { + if err := xml.Unmarshal(data, suite); err != nil { return nil, err } + return suite, err }