diff --git a/hwe/sammo/API/Auction/GetUniqueItemAuctionDetail.php b/hwe/sammo/API/Auction/GetUniqueItemAuctionDetail.php index 2051ec30..297791fb 100644 --- a/hwe/sammo/API/Auction/GetUniqueItemAuctionDetail.php +++ b/hwe/sammo/API/Auction/GetUniqueItemAuctionDetail.php @@ -9,8 +9,11 @@ use sammo\DB; use sammo\DTO\AuctionBidItem; use sammo\DTO\AuctionInfo; use sammo\Enums\AuctionType; +use sammo\Enums\InheritanceKey; +use sammo\InheritancePointManager; use sammo\TimeUtil; use sammo\Validator; +use sammo\General; class GetUniqueItemAuctionDetail extends \sammo\BaseAPI { @@ -69,6 +72,13 @@ class GetUniqueItemAuctionDetail extends \sammo\BaseAPI ]; } + $inheritMgr = InheritancePointManager::getInstance(); + //preveious라서 column을 최대한 비울 수 있다. + $remainPoint = $inheritMgr->getInheritancePoint( + General::createGeneralObjFromDB($generalID, ['owner'], 0), + InheritanceKey::previous + ); + $obfuscatedName = AuctionUniqueItem::genObfuscatedName($generalID); return [ @@ -86,6 +96,7 @@ class GetUniqueItemAuctionDetail extends \sammo\BaseAPI ], 'bidList' => $responseBid, 'obfuscatedName' => $obfuscatedName, + 'remainPoint' => $remainPoint, ]; } } diff --git a/hwe/ts/PageAuction.vue b/hwe/ts/PageAuction.vue index a0414015..75a65447 100644 --- a/hwe/ts/PageAuction.vue +++ b/hwe/ts/PageAuction.vue @@ -22,7 +22,7 @@ import TopBackBar from "@/components/TopBackBar.vue"; import BottomBar from "./components/BottomBar.vue"; import AuctionResource from "@/components/AuctionResource.vue"; import AuctionUniqueItem from "@/components/AuctionUniqueItem.vue"; -import { ref, toRef } from "vue"; +import { ref } from "vue"; const props = defineProps({ isResAuction: { @@ -34,7 +34,7 @@ const props = defineProps({ const auctionResource = ref | null>(null); const auctionUniqueItem = ref | null>(null); -const isResAuction = toRef(props, "isResAuction"); +const isResAuction = ref(props.isResAuction); async function tryReload() { console.log(auctionResource.value); diff --git a/hwe/ts/components/AuctionUniqueItem.vue b/hwe/ts/components/AuctionUniqueItem.vue index 988f3ce4..65abd107 100644 --- a/hwe/ts/components/AuctionUniqueItem.vue +++ b/hwe/ts/components/AuctionUniqueItem.vue @@ -1,61 +1,121 @@ @@ -95,19 +155,35 @@ async function refreshDetail() { watch(currentAuctionID, () => { void refreshDetail(); }); -const auctionList = ref(new Map()); +const ongoingAuctionList = ref(new Map()); +const finishedAuctionList = ref(new Map()); const obfuscatedName = ref(""); const toasts = unwrap(useToast()); +function cutDateTime(dateTime: string, showSecond = false) { + if (showSecond) { + return dateTime.substring(5, 19); + } + return dateTime.substring(5, 16); +} + async function refreshList() { try { const result = await SammoAPI.Auction.GetUniqueItemAuctionList(); obfuscatedName.value = result.obfuscatedName; - auctionList.value = new Map(result.list.map((auction) => [auction.id, auction])); - if (currentAuctionID.value === undefined && result.list.length > 0) { - currentAuctionID.value = result.list[0].id; - bidAmount.value = result.list[0].highestBid.amount; + finishedAuctionList.value = new Map( + result.list.filter((auction) => auction.finished).map((auction) => [auction.id, auction]) + ); + ongoingAuctionList.value = new Map( + result.list.filter((auction) => !auction.finished).map((auction) => [auction.id, auction]) + ); + if (currentAuctionID.value === undefined && ongoingAuctionList.value.size > 0) { + const auctionIterator = ongoingAuctionList.value.values().next(); + if (!auctionIterator.done) { + currentAuctionID.value = auctionIterator.value.id; + bidAmount.value = auctionIterator.value.highestBid.amount; + } } } catch (e) { console.error(e); @@ -148,19 +224,31 @@ async function bidAuction() { } } -async function refresh(){ - const waiters = [ - refreshList(), - refreshDetail(), - ]; +async function refresh() { + const waiters = [refreshList(), refreshDetail()]; await Promise.all(waiters); } defineExpose({ - refresh -}) + refresh, +}); onMounted(() => { void refreshList(); }); + + diff --git a/hwe/ts/components/NumberInputWithInfo.vue b/hwe/ts/components/NumberInputWithInfo.vue index 6207bed5..82d6b45a 100644 --- a/hwe/ts/components/NumberInputWithInfo.vue +++ b/hwe/ts/components/NumberInputWithInfo.vue @@ -1,7 +1,7 @@