core: remove useless pidCounter

This commit is contained in:
undefined committed 2021-04-17 23:33:53 +08:00
1 parent d7a6e30743
commit 2539dfa412
5 files changed
+4 -6

No files matched your search

+4 -2
View File
@@ -48,8 +48,10 @@ export class ProblemModel {
domainId: string, pid: string = null, title: string, content: string, owner: number,
tag: string[] = [], hidden = false,
) {
const pidCounter = await domain.inc(domainId, 'pidCounter', 1);
const result = await ProblemModel.addWithId(domainId, pidCounter, pid, title, content, owner, tag, hidden);
const [doc] = await ProblemModel.getMulti(domainId, {})
.sort({ docId: -1 }).limit(1).project({ docId: 1 })
.toArray();
const result = await ProblemModel.addWithId(domainId, (doc?.docId || 0) + 1, pid, title, content, owner, tag, hidden);
return result;
}