underscore读取,排行榜保护
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
import BaseModel from './BaseModel';
|
||||
import { index, getModelForClass, prop, DocumentType, modelOptions } from '@typegoose/typegoose';
|
||||
const _ = require('underscore');
|
||||
import { findIndex } from 'underscore';
|
||||
// const Transaction = require("mongoose-transactions");
|
||||
@index({ roleId: 1, id: 1 })
|
||||
@index({ seqId: 1 })
|
||||
@@ -60,7 +60,7 @@ export default class Item extends BaseModel {
|
||||
rec = await ItemModel.findOneAndUpdate({ roleId, id }, { $inc: { count: ratio * count } }, { new: true, upsert: true }).lean(lean);
|
||||
}
|
||||
if (!!rec) {
|
||||
let index = _.findIndex(result,{id})
|
||||
let index = findIndex(result,{id})
|
||||
if (!!result[index]) {
|
||||
result[index] = { id: rec.id, count: rec.count }
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user