mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
修复一些错误
This commit is contained in:
1 parent
747cb1b9b5
commit
b19f948fdd
30 files changed
+306
-132
No files matched your search
@@ -123,11 +123,11 @@ function count(query) {
|
||||
return coll.find(query).count();
|
||||
}
|
||||
async function random(query) {
|
||||
const pdocs = coll.find(query);
|
||||
const pcount = await pdocs.count();
|
||||
const cursor = coll.find(query);
|
||||
const pcount = await cursor.count();
|
||||
if (pcount) {
|
||||
const pdoc = await pdocs.skip(Math.floor(Math.random() * pcount)).limit(1).toArray()[0];
|
||||
return pdoc.pid;
|
||||
const pdoc = await cursor.skip(Math.floor(Math.random() * pcount)).limit(1).toArray();
|
||||
return pdoc[0].pid;
|
||||
} return null;
|
||||
}
|
||||
async function getList(pids) {
|
||||
|
||||
Reference in new issue
Block a user