-
-
Notifications
You must be signed in to change notification settings - Fork 881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何判断小程序分享消息? #62
Comments
解析消息,取 example:type AppMessageData struct {
XMLName xml.Name `xml:"msg"`
Appmsg struct {
Appid string `xml:"appid,attr"`
Sdkver string `xml:"sdkver,attr"`
Title string `xml:"title"`
Des string `xml:"des"`
Action string `xml:"action"`
Type string `xml:"type"`
Showtype string `xml:"showtype"`
Content string `xml:"content"`
URL string `xml:"url"`
Dataurl string `xml:"dataurl"`
Lowurl string `xml:"lowurl"`
Lowdataurl string `xml:"lowdataurl"`
Recorditem string `xml:"recorditem"`
Thumburl string `xml:"thumburl"`
Messageaction string `xml:"messageaction"`
Md5 string `xml:"md5"`
Extinfo string `xml:"extinfo"`
Sourceusername string `xml:"sourceusername"`
Sourcedisplayname string `xml:"sourcedisplayname"`
Commenturl string `xml:"commenturl"`
Appattach struct {
Totallen string `xml:"totallen"`
Attachid string `xml:"attachid"`
Emoticonmd5 string `xml:"emoticonmd5"`
Fileext string `xml:"fileext"`
Fileuploadtoken string `xml:"fileuploadtoken"`
OverwriteNewmsgid string `xml:"overwrite_newmsgid"`
Filekey string `xml:"filekey"`
Cdnattachurl string `xml:"cdnattachurl"`
Aeskey string `xml:"aeskey"`
Encryver string `xml:"encryver"`
} `xml:"appattach"`
Weappinfo struct {
Pagepath string `xml:"pagepath"`
Username string `xml:"username"`
Appid string `xml:"appid"`
Appservicetype string `xml:"appservicetype"`
} `xml:"weappinfo"`
Websearch string `xml:"websearch"`
} `xml:"appmsg"`
Fromusername string `xml:"fromusername"`
Scene string `xml:"scene"`
Appinfo struct {
Version string `xml:"version"`
Appname string `xml:"appname"`
} `xml:"appinfo"`
Commenturl string `xml:"commenturl"`
}
func main() {
var data AppMessageData
if err := xml.Unmarshal([]byte(ctx.Content), &data); err != nil {
logger.Log.Errorf("消息解析失败: %v", err.Error())
logger.Log.Debugf("原始内容: %v", ctx.Content)
return
}
logger.Log.Infof("来源APP: %v", data.Appinfo.Appname)
} |
新版本已经支持了 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如图为微信读书分享卡片:
这种消息如何判断呢?
The text was updated successfully, but these errors were encountered: