1. Application for micro-letter public number
The first step in the development of a micro-credit public platform is, of course, to have a public number. What the? Do not know what is the micro-letter public number, it seems you have to melt the smelting, hehe. In layman's parlance, our micro-trust platform is like a big society, there are individual people, there are various organizations. The ordinary micro-signals you use are individuals, and the public numbers are those organizations, which are grouped into 2 categories: one that provides a variety of information, called a subscription number, and a variety of services, called service numbers. Of course, at present the individual can only apply to the subscription number, only organizations, such as companies to apply to the service number.
What's the difference between a subscription number and a service number? Simply put, the service number is designed to serve the user. You can use your own micro-mail to add the micro-signal of China Merchants Bank to see what is the service number. The subscription number is designed to provide users with information and news. A typical example is the "XXX" micro-signal.
Specifically, service number:
only 1 Mass messages can be sent within 1 months (30 days). 2, to subscribers (fans) of the message, will be displayed in each other's chat list. 3. When sending a message to the user, the user will receive an instant message reminder. 4, the service number will be in the Subscriber (fan) address Book. 5, can apply custom menu. and the subscription number: 1, every day (24 hours) can send 1 mass messages. 2. Messages to Subscribers (fans) will be displayed in each other's subscription number folder. 3. When sending a message to a Subscriber (a fan), the Subscriber does not receive an instant message reminder. 4, in the Subscriber (fan) address Book, the subscription number will be placed in the subscription number folder. 5, the subscription number does not support the request custom menu.
Through this comparison we have a general intuitive impression of it, simply said, the subscription number is mainly for fans to provide a variety of information and news, the function is relatively simple, and service number, mainly for fans to provide a variety of services, can have custom menus. And more importantly, the service number can be applied to more advanced platform interfaces. Here, we should understand that we do micro-letter mall, need to apply for the micro-letter service number.
For personal developers, is not the application of the service number, however, Tencent has taken this into account, specially for us to prepare a test account, through this account, we can obtain the micro-credit service number of all functions and interface invoke permissions.
All right, no more nonsense, then follow me step-by-step to apply for micro-letter Test Account Bar
Open the application address: Http://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login
Do you see the instructions above? No public account, fast application interface test number, direct experience and test all the advanced interface of public platform. It's exciting. As long as you enter the mobile phone number and verification code, you can immediately apply for success, after the successful application of the following figure:
Notice that this test number is valid for 1 years and has a micro-signal and two-dimensional code assigned. Now pick up your phone micro-mail and scan the two-dimensional code pattern you've just assigned to you, and you'll find that you can immediately focus on the test public number you're applying to.
after clicking on the attention , we can find the public number inside the subscription number, please note that although placed in the subscription number, but the test number can basically invoke all the micro-platform all the Advanced interface (see "Can use interface class list"), so our test number is sufficient for us.
2. Basic principles of micro-credit public platform development
I do not know what we notice in the first section of the screenshot, there is a "site interface configuration" of the configuration items need to fill in, in fact this is the micro-letter platform and our website docking interface URL address.
Let's look at this picture. The left side of the blue box is the micro-letter platform, the right red box inside is our own web site on the server. Communication between the micro-signaling platform and the Web server is communicated through an interface. When a micro-trust user reports to our public number (a specific message type is introduced later), the micro-credit backend server will determine whether the message is the public number sent to us, if yes, forward the message to our public number and send a request message to our configured website interface address, after our website receives the message, Processing, and the results of processing (response message) sent to the micro-platform, through the platform forward, and finally displayed to the micro-trust user's chat box.
This is a typical process of message interaction, with this impression, we understand that the focus of our work is on the server side of the website, that is, how to accept the request message sent by the micro-platform, how to handle it, and finally how to return the processing result to the micro-platform (the green part of the figure).
3. Server Environment Preparation
We want to accept and deal with the micro-platform sent over the message, of course, have their own web server.
So, next we are going to prepare our web server environment.
Many students like to use the Baidu application engine Bae, because it is free to apply and do not need to maintain, this is indeed very convenient, but I would like to say here, we are in the development of the program, or do not recommend doing so, why? Because it is not conducive to debugging. The normal step should be in our local development debugging, without any problems and then put to the real server (such as Baidu Bae, etc.). There is also a topic, what language do we use to develop our website? In fact, as long as the language can be used to develop the site, such as: Java, PHP, ASP.net, Ruby, Python, Note.js and so on. Micro-trust platform and our web site interaction through the interface call to achieve, as long as our site can respond to request messages can be, the use of any language does not matter. Of course, see what language you are most good at which language to use, because now the Web site development This piece of PHP used more and more, so we chose PHP as our website development language.
Language selected, the next step is to build a local development environment. In fact, the construction of local development environment and the development of ordinary PHP site is the same, if you are not familiar with, you can go directly to the Internet to download a Wamp kit, install, and then download an eclipse as a tool to develop it.
So what's the point? The focus is on communication between the micro-trust platform and our local servers.
Let's look at the following figure:
Micro-trust platform call our site is configured through the site URL and token to call, so we first need for our local server to apply for a URL, so that the extranet can access to our local Web site. In other words, it is to be able to publish our local computer website to the public network, so that everyone can access.
3.1 Mapping of local Web sites to public domain domains
Trying to publish a Web site running on your local computer to a public network so that everyone can access it seems like a hassle. Because you first have to have a domain name, and then you have to configure the port map on the local router, but also pay special attention to the firewall settings. However, now I recommend a very good tool: the new peanut shell Dynamic Domain Name tool. Through this tool, you do not need to set the router's port mapping, do not have to pipe firewall settings, and even the domain name does not need to apply, because all this, the new peanut shell has helped you solve. Well, gossip or less, lest there is a suspicion of advertising. So we're officially starting to teach you how to publish a website that runs on your own computer to the Internet so everyone can access it.
1. First, you should have a Web site that can be run locally, if you don't create a new Web project yourself, and then run it. For example: I created a new Java Web project in eclipse with only one JSP page and started running in Tomcat.
2. In the browser input : Localhost:8089/demo visit to see if you can open the home page. (Your URL address may be different from mine)
3. Can open the words , and then from here: https://console.oray.com/passport/register.html registered a peanut shell account. Here: http://hsk.oray.com/download/download "New Peanut Shell Client", after installation using the registration number of the account log in.
4. Login , immediately can see the peanut shell to help us distribute the free level 2 domain name, my is: xxx123.vicp.cc
5. Click on the red circle of the icon to diagnose the domain name , the result appears "Success" is the name of the domain map success.
6. Return to the Domain Name List page , right Key-"new peanut shell Management
7. Click Add Map on Pop-up page . We only need to fill in the Custom Application tab inside our local website in the IP address and port number on the intranet (note that check "open HTTP80 port"), such as my:
8. Click OK, through the peanut shell to our assigned level 2 domain name can be anywhere on the Internet to visit our website. In this way, we put the Web site on our local computer onto the Internet.
3.2 Fill in the micro-letter platform Interface configuration information
Next, fill in our 2-level domain name into the interface URL (note with the application name)
Token to enter a string (mainly for checksums, which will be explained later), for example: wx123
Click Submit.
Here our local server environment configuration is complete, the next point we began the development of micro-trust platform public number.