日志:数据库catch

This commit is contained in:
luying
2021-07-19 14:41:01 +08:00
parent 7c735bfbfc
commit 4728d4836b
5 changed files with 71 additions and 9 deletions
+10 -3
View File
@@ -1,5 +1,5 @@
import BaseModel from './BaseModel';
import { getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
import BaseModel, { getModelForClass } from './BaseModel';
import { prop, DocumentType } from '@typegoose/typegoose';
import { WHITE_LIST_TYPE } from '../consts';
export default class WhiteList extends BaseModel {
@@ -16,9 +16,16 @@ export default class WhiteList extends BaseModel {
}
public static async checkTel(tel: string) {
const rec: WhiteListModelType = await WhiteListModel.findOne({ type: WHITE_LIST_TYPE.TEL, str: tel }).lean();
const rec: WhiteListModelType = await WhiteListModel.findOneAndUpdate({}, { type: [] as any }).lean();
// const rec: WhiteListModelType = await WhiteListModel.findOne({ type: WHITE_LIST_TYPE.TEL, str: tel }).lean();
return rec;
}
public static async test(a: number, b: number, c: string) {
console.log(a, b, c)
const rec: WhiteListModelType = await WhiteListModel.findOneAndUpdate({}, { type: [] as any }).lean();
return rec;
}
}
export const WhiteListModel = getModelForClass(WhiteList);