This commit is contained in:
xy
2026-03-13 01:38:40 +00:00
parent e6e4f88257
commit 28855885cd
311 changed files with 89544 additions and 94350 deletions
+2 -2
View File
@@ -146,8 +146,8 @@ export default class GVGLeagueFarm extends BaseModel {
const fieldResult: GVGLeagueFarmType[] = await GVGLeagueFarmModel.find({ configId, leagueCode, farmId, lockRoleId: roleId, harvestTime: { $lt: nowSeconds() } }).lean();
const _ids = fieldResult.map(cur => cur._id);
const result = await GVGLeagueFarmModel.updateMany({ _id: { $in: _ids } },
{ $set: { unlockTime: 0, harvestTime: 0, lockRoleId: '', lockRoleName: '', seedType: 0, index: 0 }}, { new: true });
if(result.modifiedCount == 0) return [];
{ $set: { unlockTime: 0, harvestTime: 0, lockRoleId: '', lockRoleName: '', seedType: 0, index: 0 } });
if((result as any).nModified == 0) return [];
return fieldResult
}
+3
View File
@@ -109,7 +109,10 @@ export default class Region extends BaseModel {
}
public static async findRegionByEnv(env: string) {
console.log('****** findRegionByEnv env:', env);
console.log('****** findRegionByEnv RegionModel:', RegionModel);
const rec: RegionType = await RegionModel.findOne({ env }).select('-_id').lean();
console.log('****** findRegionByEnv rec:', rec);
return rec;
}
+15 -9
View File
@@ -11,7 +11,7 @@ const moment = require('moment');
@index({ tel: 1 })
export default class Sms extends BaseModel {
@prop({ required: true, set: (val: string) => aesEncryptcfb(val, ENCRYPT_KEY, ENCRYPT_IV), get: (val: string) => aesDecryptcfb(val, ENCRYPT_KEY, ENCRYPT_IV) })
@prop({ required: true, set: (val: string) => aesEncryptcfb(val, ENCRYPT_KEY, ENCRYPT_IV), get: (val: string) => aesDecryptcfb(val, ENCRYPT_KEY, ENCRYPT_IV) })
tel: string;
@prop({ required: true })
@@ -33,7 +33,11 @@ export default class Sms extends BaseModel {
isFixed: boolean;
public static async findByTel(tel: string, lean = true) {
console.log(4);
const sms: SmsType = await smsModel.findOne({ tel }).lean(lean);
console.log(sms);
return sms;
}
@@ -71,17 +75,19 @@ export default class Sms extends BaseModel {
public static async fixSms(tel: string) {
const sms: SmsType = await smsModel.findOneAndUpdate({ tel }, { $setOnInsert: {
tel,
code: generateNum(6),
used: false,
updateTime: new Date(),
countToday: 1
}, $set: { isFixed: true } }, {new: true, upsert: true}).lean({ getters: true });
const sms: SmsType = await smsModel.findOneAndUpdate({ tel }, {
$setOnInsert: {
tel,
code: generateNum(6),
used: false,
updateTime: new Date(),
countToday: 1
}, $set: { isFixed: true }
}, { new: true, upsert: true }).lean({ getters: true });
return sms;
}
}
export const smsModel = getModelForClass(Sms);
export interface SmsType extends Pick<DocumentType<Sms>, keyof Sms>{};
export interface SmsType extends Pick<DocumentType<Sms>, keyof Sms> { };