'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
//event为客户端上传的参数
const query = event.queryStringParameters
let dbs
// const {
// type="detail"
// } = query
const type="detail"
if (type == "artical") {
const pageSize = query.pageSize || 10
const page = query.page || 1
dbs = await db.collection('user-artical').skip((page - 1) * pageSize).limit(Number(pageSize)).get()
} else if (type == "life") {
const pageSize = query.pageSize || 12
dbs = await db.collection('life').skip((page - 1) * pageSize).limit(Number(pageSize)).get()
} else if (type == "intro") {
dbs = await db.collection('life').get()
} else if (type == "detail") {
console.log('db:',db);
// dbs = await db.action("readnum").collection('user-artical').where({
// _id: query.id
// }).get()
}
//返回数据给客户端
return dbs
};

5***@qq.com
- 发布:2021-08-18 16:20
- 更新:2021-08-19 19:32
- 阅读:736
db.action is not a function
分类:uniCloud
2 个回复
5***@qq.com (作者)
有谁知道啊,为啥db上没有action
DCloud_uniCloud_WYQ
云函数里面不支持,这是clientDB的写法