当前位置:网站首页>0 foundation a literature club low code development member management applet (III)
0 foundation a literature club low code development member management applet (III)
2022-06-24 07:06:00 【Low code preacher】
1 Third articles : Recharge record function development
1.1 Last article review
In the previous article, we implemented the member recharge record function , Encountered a BUG As a result, the new functions are not easy to use , And recorded .
1.2 This paper introduces
This article mainly introduces the development of recharge recording function , During daily business operation , It is not enough just to increase the balance , We also need to record the recharge , Convenient for members to view .
According to the traditional development method, we generally need to design the master sub table , The master table records the basic information of members , The sub table records the recharge information of members . But we don't do this in low code development , Why? ? Because we are a document database , There is no need to follow the traditional design thinking .
How does it work ? Just listen to me .
1.3 Modify the data source
We add an array field to the member data source , Used to record recharge information
Array fields are not enough , We also need to add business logic , So you need to use the custom method of the data source
Note that the custom method needs to be tested first , After passing the test, you can develop the page
Specific method
module.exports = async function (params, context) {
const newParams = Object.assign({}, params, {
updatedAt: Date.now(),
});
delete newParams.createdAt;
delete newParams._id;
const _ = context.database.command;
console.log(params.account);
let money=parseInt(params.account)
const result = await context.collection.doc(params._id).update({
account:_.inc(money),
addrecord:_.push({
money:params.account,
adddate:Date.now()
})
});
return { updated: result.updated };
}
Here we use the array operation of cloud development _.push, Each time the balance is increased, a new record is added to the array
{
money:params.account,
adddate:Date.now()
}
A pair of braces denotes an object , There are two properties in the object , They are the amount of this recharge and the current time , After the method is added, we can develop the page function
1.4 Page function development
The recharge function of the page is the same as that in the previous section , We just modified the method of recharging , Added the function of recharge record
1.5 Preview release
Click the preview function and we can actually experience it
1.6 The next trailer
We will continue to develop the function in the next article , Develop the function of consumption , See you next time .
边栏推荐
- Open source and innovation
- 程序员使用个性壁纸
- 成为 TD Hero,做用技术改变世界的超级英雄 | 来自 TDengine 社区的邀请函
- Leetcode: Sword finger offer 26: judge whether T1 contains all topologies of T2
- Canal安装配置
- On BOM and DOM (1): overview of BOM and DOM
- On BOM and DOM (6): bit value calculation of DOM objects and event objects, such as offsetx/top and clearx
- mysql中的 ON UPDATE CURRENT_TIMESTAMP
- The cloud monitoring system hertzbeat V1.1.0 is released, and a command starts the monitoring journey!
- C language student management system - can check the legitimacy of user input, two-way leading circular linked list
猜你喜欢

Application configuration management, basic principle analysis

File system notes

【云驻共创】华为云HCIA-IoT V2.5培训系列内容之物联网概览

Virtual file system

Arduino融资3200万美元,进军企业市场
![跳跃游戏II[贪心练习]](/img/e4/f59bb1f5137495ea357462100e2b38.png)
跳跃游戏II[贪心练习]

35 year old crisis? It has become a synonym for programmers

成为 TD Hero,做用技术改变世界的超级英雄 | 来自 TDengine 社区的邀请函

leetcode:1856. 子数组最小乘积的最大值

About Stacked Generalization
随机推荐
[JUC series] completionfuture of executor framework
Localized operation on cloud, the sea going experience of kilimall, the largest e-commerce platform in East Africa
.NET7之MiniAPI(特别篇) :Preview5优化了JWT验证(上)
Application configuration management, basic principle analysis
How to make a website? What should I pay attention to when making a website?
Become TD hero, a superhero who changes the world with Technology | invitation from tdengine community
JVM調試工具-Arthas
Online font converter what is the meaning of font conversion
Oracle SQL comprehensive application exercises
Why does the remote end receive a check-out notice when the TRTC applet turns off audio and video locally
[problem solving] the connection to the server localhost:8080 was referred
On BOM and DOM (4): dom0/dom2 event handling analysis
Record -- about the problem of garbled code when JSP foreground passes parameters to the background
NVIDIA control panel does not open what is NVIDIA control panel
Maui uses Masa blazor component library
Application of intelligent reservoir management based on 3D GIS system
Canal安装配置
【云驻共创】华为云HCIA-IoT V2.5培训系列内容之物联网概览
Rockscache schematic diagram of cache operation
Intelligent Vision Group A4 paper recognition example