拍卖行:出价后更新分红
This commit is contained in:
@@ -9,7 +9,8 @@ import { genCode } from '../pubUtils/util';
|
||||
@modelOptions({ schemaOptions: { id: false } })
|
||||
@index({ code: 1 })
|
||||
@index({ begin: -1, guildCode: 1 })
|
||||
@index({ begin: -1, serverId: 1})
|
||||
@index({ begin: -1, serverId: 1 })
|
||||
@index({ 'lots.code': 1 })
|
||||
export default class Dividend extends BaseModel {
|
||||
@prop({ required: true, default: 0 })
|
||||
serverId: number; // 区服编号
|
||||
@@ -58,6 +59,11 @@ export default class Dividend extends BaseModel {
|
||||
const result = await DividendModel.findOneAndUpdate({ code }, { ...update }, { new: true }).select('-_id -__v').lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async updateLot(lotCode: string, gid: number, price: number, incPrice: number) {
|
||||
const result = await DividendModel.findOneAndUpdate({ 'lots.code': lotCode }, { 'lots.$.gid': gid, 'lots.$.price': price, $inc: { totalPrice: incPrice} }, { new: true }).select('-_id -__v').lean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
export const DividendModel = getModelForClass(Dividend);
|
||||
|
||||
Reference in New Issue
Block a user