拍卖行:定时刷新、结算和简单测试,个别bug修复
This commit is contained in:
+11
-2
@@ -56,6 +56,11 @@ export default class Dividend extends BaseModel {
|
||||
return results;
|
||||
}
|
||||
|
||||
public static async findDividendsByBegin(begin: Date) {
|
||||
const results = await DividendModel.find({ begin }).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;
|
||||
@@ -67,12 +72,12 @@ export default class Dividend extends BaseModel {
|
||||
}
|
||||
|
||||
public static async findReadyDividend(guildCode: string, sourceType: number) {
|
||||
const result: DividendType = await DividendModel.findOne({ guildCode, sourceType, status: DIVIDEND_STATUS.ING }).select('-_id -__v').lean();
|
||||
const result: DividendType = await DividendModel.findOne({ guildCode, sourceType, status: DIVIDEND_STATUS.END }).select('-_id -__v').lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async updateReceiveStatus(code: string, roleId: string) {
|
||||
const result: DividendType = await DividendModel.findOneAndUpdate({ code, status: DIVIDEND_STATUS.END, 'lots.roleId': roleId }, { 'lots.status': ROLE_RECEIVE_STATUS.YES }, { new: true }).select('-_id -__v').lean();
|
||||
const result: DividendType = await DividendModel.findOneAndUpdate({ code, status: DIVIDEND_STATUS.END, 'lodividendsts.roleId': roleId }, { 'dividends.$.status': ROLE_RECEIVE_STATUS.YES }, { new: true }).select('-_id -__v').lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -80,6 +85,10 @@ export default class Dividend extends BaseModel {
|
||||
const result: DividendType = await DividendModel.findOneAndUpdate({ guildCode, sourceType }, { status }, { new: true }).select('-_id -__v').lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async updateDividendsStatus(begin: Date, status: number) {
|
||||
await DividendModel.updateMany({ begin }, { status });
|
||||
}
|
||||
}
|
||||
|
||||
export const DividendModel = getModelForClass(Dividend);
|
||||
|
||||
@@ -107,6 +107,11 @@ export default class Lot extends BaseModel {
|
||||
const result: LotType = await LotModel.findOneAndUpdate({ code }, { auctionStage }).select('-_id -__v').lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async updateLotsStageByBegin(begin: Date, auctionStage: number) {
|
||||
const results = await LotModel.updateMany({ begin }, { auctionStage }).select('-_id -__v').lean();
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
export const LotModel = getModelForClass(Lot);
|
||||
|
||||
Reference in New Issue
Block a user