Improve log api
This commit is contained in:
parent
60c30ece10
commit
3c77ae7b62
@ -34,11 +34,27 @@ export default define(meta, async (ps) => {
|
|||||||
|
|
||||||
if (ps.level) query.level = ps.level;
|
if (ps.level) query.level = ps.level;
|
||||||
if (ps.domain) {
|
if (ps.domain) {
|
||||||
|
for (const d of ps.domain.split(' ')) {
|
||||||
|
const qs: any[] = [];
|
||||||
let i = 0;
|
let i = 0;
|
||||||
for (const d of ps.domain.split('.')) {
|
for (const sd of (d.startsWith('-') ? d.substr(1) : d).split('.')) {
|
||||||
query[`domain.${i}`] = d;
|
qs.push({
|
||||||
|
[`domain.${i}`]: d.startsWith('-') ? { $ne: sd } : sd
|
||||||
|
});
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
if (d.startsWith('-')) {
|
||||||
|
if (query['$and'] == null) query['$and'] = [];
|
||||||
|
query['$and'].push({
|
||||||
|
$and: qs
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (query['$or'] == null) query['$or'] = [];
|
||||||
|
query['$or'].push({
|
||||||
|
$and: qs
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const logs = await Log
|
const logs = await Log
|
||||||
|
Loading…
Reference in New Issue
Block a user