Loading…

WeChat Mini Program service provider plug-in

# Enable plugin 1. If you are a free member, it is a pity that you cannot use the plug-in function of apifm for the time being; 2. If you are a professional version member, log in to the backend, go to "Factory settings" --> "Plugin management" on the left menu, find the "WeChat Mini Program Service Provider" plug-in, and purchase it online to activate it; 3. If you are a value-added member, you don’t need to do anything, you can use all plug-in functions for free; # enable module Left menu "Factory settings" --> "Module management", find the "WeChat Service Provider" module, enable the module and refresh the page, you will be able to see the service provider-related menus in the left menu # Register as a WeChat service provider [https://open.weixin.qq.com/](https://open.weixin.qq.com/) First, please go to the above URL, register as a WeChat open platform user, and complete WeChat certification (a certification fee of 300 yuan needs to be paid to WeChat during certification) You may already have a service account, subscription account, or mini program account. Please note that the account on the open platform needs to be re-registered and opened. It has nothing to do with these official accounts, so WeChat authentication is also independently authenticated. After passing the certification, you can create third-party platform applications: ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1590757661287-4fe2216d-e85d-47af-b029-ab1978e2bfc4.png) #Create third-party platform applications ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1590758124800-4afac97d-20d0-4133-8417-cede889ba356.png) ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1590758192611-d03a8f71-d753-48cf-aa7d-3a5c6aafe2fb.png) Just select the permission set you need. It is better not to select all of them. They should be different permission sets. The review standards are inconsistent. Selecting too many will increase the difficulty of passing the review of your application. ## Permissions that cannot be enabled ###Customer service message management permissions ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1604027914264-de067ee9-5b30-4fd8-b770-36c6a5628c66.png) After this permission is turned on, the mini program will not be able to use WeChat's own customer service system, and must use event push to implement customer service functions. ## Authorization process related ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1590758482614-887baeea-f37f-4332-a68a-6bad81f9fb2d.png) Authorization initiation page domain name: api.it120.cc Authorization event receiving url: https://api.it120.cc/wxservice/event/receive Test the public account list. It is recommended that you add one yourself. Please refer to the prompts on the page for details. ## Implement business after authorization ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1590759295184-ef705144-e326-4117-8d49-96e388d31704.png) You only need to set the message verification Token and message encryption and decryption key yourself, which is equivalent to the function of the key. After you set it casually, remember that it will be used later; Message and event receiving URL: https://api.it120.cc/wxservice/$APPID$/receive Mini program server domain name: api.it120.cc;dcdn.it120.cc If you have other domain names, add them as well. See his instructions for details. If you have your own business domain name that needs to be displayed on the Mini Program, you need to add it in the "Mini Program Business Domain Name" input box ## IP whitelist 106.14.43.122; 106.15.66.205; 139.196.253.167; 121.36.243.129; 47.103.1.124; 139.196.174.85 ;103.88.32.13;103.88.32.128;110.42.39.111 ## Submit for review After the above steps are confirmed to be correct, you can submit it for review and wait patiently for the review results. ## Develop small program templates Before developing a mini program template, you need to bind the developer's mini program account first, as shown below: ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1603352308107-560a98ac-5804-4d5b-b215-160ce58e88e8.png) After binding a small program account to develop a small program for a third-party platform, this small program account will be very special. This small program account can be uploaded through the "Upload" button on the developer tools, and the uploaded code will automatically become a small program template for the third-party platform. # Configure service provider information ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1590759595917-2e26a8c5-73af-4ed6-8a43-30a41b39ce11.png) Application name: Please fill in the name of the third-party platform you set up in the above steps; For the APPID and Secret of the application, fill in the appID and secret information of the third-party platform you created in the previous step; Token and key also fill in the key information you set in the previous step; The four input boxes below correspond to the four domain name information that need to be used in the development of small programs. I will not explain too much here. #Usage overview ## Quickly create small programs ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1590759761668-7415e6a0-b914-4ebe-84e2-296a28fff916.png) [https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/Fast_Registration_Interface_document.html](https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/Fast_Registration_Interface_document.html) Please check the official detailed instructions and uses. The quickly created mini program can be exempted from the certification fee of 300 yuan, and it is directly a certified mini program! **How to log in and use the quickly created mini program?** You can first go to the "Mini Program Assistant" applet to set your login email and password. After the settings are completed, you can go to the WeChat public platform to log in and use it. For details, please refer to the guide: [https://kf.qq.com/touch/sappfaq/200617VbQzaa200617aq67ru.html](https://kf.qq.com/touch/sappfaq/200617VbQzaa200617aq67ru.html) ## Bind and authorize existing mini programs ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1590759868360-c928fe76-9802-4ffb-b70a-58caeec36fae.png) Enter the APPID of the existing mini program and authorize the current service provider to deploy, configure, and launch the mini program on your behalf. ## Mini program template library management First, you need to log in to the backend of the WeChat open platform (the backend of the third-party platform application was created in the first step), enter the third-party platform that you have approved, and bind the development applet. After binding, the applet will "upload code" on the development tool and will be automatically uploaded to the corresponding code template library of your service provider: ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1590760119641-0a1232c9-68f7-4d2d-a262-38b17f1f9bdf.png) ## Authorized mini program management ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1590760168893-de8c1fab-6023-4670-b07f-5b53ab00aede.png) # How to set variables in the template Service providers all use the same set of mini program codes to publish mini programs to different users, so different users must have different parameter settings. For example, they need to specify different exclusive domain names for different users. The following uses the open source mini program template "Angel Children's Clothing" as an example to explain how to set variables: ```javascript wx.getExtConfigSync() ``` This method can read the additional configuration variables specified by the service provider when helping users upload code. Therefore, in the applet code, when reading the exclusive domain name, read it from here first: ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1602851564047-22dfb01a-afd7-48e1-87b9-e0a010795100.png) After changing to the above code, the mini program reads the exclusive domain name from the service provider's configuration by default, and only reads the exclusive domain name from the "config.js" file when it cannot be read. So, next, how to set variables when the user selects the mini program template? ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1602851678433-068ca555-ea18-4e2f-b28d-2f3844a4f9f7.png) Just fill in the following information here: ```json { "extAppid": "wx1a8f18deb64f1458", "ext": { "subDomain": "tz" } } ``` + extAppid fill in the appID of the customer's mini program + subDomain fill in the user's exclusive domain name # Interface adjustment In the service provider model of mini program development, because the appSecret of the mini program cannot be obtained directly, there is no way to implement some interface calls in the traditional way, such as: mini program login, mini program registration "apifm-wxapi applet SDK" [https://github.com/gooking/apifm-wxapi](https://github.com/gooking/apifm-wxapi) [https://gitee.com/javazj/apifm-wxapi](https://gitee.com/javazj/apifm-wxapi) Some interfaces exclusively used in service provider mode have been provided. Of course, if you are not used to using SDK, you can also call the corresponding interface according to the parameter description of the interface in the "Front-end API Interface Document" to implement it. ![](https://dcdn.it120.cc/yuque/0/2020/png/572726/1603262346372-3150c85b-58e8-487e-bc0d-83aca8317663.png)