


The difference between small program cloud development and non-cloud development
The difference between Mini Program cloud development and non-cloud development
1. Cloud development does not require building a server. Mini Program Cloud provides a free basic version , if it is non-cloud development, you need to build a server.
2. Cloud development projects can be launched quickly, and can be used to add, delete, modify, and query databases and store objects without relying on external cloud servers.
The Pitfalls of WeChat Mini Program Cloud Development
1. The Basic Edition CDN Traffic Is Too Little
In my case In a recent project, during the development and testing period alone, it took 765MB to upload/download the original quality pictures of the album (four to five days). At that time, I realized the seriousness of the matter, because after the project went online It needs to be used by hundreds of users every day. If it is like what I tested, the CDN traffic may be used up in two days. Once the CDN traffic is used up, upgrading the configuration will cost at least 30 yuan a month. At this price, you can buy a good object storage service outside.
But fortunately, I discovered this problem relatively early and controlled the quality of the uploaded pictures in time. The program automatically compresses each picture uploaded. Each picture is about 200kb. It has only been consumed since it was officially used. Received about 1mb of CDN traffic. (The average daily active users are about 60)
2. There are many restrictions on cloud databases
I think this pitfall is the deepest one for me. There are two limitations of cloud databases. The first aspect is the limit on the number of data items obtained by the mini program. The second aspect is cloud database read and write permission restrictions.
(1) Mini program read limit
The mini program directly requests the database, and can read up to 20 pieces of data each time
Use cloud functions to request the database, and then Trigger the cloud function through the applet, and read up to 100 pieces of data each time
If more than 100 pieces of data need to be requested each time, you need to use skip to request in batches and then combine them. The specific operation can be viewed Official documentation or other blogs.
(2) Cloud database read and write permission restrictions
Before talking about this pitfall, let me say that the mini program cloud database is a non-relational database and cannot use joint queries with foreign keys and internal keys. (Irrelevant to the context, not mentioned in this article)
The most open permission of the cloud database is: readable by all users, only the creator can change it.
That is to say, if you create a record, others cannot modify or delete it, which leads to a series of problems. Here is an example of my actual project.
eg: There is a multi-seat study room for users to book. Users can choose a usage time for each reservation. After this time is over, the seat can be booked again by others.
A simple scenario. Under normal logic, the study room table in our database should have these three main fields. Study room identification (r_id), study room expiration time (r_date), Whether the study room can be reserved (r_flag).
When a user chooses to reserve a study room, I only need to determine whether the r_flag of the study room is true. If it is true, the user can reserve it. After the reservation is successful, r_date is refreshed and r_flag is set to false. Can.
However, the most open permissions for the cloud database provided by Mini Program Cloud Development are readable by all users and can only be changed by the creator. As a result, the above logic does not work. We need more complex logic to implement this function.
What I did at the time was: submit a piece of data every time a user makes a reservation for a study room, and put all the reservation data for each study room into stacks in order of time, with the latest reservation on top. In this way, the next time someone makes a reservation, they only need to compare whether the r_date of the top data is reached to determine whether the study room can currently be reserved. Implement an overwrite and delete function without modifying the record.
3. There are many restrictions on opening to the outside world
A normal mini program project will generally be equipped with a backend management system. This backend management system and the mini program share a database to manage data. Since the cloud database that comes with the mini program cloud development is inside the mini program, if the outside wants to access this database, a slightly complicated process is required:
First use the official interface to obtain the calling credentials, and then use the specified credentials through this credentials Interface to add, delete, modify and check the database. In addition, the resources consumed in this process are also included in the basic configuration, and 50,000 requests are made online every day.
Recommended tutorials: "Small Program Development" "PHP Tutorial"
The above is the detailed content of The difference between small program cloud development and non-cloud development. For more information, please follow other related articles on the PHP Chinese website!

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics



With the popularity of mobile Internet technology and smartphones, WeChat has become an indispensable application in people's lives. WeChat mini programs allow people to directly use mini programs to solve some simple needs without downloading and installing applications. This article will introduce how to use Python to develop WeChat applet. 1. Preparation Before using Python to develop WeChat applet, you need to install the relevant Python library. It is recommended to use the two libraries wxpy and itchat here. wxpy is a WeChat machine

Mini programs can use react. How to use it: 1. Implement a renderer based on "react-reconciler" and generate a DSL; 2. Create a mini program component to parse and render DSL; 3. Install npm and execute the developer Build npm in the tool; 4. Introduce the package into your own page, and then use the API to complete the development.

Implementing card flipping effects in WeChat mini programs In WeChat mini programs, implementing card flipping effects is a common animation effect that can improve user experience and the attractiveness of interface interactions. The following will introduce in detail how to implement the special effect of card flipping in the WeChat applet and provide relevant code examples. First, you need to define two card elements in the page layout file of the mini program, one for displaying the front content and one for displaying the back content. The specific sample code is as follows: <!--index.wxml-->&l

According to news from this site on October 31, on May 27 this year, Ant Group announced the launch of the "Chinese Character Picking Project", and recently ushered in new progress: Alipay launched the "Chinese Character Picking-Uncommon Characters" mini program to collect collections from the society Rare characters supplement the rare character library and provide different input experiences for rare characters to help improve the rare character input method in Alipay. Currently, users can enter the "Uncommon Characters" applet by searching for keywords such as "Chinese character pick-up" and "rare characters". In the mini program, users can submit pictures of rare characters that have not been recognized and entered by the system. After confirmation, Alipay engineers will make additional entries into the font library. This website noticed that users can also experience the latest word-splitting input method in the mini program. This input method is designed for rare words with unclear pronunciation. User dismantling

How uniapp can achieve rapid conversion between mini programs and H5 requires specific code examples. In recent years, with the development of the mobile Internet and the popularity of smartphones, mini programs and H5 have become indispensable application forms. As a cross-platform development framework, uniapp can quickly realize the conversion between small programs and H5 based on a set of codes, greatly improving development efficiency. This article will introduce how uniapp can achieve rapid conversion between mini programs and H5, and give specific code examples. 1. Introduction to uniapp unia

Mini program registration operation steps: 1. Prepare copies of personal ID cards, corporate business licenses, legal person ID cards and other filing materials; 2. Log in to the mini program management background; 3. Enter the mini program settings page; 4. Select " "Basic Settings"; 5. Fill in the filing information; 6. Upload the filing materials; 7. Submit the filing application; 8. Wait for the review results. If the filing is not passed, make modifications based on the reasons and resubmit the filing application; 9. The follow-up operations for the filing are Can.

Implementation idea: Establishing the server side of thread, so as to process the various functions of the chat room. The establishment of the x02 client is much simpler than the server. The function of the client is only to send and receive messages, and to enter specific characters according to specific rules. To achieve the use of different functions, therefore, on the client side, you only need to use two threads, one is dedicated to receiving messages, and the other is dedicated to sending messages. As for why not use one, that is because, only

WeChat applet is a lightweight application that can be run on the WeChat platform. It does not require downloading and installation, which is convenient and fast. Java language, as a language widely used in enterprise-level application development, can also be used for the development of WeChat applets. In Java language, you can use the SpringBoot framework and third-party toolkits to develop WeChat applets. The following is a simple WeChat applet development process. To create a WeChat mini program, first, you need to register a mini program on the WeChat public platform. After successful registration, you can obtain
