Development of Java wechat public platform (10) creation and implementation of wechat custom menu

The function of custom menu can be edited directly in the background in our ordinary editing mode, but once we enter the development mode, our custom menu needs to be implemented in code, so there may be some doubts for people who just come into contact, Here I'll talk about the implementation methods of two custom menus commonly used in the development mode: ① without writing implementation code, directly use the web page testing tool post JSON string to generate menus; ② Is to use code to realize menu generation in our development! (reference document: http://mp.weixin.qq.com/wiki/10/0234e39a2025342c17a7d23595c6b40a.html )In the user-defined menu, there are two types of menus. One is the View menu of view, which directly jumps to the URL page after clicking; There is also a click type, and the back end gives different corresponding information through the click event type; The menus with various features are added later. Their essence is still a click type menu, so the generation rules are the same. The way to generate the menu is to generate the menu from the post JSON string of the wechat server. The methods and rules of menu generation are described below!

We connect through( https://mp.weixin.qq.com/debug/cgi-bin/apiinfo?t=index&type=%E8%87%AA%E5%AE%9A%E4%B9%89%E8%8F%9C%E5%8D%95&form=%E8%87%AA%E5%AE%9A%E4%B9%89%E8%8F%9C%E5%8D%95%E5%88%9B%E5%BB%BA%E6%8E%A5%E5%8F%A3%20/menu/create )Enter the web page debugging tool, as shown in the following figure:

The basic process of the above code is to call view and click two entities to encapsulate the JSON string menujson, and finally send the JSON to the Tencent server by calling the sending method. But here we need to use the token generated by account generation. I write directly here (see the way to get token), and finally run back the result OK, as follows:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>