1
0
mirror of https://github.com/silenceper/wechat.git synced 2026-02-23 13:42:25 +08:00
This commit is contained in:
houseme
2023-10-13 17:11:50 +00:00
committed by GitHub
5 changed files with 133 additions and 36 deletions

View File

@@ -2,15 +2,15 @@ name: Go
on:
push:
branches: [ master,release-*,v2 ]
branches: [ master,release-*,v2,feature/** ]
pull_request:
branches: [ master,release-*,v2 ]
branches: [ master,release-*,v2,feature/** ]
jobs:
golangci:
strategy:
matrix:
go-version: [ '1.16','1.17','1.18','1.19','1.20' ]
go-version: [ '1.16','1.17','1.18','1.19','1.20','1.21' ]
name: golangci-lint
runs-on: ubuntu-latest
steps:
@@ -42,7 +42,7 @@ jobs:
# strategy set
strategy:
matrix:
go: [ '1.16','1.17','1.18','1.19','1.20' ]
go: [ '1.16','1.17','1.18','1.19','1.20','1.21' ]
steps:
- uses: actions/checkout@v3

View File

@@ -39,12 +39,25 @@ const (
EventTypeXpayGoodsDeliverNotify EventType = "xpay_goods_deliver_notify"
// EventTypeXpayCoinPayNotify 代币支付推送事件
EventTypeXpayCoinPayNotify EventType = "xpay_coin_pay_notify"
// EventSubscribePopup 用户操作订阅通知弹窗事件推送,用户在图文等场景内订阅通知的操作
EventSubscribePopup EventType = "subscribe_msg_popup_event"
// EventSubscribeMsgChange 用户管理订阅通知,用户在服务通知管理页面做通知管理时的操作
EventSubscribeMsgChange EventType = "subscribe_msg_change_event"
// EventSubscribeMsgSent 发送订阅通知,调用 bizsend 接口发送通知
EventSubscribeMsgSent EventType = "subscribe_msg_sent_event"
// ConfirmReceiveMethodAuto 自动确认收货
ConfirmReceiveMethodAuto ConfirmReceiveMethod = 1
// ConfirmReceiveMethodManual 手动确认收货
ConfirmReceiveMethodManual ConfirmReceiveMethod = 2
)
const (
// InfoTypeAcceptSubscribeMessage 接受订阅通知
InfoTypeAcceptSubscribeMessage InfoType = "accept"
// InfoTypeRejectSubscribeMessage 拒绝订阅通知
InfoTypeRejectSubscribeMessage InfoType = "reject"
)
// PushReceiver 接收消息推送
// 暂仅支付 Aes 加密方式
type PushReceiver struct {
@@ -188,6 +201,21 @@ func (receiver *PushReceiver) getEvent(dataType string, eventType EventType, dec
var pushData PushDataXpayCoinPayNotify
err := receiver.unmarshal(dataType, decryptMsg, &pushData)
return &pushData, err
case EventSubscribePopup:
// 用户操作订阅通知弹窗事件推送
var pushData PushDataSubscribePopup
err := receiver.unmarshal(dataType, decryptMsg, &pushData)
return &pushData, err
case EventSubscribeMsgChange:
// 用户管理订阅通知事件推送
var pushData PushDataSubscribeMsgChange
err := receiver.unmarshal(dataType, decryptMsg, &pushData)
return &pushData, err
case EventSubscribeMsgSent:
// 用户发送订阅通知事件推送
var pushData PushDataSubscribeMsgSent
err := receiver.unmarshal(dataType, decryptMsg, &pushData)
return &pushData, err
}
// 暂不支持其他事件类型,直接返回解密后的数据,由调用方处理
return decryptMsg, nil
@@ -306,8 +334,8 @@ type PushDataSecVodUpload struct {
type SecVodUploadEvent struct {
MediaID string `json:"media_id" xml:"media_id"` // 媒资 id
SourceContext string `json:"source_context" xml:"source_context"` // 透传上传接口中开发者设置的值。
Errcode int `json:"errcode" xml:"errcode"` // 错误码,上传失败时该值非
Errmsg string `json:"errmsg" xml:"errmsg"` // 错误提示
ErrCode int `json:"errcode" xml:"errcode"` // 错误码,上传失败时该值非
ErrMsg string `json:"errmsg" xml:"errmsg"` // 错误提示
}
// PushDataSecVodAudit 短剧媒资审核状态
@@ -373,3 +401,57 @@ type CoinInfo struct {
ActualPrice int64 `json:"ActualPrice" xml:"ActualPrice"` // 物品实际支付价格(单位:分)
Attach string `json:"Attach" xml:"Attach"` // 透传信息
}
// PushDataSubscribePopup 用户操作订阅通知弹窗事件推送
type PushDataSubscribePopup struct {
CommonPushData
List []SubscribeMsgPopupEventList `xml:"SubscribeMsgPopupEvent>List" json:"List"`
}
// SubscribeMsgPopupEvent 用户操作订阅通知弹窗消息回调
type SubscribeMsgPopupEvent struct {
List []SubscribeMsgPopupEventList `xml:"List" json:"List"`
}
// SubscribeMsgPopupEventList 订阅消息事件列表
type SubscribeMsgPopupEventList struct {
TemplateID string `xml:"TemplateId" json:"TemplateId"`
SubscribeStatusString string `xml:"SubscribeStatusString" json:"SubscribeStatusString"`
PopupScene string `xml:"PopupScene" json:"PopupScene"`
}
// PushDataSubscribeMsgChange 用户管理订阅通知事件推送
type PushDataSubscribeMsgChange struct {
CommonPushData
List []SubscribeMsgChangeList `xml:"SubscribeMsgChangeEvent>List" json:"List"`
}
// SubscribeMsgChangeEvent 用户管理订阅通知回调
type SubscribeMsgChangeEvent struct {
List []SubscribeMsgChangeList `xml:"List" json:"List"`
}
// SubscribeMsgChangeList 订阅消息事件列表
type SubscribeMsgChangeList struct {
TemplateID string `xml:"TemplateId" json:"TemplateId"`
SubscribeStatusString string `xml:"SubscribeStatusString" json:"SubscribeStatusString"`
}
// PushDataSubscribeMsgSent 用户发送订阅通知事件推送
type PushDataSubscribeMsgSent struct {
CommonPushData
List []SubscribeMsgSentEventList `xml:"SubscribeMsgSentEvent>List" json:"List"`
}
// SubscribeMsgSentEvent 用户发送订阅通知回调
type SubscribeMsgSentEvent struct {
List []SubscribeMsgSentEventList `xml:"List" json:"List"`
}
// SubscribeMsgSentEventList 订阅消息事件列表
type SubscribeMsgSentEventList struct {
TemplateID string `xml:"TemplateId" json:"TemplateId"`
MsgID string `xml:"MsgID" json:"MsgID"`
ErrorCode int `xml:"ErrorCode" json:"ErrorCode"`
ErrorStatus string `xml:"ErrorStatus" json:"ErrorStatus"`
}

View File

@@ -0,0 +1,15 @@
package message
import "errors"
// ErrInvalidReply 无效的回复
var ErrInvalidReply = errors.New("无效的回复信息")
// ErrUnsupportedReply 不支持的回复类型
var ErrUnsupportedReply = errors.New("不支持的回复消息")
// Reply 消息回复
type Reply struct {
MsgType MsgType
MsgData interface{}
}