diff --git a/cloudfunctions-aliyun/search/index.js b/cloudfunctions-aliyun/search/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e2bbb03e4642d2d60817ae50297e2abd9ea2ec03 --- /dev/null +++ b/cloudfunctions-aliyun/search/index.js @@ -0,0 +1,20 @@ +//我在做这个文件,我的群昵称是King,QQ:36568008 +'use strict'; +const db = uniCloud.database() +exports.main = async (event, context) => { + const collection = db.collection('member') + if (event.searchKey != '') { + const dbCmd = db.command; + const res = await collection.where(dbCmd.or({ + name: new RegExp(event.searchKey) + }, { + address: new RegExp(event.searchKey) + })).orderBy("regtime", "desc").skip((event.page - 1) * event.pageSize).limit(event.pageSize).get(); + return res + } else { + const res = await collection.orderBy("regtime", "desc").skip((event.page - 1) * event.pageSize).limit(event.pageSize) + .get(); + return res + } + +}; diff --git a/pages/tabbar/search.vue b/pages/tabbar/search.vue index dbdc793955b830d928ba63e9b8428003dab7c39d..c3bb22777ba671b55f014e8572ee887006442c3e 100644 --- a/pages/tabbar/search.vue +++ b/pages/tabbar/search.vue @@ -1,17 +1,17 @@ + //我在做这个文件,我的群昵称是King,QQ:36568008