增加问题的查询条件

This commit is contained in:
zhl 2021-04-30 11:13:58 +08:00
parent c9ab0124a9
commit 7af83ecd45

View File

@ -55,7 +55,7 @@ class PuzzleClass extends BaseModule {
public createtime: Date
public static parseQueryParam(params) {
let {key, timeBegin, timeEnd, tag, sub_tag, groups } = params
let {key, timeBegin, timeEnd, tag, sub_tag, groups, dp, quality } = params
let opt: any = {deleted: 0, is_hide: 0}
if (key) {
opt.question = {$regex: key, $options: 'i'}
@ -69,6 +69,12 @@ class PuzzleClass extends BaseModule {
if (groups) {
Object.assign(opt, {groups})
}
if (quality != undefined) {
opt.quality = quality
}
if (dp != undefined) {
opt.dp = dp
}
if (timeBegin && !timeEnd) {
opt.createtime = {$gte: timeBegin};
} else if (timeBegin && timeEnd) {