feat,wip: 입찰 기능 동작
This commit is contained in:
@@ -37,18 +37,32 @@ class GetActiveResourceAuctionList extends \sammo\BaseAPI
|
||||
$sellRiceList = [];
|
||||
/** @var AuctionInfo[] */
|
||||
$auctions = array_map(fn ($raw) => AuctionInfo::fromArray($raw), $db->query(
|
||||
'SELECT * FROM `ng_auction` WHERE `type` IN %ls AND `finished` != 0 ORDER BY `close_date` DESC',
|
||||
'SELECT * FROM `ng_auction` WHERE `type` IN %ls AND `finished` = 0 ORDER BY `close_date` DESC',
|
||||
[
|
||||
AuctionType::BuyRice->value,
|
||||
AuctionType::SellRice->value,
|
||||
]
|
||||
));
|
||||
|
||||
$recentLogs = getAuctionLogRecent(20);
|
||||
|
||||
|
||||
if (!$auctions) {
|
||||
return [
|
||||
'result' => true,
|
||||
'buyRice' => $buyRiceList,
|
||||
'sellRice' => $sellRiceList,
|
||||
'recentLogs' => $recentLogs,
|
||||
'generalID' => $session->generalID,
|
||||
];
|
||||
}
|
||||
|
||||
$auctionIDList = [];
|
||||
foreach ($auctions as $auction) {
|
||||
$auctionIDList[] = $auction->id;
|
||||
}
|
||||
|
||||
|
||||
$rawHighestBids = Util::convertArrayToDict($db->query(
|
||||
'SELECT bid.* FROM `ng_auction_bid` bid INNER JOIN (
|
||||
SELECT `auction_id`, MAX(`amount`) as `max_amount`
|
||||
@@ -87,7 +101,7 @@ class GetActiveResourceAuctionList extends \sammo\BaseAPI
|
||||
'amount' => $highestBid->amount,
|
||||
'date' => TimeUtil::format($highestBid->date, false),
|
||||
'generalID' => $highestBid->generalID,
|
||||
'generalName' => $highestBid->data->generalName,
|
||||
'generalName' => $highestBid->aux->generalName,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -98,8 +112,6 @@ class GetActiveResourceAuctionList extends \sammo\BaseAPI
|
||||
}
|
||||
}
|
||||
|
||||
$recentLogs = getAuctionLogRecent(20);
|
||||
|
||||
return [
|
||||
'result' => true,
|
||||
'buyRice' => $buyRiceList,
|
||||
|
||||
@@ -60,7 +60,7 @@ class GetUniqueItemAuctionDetail extends \sammo\BaseAPI
|
||||
$responseBid = [];
|
||||
foreach ($bidList as $bid) {
|
||||
$responseBid[] = [
|
||||
'generalName' => $bid->data->generalName,
|
||||
'generalName' => $bid->aux->generalName,
|
||||
'amount' => $bid->amount,
|
||||
'isCallerHighestBidder' => $bid->generalID === $generalID,
|
||||
'date' => $bid->date,
|
||||
@@ -74,7 +74,7 @@ class GetUniqueItemAuctionDetail extends \sammo\BaseAPI
|
||||
'finished' => $auction->finished,
|
||||
'title' => $auction->detail->title,
|
||||
'target' => $auction->target,
|
||||
'isCallerHost' => $auction->openerGeneralID === $generalID,
|
||||
'isCallerHost' => $auction->hostGeneralID === $generalID,
|
||||
'hostName' => $auction->detail->hostName,
|
||||
'remainCloseDateExtensionCnt' => $auction->detail->remainCloseDateExtensionCnt,
|
||||
'availableLatestBidCloseDate' => $auction->detail->availableLatestBidCloseDate,
|
||||
|
||||
@@ -69,12 +69,12 @@ class GetUniqueItemAuctionList extends \sammo\BaseAPI
|
||||
'finished' => $auction->finished,
|
||||
'title' => $auction->detail->title,
|
||||
'target' => $auction->target,
|
||||
'isCallerHost' => $auction->openerGeneralID === $generalID,
|
||||
'isCallerHost' => $auction->hostGeneralID === $generalID,
|
||||
'hostName' => $auction->detail->hostName,
|
||||
'remainCloseDateExtensionCnt' => $auction->detail->remainCloseDateExtensionCnt,
|
||||
'availableLatestBidCloseDate' => $auction->detail->availableLatestBidCloseDate,
|
||||
'highestBid' => [
|
||||
'generalName' => $highestBid->data->generalName,
|
||||
'generalName' => $highestBid->aux->generalName,
|
||||
'amount' => $highestBid->amount,
|
||||
'isCallerHighestBidder' => $highestBid->generalID === $generalID,
|
||||
'date' => $highestBid->date,
|
||||
|
||||
Reference in New Issue
Block a user