🐞 fix(拍卖行): 修复拍卖行发生的很多问题
This commit is contained in:
@@ -106,21 +106,30 @@ export class AuctionHandler {
|
||||
return resResult(STATUS.ROLE_COIN_NOT_ENOUGH);
|
||||
}
|
||||
|
||||
if (curBuyer && prePrice > 0) {
|
||||
await sendMailByContent(MAIL_TYPE.AUCTION_OVER, curBuyer, { goods: [getGoldObject(prePrice)] });
|
||||
}
|
||||
|
||||
if (maxFlag) {
|
||||
newPrice = maxPrice;
|
||||
await sendMailByContent(MAIL_TYPE.AUTION_REWARD, roleId, { goods: [{ id: gid, count }] });
|
||||
let dicGoods = gameData.goods.get(gid);
|
||||
reportTAEvent(roleId, TA_EVENT.AUCTION_ITEM_GET, { item_name: dicGoods?.name, item_count: count, deel_price: newPrice }, ip);
|
||||
}
|
||||
bidRoles.push({ roleId, price: newPrice, time: new Date() });
|
||||
let lotStatus = await getLotStatus(auctionStage, max, maxFlag)
|
||||
let update: LotParam = { code, curBuyer: roleId, curPrice: newPrice, auctionStage, prePrice: curPrice, bidRoles, status: lotStatus, watchingRoles: Array.from(new Set([...watchingRoles, roleId])), seq: 0 };
|
||||
if(lotStatus == LOT_STATUS.BIDDING) update.end = new Date(Date.now() + AUCTION_BID_EXTEND_TIME * 1000);
|
||||
const newLot = await LotModel.updateLot(update);
|
||||
if(!newLot) {
|
||||
// 如果拍卖行状态不对,那回退handleCost
|
||||
if (curBuyer && prePrice > 0) {
|
||||
await sendMailByContent(MAIL_TYPE.AUCTION_OVER, roleId, { goods: [getGoldObject(curPrice)] });
|
||||
}
|
||||
res.releaseCallback();
|
||||
return resResult(STATUS.GUILD_LOT_HAS_SOLD);
|
||||
} else {
|
||||
if (curBuyer && prePrice > 0) {
|
||||
await sendMailByContent(MAIL_TYPE.AUCTION_OVER, curBuyer, { goods: [getGoldObject(prePrice)] });
|
||||
}
|
||||
|
||||
if (maxFlag) {
|
||||
newPrice = maxPrice;
|
||||
await sendMailByContent(MAIL_TYPE.AUTION_REWARD, roleId, { goods: [{ id: gid, count }] });
|
||||
let dicGoods = gameData.goods.get(gid);
|
||||
reportTAEvent(roleId, TA_EVENT.AUCTION_ITEM_GET, { item_name: dicGoods?.name, item_count: count, deel_price: newPrice }, ip);
|
||||
}
|
||||
}
|
||||
await extendLotTime(newLot);
|
||||
if(seq <= LOTS_KEEP_TO_WORLD_CNT && seq > 0) await LotModel.updateOne({ begin, gid, count, status: LOT_STATUS.DEFAULT, serverId, seq: { $gt: LOTS_KEEP_TO_WORLD_CNT } }, { $set: { seq }});
|
||||
await pushAuctionOver(newLot); // 推送竞价超过标志
|
||||
|
||||
Reference in New Issue
Block a user