军团:修改拍卖行价格

This commit is contained in:
luying
2022-01-13 17:23:19 +08:00
parent f7f930deaf
commit cc27f74179
3 changed files with 15 additions and 12 deletions

View File

@@ -73,25 +73,26 @@ export class AuctionHandler {
return resResult(STATUS.AUCTION_GUILD_MEMBER_ONLY);
}
const { curBuyer, curPrice, maxPrice, gid, count, bidRoles, watchingRoles } = lot;
let { curBuyer, curPrice, prePrice, maxPrice, gid, count, bidRoles, watchingRoles } = lot;
if (curBuyer === roleId && !max) {
res.releaseCallback();
return resResult(STATUS.LOT_OFFER_SERIAL);
}
let newPrice = Math.floor(curPrice * dicParam.GUILD_AUCTION.AUCTION_PRICE_RISE);
let maxFlag = max;
if (newPrice >= maxPrice) {
if (curPrice >= maxPrice) {
curPrice = maxPrice;
newPrice = maxPrice;
maxFlag = true;
}
const costRes = await handleCost(roleId, sid, [{ id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.GOLD), count: newPrice }], ITEM_CHANGE_REASON.AUCTION_OFFER);
const costRes = await handleCost(roleId, sid, [{ id: CURRENCY_BY_TYPE.get(CURRENCY_TYPE.GOLD), count: curPrice }], ITEM_CHANGE_REASON.AUCTION_OFFER);
if (!costRes) {
res.releaseCallback();
return resResult(STATUS.ROLE_COIN_NOT_ENOUGH);
}
if (curBuyer) {
await sendMailByContent(MAIL_TYPE.AUCTION_OVER, curBuyer, { goods: [getGoldObject(curPrice)] });
if (curBuyer && prePrice > 0) {
await sendMailByContent(MAIL_TYPE.AUCTION_OVER, curBuyer, { goods: [getGoldObject(prePrice)] });
}
if (maxFlag) {
@@ -101,7 +102,7 @@ export class AuctionHandler {
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() });
const newLot = await LotModel.updateLot({ code, curBuyer: roleId, curPrice: newPrice, bidRoles, status: max ? LOT_STATUS.MAX : (maxFlag ? LOT_STATUS.SOLD : LOT_STATUS.ING), watchingRoles: Array.from(new Set([...watchingRoles, roleId])) });
const newLot = await LotModel.updateLot({ code, curBuyer: roleId, curPrice: newPrice, prePrice: curPrice, bidRoles, status: max ? LOT_STATUS.MAX : (maxFlag ? LOT_STATUS.SOLD : LOT_STATUS.ING), watchingRoles: Array.from(new Set([...watchingRoles, roleId])) });
await pushAuctionOver(newLot); // 推送竞价超过标志
res.releaseCallback();
@@ -194,9 +195,9 @@ export class AuctionHandler {
});
const lotRecs = lotsData.map(lot => {
const { gid, count, price: lotPrice } = lot;
const price = lotPrice === 0 ? getBasePrice(gid, count) : lotPrice;
// const price = lotPrice === 0 ? getBasePrice(gid, count) : lotPrice;
const sold = guildBidStatus(lot);
return { ...lot, price, sold };
return { ...lot, price: lotPrice, sold };
});
return resResult(STATUS.SUCCESS, { lotRecs });