feat,wip: 입찰 기능 동작
This commit is contained in:
@@ -45,7 +45,7 @@ abstract class AuctionBasicResource extends Auction
|
||||
$db = DB::db();
|
||||
if (!($general instanceof DummyGeneral)) {
|
||||
$prevAuctionID = $db->queryFirstField(
|
||||
'SELECT id FROM ng_auction WHERE opener_general_id = %i AND finished = 0 AND `type` IN %ls',
|
||||
'SELECT id FROM ng_auction WHERE host_general_id = %i AND finished = 0 AND `type` IN %ls',
|
||||
$general->getID(),
|
||||
[AuctionType::BuyRice->value, AuctionType::SellRice->value],
|
||||
);
|
||||
@@ -88,7 +88,7 @@ abstract class AuctionBasicResource extends Auction
|
||||
$general->increaseVarWithLimit($hostRes->value, -$amount, 0);
|
||||
$general->applyDB($db);
|
||||
|
||||
return new self($openResult, $general);
|
||||
return new static($openResult, $general);
|
||||
}
|
||||
|
||||
static public function genDummy(): DummyGeneral
|
||||
@@ -102,12 +102,12 @@ abstract class AuctionBasicResource extends Auction
|
||||
|
||||
protected function rollbackAuction(): void
|
||||
{
|
||||
if ($this->general->getID() === $this->info->openerGeneralID) {
|
||||
if ($this->general->getID() === $this->info->hostGeneralID) {
|
||||
$auctionHost = $this->general;
|
||||
} else if ($this->info->openerGeneralID == 0) {
|
||||
} else if ($this->info->hostGeneralID == 0) {
|
||||
$auctionHost = $this->genDummy();
|
||||
} else {
|
||||
$auctionHost = General::createGeneralObjFromDB($this->info->openerGeneralID);
|
||||
$auctionHost = General::createGeneralObjFromDB($this->info->hostGeneralID);
|
||||
}
|
||||
|
||||
$hostRes = static::$hostRes;
|
||||
@@ -143,12 +143,12 @@ abstract class AuctionBasicResource extends Auction
|
||||
|
||||
protected function finishAuction(AuctionBidItem $highestBid, General $bidder): ?string
|
||||
{
|
||||
if ($this->general->getID() === $this->info->openerGeneralID) {
|
||||
if ($this->general->getID() === $this->info->hostGeneralID) {
|
||||
$auctionHost = $this->general;
|
||||
} else if ($this->info->openerGeneralID == 0) {
|
||||
} else if ($this->info->hostGeneralID == 0) {
|
||||
$auctionHost = $this->genDummy();
|
||||
} else {
|
||||
$auctionHost = General::createGeneralObjFromDB($this->info->openerGeneralID);
|
||||
$auctionHost = General::createGeneralObjFromDB($this->info->hostGeneralID);
|
||||
}
|
||||
|
||||
$highestBid = $this->getHighestBid();
|
||||
@@ -215,7 +215,7 @@ abstract class AuctionBasicResource extends Auction
|
||||
|
||||
public function bid(int $amount, bool $tryExtendCloseDate = false): ?string
|
||||
{
|
||||
if ($this->info->openerGeneralID === $this->general->getID()) {
|
||||
if ($this->info->hostGeneralID === $this->general->getID()) {
|
||||
return '자신이 연 경매에 입찰할 수 없습니다.';
|
||||
}
|
||||
$result = $this->_bid($amount, $tryExtendCloseDate);
|
||||
@@ -232,5 +232,7 @@ abstract class AuctionBasicResource extends Auction
|
||||
$date = (new DateTimeImmutable())->add(TimeUtil::secondsToDateInterval($turnTerm * 60));
|
||||
$this->shrinkCloseDate($date);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user