Closed sitoto closed 4 years ago
看一下是否允许API改菜单,好像微信后台现在有一个toggle,如果不启用,就不能API改,只能手工维护。
通过接口调用的参数是hash, 而不能是文件路径.如下: 错误:
Wechat.api('pcc').menu_create("/tmp/hIFs-a-67Ty2yOUljVyIuA.yml")
正确的调用方式:
menu = {}
menu[:button] = []
menu = menu[:button][0] = {"type": "view", "name": "about", "url": "https://pcc.xxx.com"}
Wechat.api('pcc').menu_create(menu)
pry(main)> Wechat.api('pcc').menu_create("/tmp/hIFs-a-67Ty2yOUljVyIuA.yml")
pry(main)> cat /tmp/hIFs-a-67Ty2yOUljVyIuA.yml
本地测试就是就是错误,但是使用'微信公众平台接口调试工具' 测试的时正常的.如下