Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat Gadget Tool Special API debugging


May 20, 2021 WeChat Mini Program Development Document


Table of contents


Small program developer tools are simulations of WeChat clients, limited by the differences between desktop devices and mobile devices, as well as some of WeChat's endethy data, and given the ease of development, some APIs are different in tools and WeChat.

The broom interface

Different from calling the camera directly on the phone to sweep the code, calling the camera on the PC or Mac to sweep the code to complete debugging is an inefficient behavior, so after calling the QR code broom API on the development tool, the developer can choose a local picture for subsequent logical debugging, instead of instead of ingout the camera to sweep the code, the process is different, but the input and output of the interface is consistent.

WeChat payment

The latest version of the developer tool already supports weChat payment debugging, but for security reasons, it's different from calling WeChat payment directly on your phone:

  • Newly bound developers need 24 hours before they have permission to debug WeChat payments
  • After the developer calls the WeChat Payment API on the tool, a QR code appears on the development tool, and the developer must scan the code using the microscope currently being developed to complete the payment process on the phone
  • The tool syncs the return package paid by mobile WeChat into the tool, and the developer does the follow-up on his own

The interaction used is different, but the input and output tools of the interface are consistent with the client.

Ordinary forwarding

Developer tools call forwarding is a simulated behavior, and does not truly forward to users, and development can be judged by this simulation behavior to forward the forward API.

Forwarded with Sharegetnticket

For more forward information, such as the name of the group and group identifier OpenGID.On the small program developer tool, developers can debug forward with Shareticket in the following ways.

When calling wx.showsharemenu's parameter withshareticket, when you click the forward button that appears after the first upper right corner menu in the emulator, a list of test groups will appear, as shown in the figure:

WeChat Gadget Tool Special API debugging

Developers click to select any group, you can get the Shareticket by calling wx.getshareInfo by calling wx.getshareInfo.

When the developer needs to debug a bit of a group point, and the scene with Shareticket, you can use the 1044 in custom compilation. The small program message card (with Shareticket) in the group chat session can select any analog test group., As shown

WeChat Gadget Tool Special API debugging

Enter the scene value

In the WeChat client, the user may open the applet in each scene. Detail However, in the developer tool is no real environment to simulate these scenes.Developers can meet the purpose of debugging different scenes by conditional compilation.

WeChat Gadget Tool Special API debugging

Start using custom parameters

In daily use, users can open a small program, and based on the incoming Path jump to the corresponding small program page instead of the page, or can pass the parameters to distinguish the apparatus, the developer tool, developerIt can also achieve the purpose of debugging different PATH and parameters by means of conditional compilation.

For example, the figure below is the selection page is pages / name / name parameter is name = linchao

WeChat Gadget Tool Special API debugging

Preview Using Custom Parameters

same Start using custom parameters Similarly, when submitting previews, developers can achieve the purpose of debugging different PATH and parameters on mobile devices by custom preview.

For example, the figure below is the selection page is pages / name / name parameter is name = linchao

WeChat Gadget Tool Special API debugging

Debugging support for small program jump

The small program jump development and commissioning can be divided into two parts.

Debugging if the applet can jump properly

For the safety considerations of the small program code, when calling wx.navigatetominiprogram on the tool, the developer tool does not truly open and jump to another applet, but the tool will determine the current applet and a small program that needs to jump.The binding relationship between, and outputs information to the developer.Developers can determine whether the call is successful based on success or failback callback functions.

Debugging the correct received parameters

choose Custom compilation Enter the scene selection 1037 entry from a small program You can debug your applet whether the correct parameter is received and the relevant processing is performed.

WeChat Gadget Tool Special API debugging

Select Custom Compilation Enter Scenario Select 1038 Return from Small Program Can debug the small program to return when it receives the correct parameters and does the relevant processing.

WeChat Gadget Tool Special API debugging