feat(拍卖行): 只流3个拍品到世界拍卖行

https://bantugame.feishu.cn/wiki/wikcn1qfpNYNUnOvuKiyK69eqqg?lang=zh-CN&open_in_browser=true
This commit is contained in:
luying
2022-10-25 17:33:46 +08:00
parent ecba195051
commit 44787d68a5
8 changed files with 95 additions and 24 deletions
+28
View File
@@ -0,0 +1,28 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoose';
/**
* 自增 ID
*/
@index({ sourceType: 1, time: 1, id: 1 })
export default class CounterLots extends BaseModel {
@prop({ required: true })
beginTime: Date;
@prop({ required: true })
id: number;
@prop({ required: true })
seq: number;
public static async getNewCounter(id: number, beginTime: Date, inc: number) {
let counter: CounterLotsType = await CounterLotsModel.findOneAndUpdate({ beginTime, id }, { $inc: { seq: inc } }, { new: true, upsert: true }).lean();
return counter?.seq;
}
}
export const CounterLotsModel = getModelForClass(CounterLots);
export interface CounterLotsType extends Pick<DocumentType<CounterLots>, keyof CounterLots>{};