You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
用的是2.5.0呀
zhuyanqing927@126.com
发件人: Binary Wang
发送时间: 2017-02-19 17:55
收件人: Wechat-Group/weixin-java-tools
抄送: zhuyanqing927; Comment
主题: Re: [Wechat-Group/weixin-java-tools] 菜单反序列化成WxMenu对象时matchRule属性为空 (#142)
感觉你们可能用的是老版本吧?最新版本的实现已经发生了变化
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
Method public java.lang.Object[][] me.chanjar.weixin.mp.api.impl.WxMpMenuServiceImplTest.getMenu() has a @test annotation but also a return value: ignoring it. Use to fix this
[TestNG] Running:
C:\Users\vania\AppData\Local\Temp\testng-eclipse--1642397105\testng-customsuite.xml
===============================================
Default test
Tests run: 2, Failures: 0, Skips: 0
===============================================
Default suite
Total tests run: 2, Failures: 0, Skips: 0
[TestNG] Time taken by org.testng.reporters.jq.Main@6295d394: 34 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 0 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@78b1cc93: 12 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@7c417213: 4 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@3bd40a57: 3 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@5e4c8041: 3 ms
Activity
zhuyanqing927 commentedon Feb 19, 2017
这次对接个性化菜单的时候,查询所有菜单也发现了这个问题。。多谢
binarywang commentedon Feb 19, 2017
me.chanjar.weixin.mp.bean.menu.WxMpMenu
你们用过这个类吗?是专为公众号创建的
binarywang commentedon Feb 19, 2017
感觉你们可能用的是老版本吧?最新版本的实现已经发生了变化
zhuyanqing927 commentedon Feb 19, 2017
zhuyanqing927 commentedon Feb 19, 2017
binarywang commentedon Feb 19, 2017
我今天特意跑过单元测试,没发现有问题啊,不知道你是如何调用的
binarywang commentedon Feb 19, 2017
在反序列化时已经不再使用WxMenuGsonAdapter了
yiyi910 commentedon Feb 20, 2017
发布个性化菜单是调WxMpMenuService的menuCreate(String json)方法对吧
binarywang commentedon Feb 20, 2017
@yiyi910 没错,你的问题到底是什么呢?既然是create,为啥又说到了反序列化的问题?
yiyi910 commentedon Feb 20, 2017
那之前调错了,调的是create(WxMenu menu)这个方法,WxMenu是通过fromJson(String json)构建的
binarywang commentedon Feb 21, 2017
调那两个方法创建菜单都没有问题,关键是你要传对了参数
yiyi910 commentedon Feb 21, 2017
WxMenu.fromJson(String json)构建个性化菜单WxMenu对象时,matchRule属性为null,我json字符串是有matchrule的
binarywang commentedon Feb 21, 2017
WxMenu属于企业号和公众号共用的menu类,在有个性花菜单的情况下不建议使用。你看下WxMpMenu这个类
yiyi910 commentedon Mar 13, 2017
你好, 刚升级到2.5,怎么发现二级菜单是个空集合呢?
yiyi910 commentedon Mar 13, 2017
22:30:39.261 [main] INFO com.vania.MenuTests - 获取-微信自定义菜单:
{"menu":{"button":[{"type":"view","name":"市场行情","url":"http://www.baidu.com","subButtons":[]},{"name":"资产及投资","subButtons":[]},{"type":"view","name":"我","url":"http://www.baidu.com","subButtons":[]}]}}
这是我的日志
yiyi910 commentedon Mar 13, 2017
这是我的case
binarywang commentedon Mar 13, 2017
你最好对照下项目中的单元测试看下是哪儿的问题吧
yiyi910 commentedon Mar 13, 2017
我跑工程里WxMpMenuServiceImplTest类的testMenuGet 这个name为"菜单"的一级菜单subButtons确实为空集合. 附上日志:
yiyi910 commentedon Mar 13, 2017
Method public java.lang.Object[][] me.chanjar.weixin.mp.api.impl.WxMpMenuServiceImplTest.getMenu() has a @test annotation but also a return value: ignoring it. Use to fix this
[TestNG] Running:
C:\Users\vania\AppData\Local\Temp\testng-eclipse--1642397105\testng-customsuite.xml
{"button":[{"type":"click","name":"今日歌曲","key":"V1001_TODAY_MUSIC"},{"type":"click","name":"歌手简介","key":"V1001_TODAY_SINGER"},{"name":"菜单","sub_button":[{"type":"view","name":"搜索","url":"http://www.soso.com/"},{"type":"view","name":"视频","url":"http://v.qq.com/"},{"type":"click","name":"赞一下我们","key":"V1001_GOOD"}]}]}
00:41:44.230 [main] DEBUG m.c.w.m.api.impl.WxMpMenuServiceImpl - 开始创建菜单:{"button":[{"type":"click","name":"今日歌曲","key":"V1001_TODAY_MUSIC"},{"type":"click","name":"歌手简介","key":"V1001_TODAY_SINGER"},{"name":"菜单","sub_button":[{"type":"view","name":"搜索","url":"http://www.soso.com/"},{"type":"view","name":"视频","url":"http://v.qq.com/"},{"type":"click","name":"赞一下我们","key":"V1001_GOOD"}]}]}
00:41:45.308 [main] DEBUG m.c.w.mp.api.impl.WxMpServiceImpl -
[URL]: https://api.weixin.qq.com/cgi-bin/menu/create
[PARAMS]: {"button":[{"type":"click","name":"今日歌曲","key":"V1001_TODAY_MUSIC"},{"type":"click","name":"歌手简介","key":"V1001_TODAY_SINGER"},{"name":"菜单","sub_button":[{"type":"view","name":"搜索","url":"http://www.soso.com/"},{"type":"view","name":"视频","url":"http://v.qq.com/"},{"type":"click","name":"赞一下我们","key":"V1001_GOOD"}]}]}
[RESPONSE]: {"errcode":0,"errmsg":"ok"}
00:41:45.308 [main] DEBUG m.c.w.m.api.impl.WxMpMenuServiceImpl - 创建菜单:{"button":[{"type":"click","name":"今日歌曲","key":"V1001_TODAY_MUSIC"},{"type":"click","name":"歌手简介","key":"V1001_TODAY_SINGER"},{"name":"菜单","sub_button":[{"type":"view","name":"搜索","url":"http://www.soso.com/"},{"type":"view","name":"视频","url":"http://v.qq.com/"},{"type":"click","name":"赞一下我们","key":"V1001_GOOD"}]}]},结果:{"errcode":0,"errmsg":"ok"}
00:41:51.546 [main] DEBUG m.c.w.mp.api.impl.WxMpServiceImpl -
[URL]: https://api.weixin.qq.com/cgi-bin/menu/get
[PARAMS]: null
[RESPONSE]: {"menu":{"button":[{"type":"click","name":"今日歌曲","key":"V1001_TODAY_MUSIC","sub_button":[]},{"type":"click","name":"歌手简介","key":"V1001_TODAY_SINGER","sub_button":[]},{"name":"菜单","sub_button":[{"type":"view","name":"搜索","url":"http://www.soso.com/","sub_button":[]},{"type":"view","name":"视频","url":"http://v.qq.com/","sub_button":[]},{"type":"click","name":"赞一下我们","key":"V1001_GOOD","sub_button":[]}]}]}}
{"menu":{"button":[{"type":"click","name":"今日歌曲","key":"V1001_TODAY_MUSIC","subButtons":[]},{"type":"click","name":"歌手简介","key":"V1001_TODAY_SINGER","subButtons":[]},{"name":"菜单","subButtons":[]}]}}
PASSED: testMenuCreate(WxMenu[
buttons=[WxMenuButton[
type=click
name=今日歌曲
key=V1001_TODAY_MUSIC
subButtons=[]
], WxMenuButton[
type=click
name=歌手简介
key=V1001_TODAY_SINGER
subButtons=[]
], WxMenuButton[
name=菜单
subButtons=[WxMenuButton[
type=view
name=搜索
url=http://www.soso.com/
subButtons=[]
], WxMenuButton[
type=view
name=视频
url=http://v.qq.com/
subButtons=[]
], WxMenuButton[
type=click
name=赞一下我们
key=V1001_GOOD
subButtons=[]
]]
]]
])
PASSED: testMenuGet
===============================================
Default test
Tests run: 2, Failures: 0, Skips: 0
===============================================
Default suite
Total tests run: 2, Failures: 0, Skips: 0
[TestNG] Time taken by org.testng.reporters.jq.Main@6295d394: 34 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 0 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@78b1cc93: 12 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@7c417213: 4 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@3bd40a57: 3 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@5e4c8041: 3 ms
wangjia2016 commentedon Mar 14, 2017
@yiyi910
这个name为"菜单"的一级菜单subButtons确实为空集合.
我这也发现了这个问题,的确为空,不过我暂时还没用到个性化菜单
binarywang commentedon Mar 14, 2017
感谢二位细心调试,我也试了下,确实是有问题,稍后修复下。
修复菜单获取接口反序列化时subButtons为空的问题 #142