You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
552 B
23 lines
552 B
1 year ago
|
'use strict';
|
||
|
exports.main = async (event, context) => {
|
||
|
const db = uniCloud.database()
|
||
|
|
||
|
if (event.api === 'getByID') {
|
||
|
const res = await db.collection('dishes').where({
|
||
|
_id: event.id
|
||
|
}).get()
|
||
|
return res
|
||
|
}
|
||
|
if (event.api === 'getFloorList') {
|
||
|
const res = await db.collection('dishes').skip(4).limit(15).get()
|
||
|
return res
|
||
|
}
|
||
|
if (event.api === 'getByName') {
|
||
|
const res = await db.collection('dishes').where({
|
||
|
dish_name: new RegExp(event.dish_name, 'g')
|
||
|
}).get()
|
||
|
return res
|
||
|
}
|
||
|
//返回数据给客户端
|
||
|
return "请求错误"
|
||
|
};
|