拍卖行:获取军团拍卖记录;修改分红机制

This commit is contained in:
liangtongchuan
2021-03-20 01:09:09 +08:00
parent 7df19fd510
commit a9d06173ac
7 changed files with 108 additions and 15 deletions
+7 -2
View File
@@ -61,13 +61,18 @@ export default class Dividend extends BaseModel {
return results;
}
public static async findDividendsByGuild(guildCode: string, count: number) {
const results = await DividendModel.find({ guildCode }).limit(count).sort({ _id: -1 }).select('-_id -__v').lean();
return results;
}
public static async updateDividend(code: string, update: DividendParam) {
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();
public static async updateLot(lotCode: string, gid: number, price: number, incPrice: number, max: boolean) {
const result = await DividendModel.findOneAndUpdate({ 'lots.code': lotCode }, { 'lots.$.gid': gid, 'lots.$.price': price, 'lots.$.time': new Date(), 'lots.$.max': max, $inc: { totalPrice: incPrice} }, { new: true }).select('-_id -__v').lean();
return result;
}