Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 98cf84f

Browse files
committed
回复消息支持图片
1 parent a47ae16 commit 98cf84f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

logic/wechat.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,10 @@ func (self WechatLogic) wechatResponse(ctx context.Context, respContent string,
496496
switch wechatMsg.MsgType {
497497
case model.WeMsgTypeText:
498498
wechatReply.Content = &model.CData{Val: respContent}
499+
case model.WeMsgTypeImage:
500+
wechatReply.Image = &model.WechatImage{
501+
MediaId: &model.CData{Val: respContent},
502+
}
499503
default:
500504
wechatReply.Content = &model.CData{Val: config.ConfigFile.MustValue("wechat", "not_found")}
501505
}

model/wechat_msg.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,10 @@ type WechatReply struct {
6565
FromUserName *CData
6666
CreateTime int64
6767
MsgType *CData
68-
Content *CData `xml:",omitempty"`
68+
Content *CData `xml:",omitempty"`
69+
Image *WechatImage `xml:",omitempty"`
70+
}
71+
72+
type WechatImage struct {
73+
MediaId *CData
6974
}

0 commit comments

Comments
 (0)