kongweiyu_branch
孔维屿 1 year ago
parent ea08ac4594
commit fa481b2f20

@ -0,0 +1,6 @@
{
"permissions": {
"openapi": [
]
}
}

@ -0,0 +1,9 @@
const saveProfile = require('./saveProfile/index')
// 云函数入口函数
exports.main = async (event, context) => {
switch (event.type) {
case 'saveProfile':
return await getProfile.main(event, context);
}
};

@ -0,0 +1,14 @@
{
"name": "db",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"wx-server-sdk": "latest"
}
}

@ -0,0 +1,28 @@
const cloud = require('wx-server-sdk');
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
});
const db = cloud.database();
// 保存个人信息云函数入口函数
exports.main = async (event, context) => {
// 返回数据库结果
return db.collection('user_Data').add({
// data 字段表示需新增的 JSON 数据
data: {
// _id: 'todo-identifiant-aleatoire', // 可选自定义 _id在此处场景下用数据库自动分配的就可以了
user_Name: "learn cloud database",
user_Sex: null,
user_Age: null,
user_Phone: null,
user_Addr: null,
isTeacher: false
},
success: function(res) {
// res 是一个对象,其中有 _id 字段标记刚创建的记录的 id
console.log(res)
}
})
};
Loading…
Cancel
Save