✨ feat(拍卖行): 只流3个拍品到世界拍卖行
https://bantugame.feishu.cn/wiki/wikcn1qfpNYNUnOvuKiyK69eqqg?lang=zh-CN&open_in_browser=true
This commit is contained in:
@@ -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>{};
|
||||
Reference in New Issue
Block a user