


This article mainly introduces the development of Java WeChat public account. The main content includes testing the public account and building a local test environment. Friends in need can refer to it
As the saying goes, if you want to do your job well, you must first do it well. Sharpen your tools. To develop a WeChat public account, two things are indispensable, that is, a public account for testing and a development environment for debugging the code.
Test public account
WeChat public account has subscription account, service account, and enterprise account. When registering, you see this information. Only subscription account can be applied for personally. , service accounts and enterprise accounts must have enterprise qualifications. The WeChat public account development mentioned here refers to subscription accounts and service accounts.
In addition, some interfaces of unauthenticated personal subscription accounts do not have permissions, and currently personal subscription accounts no longer support WeChat authentication, that is It is said that personal subscription accounts cannot call some advanced permission interfaces. The picture below is a list of permissions that an uncertified personal subscription account has, such as generating QR codes, web page authorization, custom menu, and WeChat payment. Interface permissions are not available.
After talking for a long time, what should I do if I don’t have enterprise qualifications and want to develop advanced interfaces.
WeChat public platform provides a test public account, the login address is: http://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login , you only need to go to this page, click to log in, scan the code with your own WeChat client, and authorize the login, you can get your own test public account. The test official account has almost all interfaces. If there is no available official account for normal development, just use this test official account.
Local test environment
One of the major pains in developing WeChat public accounts is the debugging problem, which needs to be deployed every time a function is implemented To a public network server, although there are currently various free cloud platforms that can be deployed, the debugging basically can only rely on log output, and there is no modification->deployment->view log. This operation process is very time-consuming and time-consuming. It’s life, isn’t this a waste of life? So, is there a way to deploy and debug locally?
Of course, because every time you send an instruction to the official account, the server where the official account is located needs to interact with your server over the network. Therefore, your server must ensure that it can be accessed from the external network, so you only need to You can map the local address to an external network address to realize local debugging of the WeChat official account. There are many softwares that provide such functions, such as Peanut Shell, but they are charged. Here is a free software, ngrok, which may require FQ to access. According to the local version required, windows or linux version, then register an account. After account registration is successful, you will get a free authorization code. This authorization code is used when starting ngrok for the first time. Will be used.
Taking my local area as an example, I downloaded the Windows version. After downloading and decompressing, find the decompression directory, double-click ngrok.exe, and enter the following command when starting it for the first time:
ngrok -authtoken Authorization code 80
Then start, double-click ngrok.exe, enter the command after startup to map the machine to the external network, and set the local 8080 The web service under the port is mapped to the external network port 80. The command is as follows:
ngrok http 8080
The interface after startup is as follows:
The red part is the mapped external network address. Now accessing this address means accessing the local port 8080. However, for the free version of ngrok, the external network mapping address generated is random and will be different every time it is restarted. However, it is not a big deal because ngrok will basically not shut down during startup once a day. After each startup, go to WeChat to test Official account management page, just reconfigure it.
As of now, ngrok is available, which means that although the ngrok server is blocked, the WeChat public account server is accessible, which does not prevent us from doing things. Locally adjusted. Just download and register ngrok and you need to FQ it.
There are also some ngrok servers in China, but I have not tried them. If you are interested, you can search yourself. Of course, if you have the ability, you can build an ngrok platform yourself. ngrok is implemented in the go language.
The above is using java to develop WeChat public accounts to implement public account testing and local test environment construction. I hope it will be helpful to everyone's learning.
The above is the detailed content of How to build a local test environment for java WeChat public account development. For more information, please follow other related articles on the PHP Chinese website!

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于结构化数据处理开源库SPL的相关问题,下面就一起来看一下java下理想的结构化数据处理类库,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于PriorityQueue优先级队列的相关知识,Java集合框架中提供了PriorityQueue和PriorityBlockingQueue两种类型的优先级队列,PriorityQueue是线程不安全的,PriorityBlockingQueue是线程安全的,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于java锁的相关问题,包括了独占锁、悲观锁、乐观锁、共享锁等等内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于多线程的相关问题,包括了线程安装、线程加锁与线程不安全的原因、线程安全的标准类等等内容,希望对大家有帮助。

本篇文章给大家带来了关于Java的相关知识,其中主要介绍了关于关键字中this和super的相关问题,以及他们的一些区别,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于枚举的相关问题,包括了枚举的基本操作、集合类对枚举的支持等等内容,下面一起来看一下,希望对大家有帮助。

封装是一种信息隐藏技术,是指一种将抽象性函式接口的实现细节部分包装、隐藏起来的方法;封装可以被认为是一个保护屏障,防止指定类的代码和数据被外部类定义的代码随机访问。封装可以通过关键字private,protected和public实现。

本篇文章给大家带来了关于java的相关知识,其中主要介绍了关于设计模式的相关问题,主要将装饰器模式的相关内容,指在不改变现有对象结构的情况下,动态地给该对象增加一些职责的模式,希望对大家有帮助。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!
