1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-04 12:52:27 +08:00

add: 增加公众号「发布能力」接口(#530) (#531)

* add: 增加公众号「发布能力」接口(#530)

* fix: go lint

* fix: 修复响应结构体及解析方式

* add: 增加公众号「草稿箱」接口(#530)

* fix: text

* mod: 增加 发布任务完成 消息事件

Co-authored-by: luoyu <luoyu@medlinker.com>
This commit is contained in:
save95
2022-02-14 10:19:55 +08:00
committed by GitHub
parent 80ce4aefc4
commit 5c4b28acee
5 changed files with 545 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/xml"
"github.com/silenceper/wechat/v2/officialaccount/device"
"github.com/silenceper/wechat/v2/officialaccount/freepublish"
)
// MsgType 基本消息类型
@@ -75,6 +76,8 @@ const (
EventWxaMediaCheck EventType = "wxa_media_check"
// EventSubscribeMsgPopupEvent 订阅通知事件推送
EventSubscribeMsgPopupEvent EventType = "subscribe_msg_popup_event"
// EventPublishJobFinish 发布任务完成
EventPublishJobFinish EventType = "PUBLISHJOBFINISH"
)
const (
@@ -150,6 +153,21 @@ type MixMessage struct {
List SubscribeMsgPopupEvent `xml:"List"`
} `xml:"SubscribeMsgPopupEvent"`
// 事件相关:发布能力
PublishEventInfo struct {
PublishID int64 `xml:"publish_id"` // 发布任务id
PublishStatus freepublish.PublishStatus `xml:"publish_status"` // 发布状态
ArticleID string `xml:"article_id"` // 当发布状态为0时即成功返回图文的 article_id可用于“客服消息”场景
ArticleDetail struct {
Count uint `xml:"count"` // 文章数量
Item []struct {
Index uint `xml:"idx"` // 文章对应的编号
ArticleURL string `xml:"article_url"` // 图文的永久链接
} `xml:"item"`
} `xml:"article_detail"` // 当发布状态为0时即成功返回内容
FailIndex []uint `xml:"fail_idx"` // 当发布状态为2或4时返回不通过的文章编号第一篇为 1其他发布状态则为空
} `xml:"PublishEventInfo"`
// 第三方平台相关
InfoType InfoType `xml:"InfoType"`
AppID string `xml:"AppId"`