Skip to content
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

为什么WeComApp.Server.Notify()接收企微审批状态变更回调消息解析出来的数据是空的? #139

Closed
Biely opened this issue Jul 29, 2022 · 2 comments

Comments

@Biely
Copy link

Biely commented Jul 29, 2022

WeComApp.Server.Notify()接收企微审批状态变更回调消息解析出来的数据是空的
`rs, err := pwWechat.WeComApp.Server.Notify(c.Request, func(event contract.EventInterface) interface{} {
fmt.Dump("event", event)
// kernel.Encryptor(event)
msg := models1.EventOpenApprovalChange{}
err := event.ReadMessage(&msg)
if err != nil {
println(err.Error())
return "error"
}
fmt.Dump(msg)
return kernel.SUCCESS_EMPTY_RESPONSE

})`

{ "EventInterface": null, "XMLName": { "Space": "", "Local": "" }, "Text": "", "ToUserName": "ww674ab0ba94f03533", "FromUserName": "sys", "CreateTime": "1659066539", "MsgType": "event", "Event": "sys_approval_change", "ChangeType": "", "Content": null, "AgentID": "3010040", "ApprovalInfo": { "Text": "", "ThirdNo": "", "OpenSpName": "", "OpenTemplateID": "", "OpenSpStatus": "", "ApplyTime": "1658900033", "ApplyUserName": "", "ApplyUserID": "", "ApplyUserParty": "", "ApplyUserImage": "", "ApprovalNodes": { "Text": "", "ApprovalNode": { "Text": "", "NodeStatus": "", "NodeAttr": "", "NodeType": "", "Items": { "Text": "", "Item": { "Text": "", "ItemName": "", "ItemUserID": "", "ItemImage": "", "ItemStatus": "", "ItemSpeech": "", "ItemOpTime": "" } } } }, "NotifyNodes": { "Text": "", "NotifyNode": { "Text": "", "ItemName": "", "ItemUserID": "", "ItemImage": "" } }, "Approverstep": "" } }

@WalleV
Copy link
Contributor

WalleV commented Jul 29, 2022

@Biely

初步来看, 是因为两边Go models结构体和微信发送过来的消息不一致导致的。

Go 结构体:

type EventOpenApprovalChange struct {

微信链接: https://developer.work.weixin.qq.com/document/path/91815

如果您这边急需,可以根据微信的xml消息结构体重新定义一个type EventOpenApprovalChange struct{} 来 替换msg := models1.EventOpenApprovalChange{}

我们预计明天会把这个结构体更新。 因为微信那边经常变更字段导致golang的强类型结构体对不上,方便的话可以帮忙提个PR。

@Matrix-X
Copy link
Contributor

已在v2.0.1-beta37中修复,谢谢你的问题

https://github.com/ArtisanCloud/PowerWeChat/tree/v2.0.1-beta37

@Matrix-X Matrix-X closed this as completed Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants