Skip to content

Commit

Permalink
新增应用停用启用回调事件
Browse files Browse the repository at this point in the history
  • Loading branch information
zsmhub committed Jan 10, 2023
1 parent ff69a87 commit 971b350
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
6 changes: 6 additions & 0 deletions callbacks/callback_constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ const EventTypeDeviceDataAuthChange = "device_data_auth_change"
// 异步上传临时素材-回调异步任务结果
const EventTypeUploadMediaJobFinish = "upload_media_job_finish"

// 长期未使用应用临时停用事件
const EventTypeCloseInactiveAgent = "close_inactive_agent"

// 长期未使用应用重新启用事件
const EventTypeReopenInactiveAgent = "reopen_inactive_agent"

// 推送suite_ticket
const InfoTypeSuiteTicket EventType = "suite_ticket"

Expand Down
56 changes: 56 additions & 0 deletions callbacks/event长期未使用应用临时停用事件.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package callbacks

import "encoding/xml"

// 自动生成的回调结构,按需修改, 生成方式: make callback doc=微信文档地址url
// 文档: https://developer.work.weixin.qq.com/document/path/90376#长期未使用应用临时停用事件

func init() {
// 添加可解析的回调事件
supportCallback(EventCloseInactiveAgent{})
}

type EventCloseInactiveAgent struct {
XMLName xml.Name `xml:"xml"`
Text string `xml:",chardata"`
ToUserName struct {
Text string `xml:",chardata"`
} `xml:"ToUserName"`
FromUserName struct {
Text string `xml:",chardata"`
} `xml:"FromUserName"`
CreateTime struct {
Text string `xml:",chardata"`
} `xml:"CreateTime"`
MsgType struct {
Text string `xml:",chardata"`
} `xml:"MsgType"`
Event struct {
Text string `xml:",chardata"`
} `xml:"Event"`
AgentID struct {
Text string `xml:",chardata"`
} `xml:"AgentID"`
}

func (EventCloseInactiveAgent) GetMessageType() string {
return "event"
}

func (EventCloseInactiveAgent) GetEventType() string {
return "close_inactive_agent"
}

func (EventCloseInactiveAgent) GetChangeType() string {
return ""
}

func (m EventCloseInactiveAgent) GetTypeKey() string {
return m.GetMessageType() + ":" + m.GetEventType() + ":" + m.GetChangeType()
}

func (EventCloseInactiveAgent) ParseFromXml(data []byte) (CallBackExtraInfoInterface, error) {
var temp EventCloseInactiveAgent
err := xml.Unmarshal(data, &temp)
return temp, err
}
56 changes: 56 additions & 0 deletions callbacks/event长期未使用应用重新启用事件.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package callbacks

import "encoding/xml"

// 自动生成的回调结构,按需修改, 生成方式: make callback doc=微信文档地址url
// 文档: https://developer.work.weixin.qq.com/document/path/90376#长期未使用应用重新启用事件

func init() {
// 添加可解析的回调事件
supportCallback(EventReopenInactiveAgent{})
}

type EventReopenInactiveAgent struct {
XMLName xml.Name `xml:"xml"`
Text string `xml:",chardata"`
ToUserName struct {
Text string `xml:",chardata"`
} `xml:"ToUserName"`
FromUserName struct {
Text string `xml:",chardata"`
} `xml:"FromUserName"`
CreateTime struct {
Text string `xml:",chardata"`
} `xml:"CreateTime"`
MsgType struct {
Text string `xml:",chardata"`
} `xml:"MsgType"`
Event struct {
Text string `xml:",chardata"`
} `xml:"Event"`
AgentID struct {
Text string `xml:",chardata"`
} `xml:"AgentID"`
}

func (EventReopenInactiveAgent) GetMessageType() string {
return "event"
}

func (EventReopenInactiveAgent) GetEventType() string {
return "reopen_inactive_agent"
}

func (EventReopenInactiveAgent) GetChangeType() string {
return ""
}

func (m EventReopenInactiveAgent) GetTypeKey() string {
return m.GetMessageType() + ":" + m.GetEventType() + ":" + m.GetChangeType()
}

func (EventReopenInactiveAgent) ParseFromXml(data []byte) (CallBackExtraInfoInterface, error) {
var temp EventReopenInactiveAgent
err := xml.Unmarshal(data, &temp)
return temp, err
}

0 comments on commit 971b350

Please sign in to comment.