[Bug] [Alert] wechat's app model cannot send alert msg
15673602562 opened this issue · comments
Search before asking
- I had searched in the issues and found no similar issues.
What happened
企微告警 在FreeMarkerHolder转换参数的时候 会把 字符 2000036 转成 2,000,036 导致请求企微接口报 send we chat msg error,resp error,code:40056,msg:Warning: wrong json format. invalid agentid, hint: [1715739465123491773668636], from ip: 58.20.114.249, more info at https://open.work.weixin.qq.com/devtool/query?e=40056
What you expected to happen
FreeMarkerHolder类 的 buildWithData 这段代码中,StringWriter 和 template.process(dataModel, stringWriter); 是用来将 FreeMarker 模板和数据模型进行处理,生成最终的字符串结果。 如果你的 dataModel 中的数字 1000049 被转换成了 1,000,049,这可能是由于 FreeMarker 的数字格式设置导致的。默认情况下,FreeMarker 会使用 Java 的 java.text.NumberFormat 类来格式化数字,这可能会将数字转换为带有逗号的格式。
需要在 FreeMarkerHolder类 的 FreeMarkerHolder构建方法中添加 configuration.setNumberFormat("computer"); 这个参数即可解决
How to reproduce
企微告警 app应用模式 测试即可重现
Anything else
No response
Version
1.0.2
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct