邮件,异地登录bug

This commit is contained in:
mamengke01
2021-01-09 19:07:49 +08:00
parent e22e2b168c
commit 0f04e55b34
12 changed files with 155 additions and 45 deletions

View File

@@ -1,7 +1,7 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose';
const _ = require('underscore');
// const Transaction = require('mongoose-transactions');
// const Transaction = require("mongoose-transactions");
@index({ roleId: 1, id: 1 })
@index({ seqId: 1 })
@modelOptions({ schemaOptions: { id: false } })
@@ -86,14 +86,8 @@ export default class Item extends BaseModel {
// let hasError: boolean = false, result = new Array();
// try {
// for (let { id, count, ratio } of items) {
// if (ratio) ratio = -1;
// await transaction.update({ roleId, id, count: { $gte: count } }, { $inc: { count: ratio * count } }, { new: true});
// const rec: ItemType = await transaction.findOneAndUpdate({ roleId, id, count: { $gte: count } }, { $inc: { count: ratio * count } }, { new: true}).lean(lean);
// if (!!rec) {
// result.push({ id: rec.id, count: rec.count });
// } else {
// hasError = true; break;
// }
// if (!ratio) ratio = -1;
// await transaction.update("Item", { roleId, id, count: { $gte: count } }, { $inc: { count: ratio * count } }, { new: true});
// }
// await transaction.run();
// return {hasError, result};