feat,wip: 경매장 API 작성

This commit is contained in:
2022-06-09 01:21:21 +09:00
parent f607350442
commit 4b436b1499
13 changed files with 372 additions and 53 deletions
+7 -1
View File
@@ -8,6 +8,7 @@ use DateTimeInterface;
use sammo\DTO\AuctionBidItem;
use sammo\DTO\AuctionBidItemData;
use sammo\DTO\AuctionInfo;
use sammo\Enums\AuctionType;
use sammo\Enums\InheritanceKey;
use sammo\Enums\RankColumn;
use sammo\Enums\ResourceType;
@@ -17,6 +18,8 @@ abstract class Auction
protected AuctionInfo $info;
static AuctionType $auctionType;
public const COEFF_AUCTION_CLOSE_MINUTES = 24;
public const COEFF_EXTENSION_MINUTES_PER_BID = 1 / 6;
public const COEFF_EXTENSION_MINUTES_LIMIT_BY_BID = 1;
@@ -91,6 +94,9 @@ abstract class Auction
throw new \RuntimeException("해당 경매가 없습니다: {$auctionID}");
}
$this->info = AuctionInfo::fromArray($rawAuctionInfo);
if($this->info->type !== $this->auctionType){
throw new \RuntimeException("잘못된 경매 타입입니다: {$this->info->type} != {$this->auctionType}");
}
}
public function getInfo(): AuctionInfo
@@ -420,7 +426,7 @@ abstract class Auction
return false;
}
abstract public function bid(int $amount, bool $tryExtendCloseDate = false): ?string;
abstract public function bid(int $amount, bool $tryExtendCloseDate): ?string;
abstract protected function rollbackAuction(): void;
abstract protected function finishAuction(AuctionBidItem $highestBid, General $bidder): ?string;