增加自定义排序
This commit is contained in:
parent
c32af04b8b
commit
cffb66c9d1
@ -55,7 +55,7 @@ class PuzzleClass extends BaseModule {
|
|||||||
public createtime: Date
|
public createtime: Date
|
||||||
|
|
||||||
public static parseQueryParam(params) {
|
public static parseQueryParam(params) {
|
||||||
let {key, timeBegin, timeEnd, tag, sub_tag, groups, dp, quality } = params
|
let {key, timeBegin, timeEnd, tag, sub_tag, groups, dp, quality, sort } = params
|
||||||
let opt: any = {deleted: 0, is_hide: 0}
|
let opt: any = {deleted: 0, is_hide: 0}
|
||||||
if (key) {
|
if (key) {
|
||||||
opt.question = {$regex: key, $options: 'i'}
|
opt.question = {$regex: key, $options: 'i'}
|
||||||
@ -86,9 +86,12 @@ class PuzzleClass extends BaseModule {
|
|||||||
} else if (!timeBegin && timeEnd) {
|
} else if (!timeBegin && timeEnd) {
|
||||||
opt.createtime = {$lte: timeEnd};
|
opt.createtime = {$lte: timeEnd};
|
||||||
}
|
}
|
||||||
|
let sortObj = {_id: 1}
|
||||||
|
if (sort) {
|
||||||
|
sortObj = sort
|
||||||
|
}
|
||||||
|
|
||||||
let sort = {_id: 1}
|
return { opt, sort: sortObj }
|
||||||
return { opt, sort }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async nextQuestion(this: ReturnModelType<typeof PuzzleClass>, id: string) {
|
public static async nextQuestion(this: ReturnModelType<typeof PuzzleClass>, id: string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user