网安:修复sms获取bug

This commit is contained in:
luying
2021-04-09 13:59:12 +08:00
parent b9e59202da
commit 7b8b009d1a
2 changed files with 4 additions and 11 deletions

View File

@@ -33,9 +33,7 @@ export default class Sms extends BaseModel {
isFixed: boolean;
public static async findByTel(tel: string, lean = true) {
let _tel = aesEncryptcfb(tel, ENCRYPT_KEY, ENCRYPT_IV);
const sms: SmsType = await smsModel.findOne({ tel: _tel }).lean(lean);
const sms: SmsType = await smsModel.findOne({ tel }).lean(lean);
return sms;
}
@@ -72,9 +70,8 @@ export default class Sms extends BaseModel {
}
public static async fixSms(tel: string) {
let _tel = aesEncryptcfb(tel, ENCRYPT_KEY, ENCRYPT_IV);
const sms: SmsType = await smsModel.findOneAndUpdate({ tel: _tel }, { $setOnInsert: {
const sms: SmsType = await smsModel.findOneAndUpdate({ tel }, { $setOnInsert: {
tel,
code: generateNum(6),
used: false,