feat,fix,wip: 버그 수정, 연장 시간 로직 변경
This commit is contained in:
@@ -37,7 +37,7 @@ 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` ASC',
|
||||
[
|
||||
AuctionType::BuyRice->value,
|
||||
AuctionType::SellRice->value,
|
||||
|
||||
@@ -80,8 +80,9 @@ class GetUniqueItemAuctionDetail extends \sammo\BaseAPI
|
||||
'target' => $auction->target,
|
||||
'isCallerHost' => $auction->hostGeneralID === $generalID,
|
||||
'hostName' => $auction->detail->hostName,
|
||||
'closeDate' => TimeUtil::format($auction->closeDate, false),
|
||||
'remainCloseDateExtensionCnt' => $auction->detail->remainCloseDateExtensionCnt,
|
||||
'availableLatestBidCloseDate' => $auction->detail->availableLatestBidCloseDate,
|
||||
'availableLatestBidCloseDate' => TimeUtil::format($auction->detail->availableLatestBidCloseDate, false),
|
||||
],
|
||||
'bidList' => $responseBid,
|
||||
'obfuscatedName' => $obfuscatedName,
|
||||
|
||||
@@ -32,10 +32,21 @@ class GetUniqueItemAuctionList extends \sammo\BaseAPI
|
||||
|
||||
/** @var AuctionInfo[] */
|
||||
$auctions = array_map(fn($raw)=>AuctionInfo::fromArray($raw), $db->query(
|
||||
'SELECT * FROM `ng_auction` WHERE `type` = %s ORDER BY `close_date` DESC',
|
||||
'SELECT * FROM `ng_auction` WHERE `type` = %s ORDER BY `close_date` ASC',
|
||||
AuctionType::UniqueItem->value
|
||||
) ?? []);
|
||||
|
||||
$obfuscatedName = AuctionUniqueItem::genObfuscatedName($generalID);
|
||||
|
||||
if(!$auctions){
|
||||
return [
|
||||
'result' => true,
|
||||
'list' => [],
|
||||
'obfuscatedName' => $obfuscatedName,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
$auctionIDList = [];
|
||||
foreach ($auctions as $auction) {
|
||||
$auctionIDList[] = $auction->id;
|
||||
@@ -58,8 +69,6 @@ class GetUniqueItemAuctionList extends \sammo\BaseAPI
|
||||
$rawHighestBids
|
||||
);
|
||||
|
||||
$obfuscatedName = AuctionUniqueItem::genObfuscatedName($generalID);
|
||||
|
||||
$response = [];
|
||||
foreach ($auctions as $auction) {
|
||||
$auctionID = $auction->id;
|
||||
|
||||
@@ -5,9 +5,12 @@ namespace sammo\API\Auction;
|
||||
use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use sammo\AuctionBuyRice;
|
||||
use sammo\DB;
|
||||
use sammo\Validator;
|
||||
use sammo\GameConst;
|
||||
use sammo\General;
|
||||
use sammo\KVStorage;
|
||||
use sammo\Util;
|
||||
|
||||
class OpenBuyRiceAuction extends \sammo\BaseAPI
|
||||
{
|
||||
@@ -64,6 +67,16 @@ class OpenBuyRiceAuction extends \sammo\BaseAPI
|
||||
|
||||
$general = General::createGeneralObjFromDB($generalID);
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
[$initYear, $initMonth, $year, $month] = $gameStor->getValuesAsArray(['init_year', 'init_month', 'year', 'month']);
|
||||
$initYearMonth = Util::joinYearMonth($initYear, $initMonth);
|
||||
$yearMonth = Util::joinYearMonth($year, $month);
|
||||
|
||||
if($yearMonth <= $initYearMonth + 3){
|
||||
return '시작 후 3개월이 지나야 경매를 열 수 있습니다.';
|
||||
}
|
||||
|
||||
$auctionResult = AuctionBuyRice::openResourceAuction(
|
||||
$general,
|
||||
$amount,
|
||||
|
||||
@@ -5,9 +5,12 @@ namespace sammo\API\Auction;
|
||||
use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use sammo\AuctionSellRice;
|
||||
use sammo\DB;
|
||||
use sammo\Validator;
|
||||
use sammo\GameConst;
|
||||
use sammo\General;
|
||||
use sammo\KVStorage;
|
||||
use sammo\Util;
|
||||
|
||||
class OpenSellRiceAuction extends \sammo\BaseAPI
|
||||
{
|
||||
@@ -64,6 +67,16 @@ class OpenSellRiceAuction extends \sammo\BaseAPI
|
||||
|
||||
$general = General::createGeneralObjFromDB($generalID);
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
[$initYear, $initMonth, $year, $month] = $gameStor->getValuesAsArray(['init_year', 'init_month', 'year', 'month']);
|
||||
$initYearMonth = Util::joinYearMonth($initYear, $initMonth);
|
||||
$yearMonth = Util::joinYearMonth($year, $month);
|
||||
|
||||
if($yearMonth <= $initYearMonth + 3){
|
||||
return '시작 후 3개월이 지나야 경매를 열 수 있습니다.';
|
||||
}
|
||||
|
||||
$auctionResult = AuctionSellRice::openResourceAuction(
|
||||
$general,
|
||||
$amount,
|
||||
|
||||
@@ -5,9 +5,12 @@ namespace sammo\API\Auction;
|
||||
use sammo\Session;
|
||||
use DateTimeInterface;
|
||||
use sammo\AuctionUniqueItem;
|
||||
use sammo\DB;
|
||||
use sammo\Validator;
|
||||
use sammo\GameConst;
|
||||
use sammo\General;
|
||||
use sammo\KVStorage;
|
||||
use sammo\Util;
|
||||
|
||||
use function sammo\buildItemClass;
|
||||
|
||||
@@ -55,6 +58,16 @@ class OpenUniqueAuction extends \sammo\BaseAPI
|
||||
$itemObj = buildItemClass($itemID);
|
||||
$general = General::createGeneralObjFromDB($generalID);
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
[$initYear, $initMonth, $year, $month] = $gameStor->getValuesAsArray(['init_year', 'init_month', 'year', 'month']);
|
||||
$initYearMonth = Util::joinYearMonth($initYear, $initMonth);
|
||||
$yearMonth = Util::joinYearMonth($year, $month);
|
||||
|
||||
if($yearMonth <= $initYearMonth + 3){
|
||||
return '시작 후 3개월이 지나야 경매를 열 수 있습니다.';
|
||||
}
|
||||
|
||||
$auctionResult = AuctionUniqueItem::openItemAuction($itemObj, $general, $amount);
|
||||
|
||||
if(is_string($auctionResult)) {
|
||||
|
||||
@@ -62,23 +62,6 @@ class DropItem extends \sammo\BaseAPI
|
||||
if (!$item->isBuyable()) {
|
||||
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 잃었습니다!");
|
||||
$logger->pushGlobalHistoryLog("<R><b>【망실】</b></><D><b>{$nationName}</b></>의 <Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 잃었습니다!");
|
||||
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$givenUnique = $gameStor->getValue('givenUnique') ?? [];
|
||||
$itemCode = $item->getRawClassName();
|
||||
if (key_exists($itemCode, $givenUnique)) {
|
||||
$givenUniqueCnt = $givenUnique[$itemCode];
|
||||
$givenUniqueCnt -= 1;
|
||||
if ($givenUniqueCnt <= 0) {
|
||||
unset($givenUnique[$itemCode]);
|
||||
} else {
|
||||
$givenUnique[$itemCode] = $givenUniqueCnt;
|
||||
}
|
||||
} else {
|
||||
//XXX: 처리하지 못한 코드가 있는가?
|
||||
//FIXME: 여기에서 무언가 경고를 내야함
|
||||
}
|
||||
$gameStor->setValue('givenUnique', $givenUnique);
|
||||
}
|
||||
|
||||
$me->applyDB($db);
|
||||
|
||||
Reference in New Issue
Block a user