songquanpeng / message-pusher

搭建专属于你的消息推送服务,支持多种消息推送方式,支持 Markdown,基于 Golang 仅单可执行文件,开箱即用
https://msgpusher.com
MIT License
2.64k stars 395 forks source link

fix: wrong memory address when updating channel #67

Closed WangEdward closed 1 year ago

WangEdward commented 1 year ago

Fix the address issue when updating the Wecom channel detail 修复原代码无法修改被添加的企业微信应用号通道的问题

复现过程

在通道中新增一个企业微信应用,填入(错误的)资料,保存后再进行修改 Secret,在 AppId 相同的情况下,这一行代码会将原来内存引用的 oldChannel 变量中的 AppId 也删除,因此在调用 parseWechatCorpAccountAppId 方法时会传入空值,返回错误 “无效的微信企业号配置” https://github.com/songquanpeng/message-pusher/blob/39da3f977148b0bed6ef762f976757832176789f/channel/token-store.go#L178

songquanpeng commented 1 year ago

感谢 PR,我确认一下。

WangEdward commented 1 year ago

也许是因为内存地址引用,所以修改是能被正常保存的,但是由于在 token-store.go#L227 被 return 掉了,所以底下TokenStoreAddItem 中的 item.Refresh() 没有被执行,因此点击通道页面的测试会显示 缺少access_token参数 的报错

songquanpeng commented 1 year ago

稍等哈,我现在正在实现 OneBot 协议的支持。

songquanpeng commented 1 year ago

我感觉我得检查一下其他地方了,感觉类似的问题应该不止一个。

songquanpeng commented 1 year ago

我已经修改了,感谢 PR~

songquanpeng commented 1 year ago

新版本 v0.4.1-alpha 已推送,期待测试。