37 lines
911 B
Go
37 lines
911 B
Go
package enterprise_wechat
|
||
|
||
import (
|
||
"encoding/xml"
|
||
"git.rosy.net.cn/jx-callback/globals"
|
||
"io/ioutil"
|
||
"net/http"
|
||
)
|
||
|
||
// 回调参数
|
||
type SuiteTicketInfo struct {
|
||
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) {
|
||
data, err := ioutil.ReadAll(request.Body)
|
||
if err != nil {
|
||
return nil, err
|
||
}
|
||
globals.SugarLogger.Debug("data============enterprise", data)
|
||
globals.SugarLogger.Debug("data============enterprise", string(data))
|
||
|
||
suite := &SuiteTicketInfo{}
|
||
if err := xml.Unmarshal(data, suite); err != nil {
|
||
return nil, err
|
||
}
|
||
|
||
return suite, err
|
||
}
|