拍卖行:获取数据接口和出价接口部分功能
This commit is contained in:
@@ -34,3 +34,5 @@ export const DIVIDEND_STATUS = {
|
||||
END: 2, // 2:已结束
|
||||
SENT: 3, // 3:已发放
|
||||
};
|
||||
|
||||
export const OFFER_RATIO = 1.1;
|
||||
|
||||
@@ -191,6 +191,10 @@ export const STATUS = {
|
||||
GUILD_TRAIN_BOX_IS_OVER_TIME: { code: 20971, simStr: '军团宝箱超时' },
|
||||
GUILD_TRAIN_BOX_INDEX_IS_GOT:{ code: 20972, simStr: '该位置试炼宝箱已经领取过,请重新选择' },
|
||||
GUILD_TRAIN_BOX_IS_GOT: { code: 20973, simStr: '玩家已经领取该试炼宝箱' },
|
||||
|
||||
// 军团拍卖
|
||||
GUILD_LOT_NOT_FOUND: { code: 21001, simStr: '拍品未找到' },
|
||||
LOT_OFFER_SERIAL: { code: 21002, simStr: '不能连续出价' },
|
||||
// 通用 30000 - 30099
|
||||
DIC_DATA_NOT_FOUND: { code: 30000, simStr: '数据表未找到' },
|
||||
ROLE_MATERIAL_NOT_ENOUGH: { code: 30001, simStr: '材料数量不足' },
|
||||
|
||||
+13
-2
@@ -8,7 +8,8 @@ import { genCode } from '../pubUtils/util';
|
||||
**/
|
||||
@modelOptions({ schemaOptions: { id: false } })
|
||||
@index({ code: 1 })
|
||||
@index({ guildCode: 1 })
|
||||
@index({ begin: -1, guildCode: 1 })
|
||||
@index({ begin: -1, serverId: 1})
|
||||
export default class Dividend extends BaseModel {
|
||||
@prop({ required: true, default: 0 })
|
||||
serverId: number; // 区服编号
|
||||
@@ -29,7 +30,7 @@ export default class Dividend extends BaseModel {
|
||||
@prop({ required: true, default: 0 })
|
||||
status: number; // 0:未开始;1:进行中;2:已结束;3:已发放
|
||||
@prop({ required: true })
|
||||
end: Date;
|
||||
begin: Date;
|
||||
|
||||
public static async createDividend(data: DividendParam) {
|
||||
const code = genCode(8);
|
||||
@@ -43,6 +44,16 @@ export default class Dividend extends BaseModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async findWorldDividendsByBegin(serverId: number, begin: Date) {
|
||||
const results = await DividendModel.find({ serverId, begin }).select('-_id -__v').lean();
|
||||
return results;
|
||||
}
|
||||
|
||||
public static async findGuildDividendsByBegin(guildCode: string, begin: Date) {
|
||||
const results = await DividendModel.find({ guildCode, 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;
|
||||
|
||||
+14
-3
@@ -8,7 +8,7 @@ import { genCode } from '../pubUtils/util';
|
||||
**/
|
||||
@modelOptions({ schemaOptions: { id: false } })
|
||||
@index({ code: 1 })
|
||||
@index({ guildCode: 1, createdAt: -1 })
|
||||
@index({ guildCode: 1, begin: -1 })
|
||||
export default class Lot extends BaseModel {
|
||||
@prop({ required: true, default: 0 })
|
||||
auctionStage: number; // 0:初始添加,1:军团拍卖,2:世界拍卖,3:拍卖结束
|
||||
@@ -56,10 +56,21 @@ export default class Lot extends BaseModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async findGuildLotsByTime(guildCode: string, sourceType: number, time: Date) {
|
||||
const results = await LotModel.find({ guildCode, sourceType, createdAt: { $gte: time } }).select('-_id -__v').lean();
|
||||
public static async findGuildLotsByBegin(guildCode: string, time: Date) {
|
||||
const results = await LotModel.find({ guildCode, begin: { $eq: time } }).select('-_id -__v').lean();
|
||||
return results;
|
||||
}
|
||||
|
||||
public static async findWorldLotsByBegin(serverId: number, time: Date) {
|
||||
const results = await LotModel.find({ serverId, begin: { $eq: time } }).select('-_id -__v').lean();
|
||||
return results;
|
||||
}
|
||||
|
||||
public static async updateLot(data: LotParam) {
|
||||
const code = data.code!;
|
||||
const result: LotType = await LotModel.findOneAndUpdate({ code }, { ...data }, { new: true }).select('-_id -__v').lean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
export const LotModel = getModelForClass(Lot);
|
||||
|
||||
Reference in New Issue
Block a user