Deploy to statging #102

Merged
zelda merged 1 commits from main into staging 2025-12-06 12:00:07 +11:00
2 changed files with 36 additions and 12 deletions

View File

@ -250,18 +250,26 @@ export class GraysProductBid extends ProductBid {
.$eval(".dls-heading-3.lotPageTitle", (el) => el.innerText)
.catch(() => null);
await page
.waitForSelector(
"#biddableLot > form > div > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div > span > span",
{ timeout: 5000 }
)
.catch(() => null);
const current_price = await page
.$eval(
"#biddableLot > form > div > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div > span > span",
(el) => el.innerText
)
.catch(() => null);
let current_price = null;
const apiCurrentPrice = await this.getCurrentPrice();
if (!apiCurrentPrice) {
await page
.waitForSelector(
"#biddableLot > form > div > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div > span > span",
{ timeout: 5000 }
)
.catch(() => null);
current_price = await page
.$eval(
"#biddableLot > form > div > div:nth-child(1) > div:nth-child(1) > div:nth-child(2) > div > span > span",
(el) => el.innerText
)
.catch(() => null);
} else {
current_price = apiCurrentPrice;
}
console.log(
`📌 [${this.id}] Product Info: Lot ID: ${lot_id}, Name: ${name}, Current Price: ${current_price}, Reserve price: ${price_value}`
@ -278,6 +286,8 @@ export class GraysProductBid extends ProductBid {
["close_time"]
);
console.log(data);
this.handleUpdateBid(data);
return { price_value, lot_id, name, current_price };
@ -497,6 +507,18 @@ export class GraysProductBid extends ProductBid {
return data;
}
async getCurrentPrice() {
const data = await this.getCurrentHistories();
if (!data || data?.length <= 0) return null;
const first = data[0];
if (!first) return null;
return first?.Price || null;
}
getBidedData() {
return global[`BIDED_DATA_${this.web_bid?.origin_url}`];
}

View File

@ -126,6 +126,8 @@ export function isTimeReached(targetTime) {
}
export function extractNumber(str) {
if (typeof str === "number") return str;
const match = str.match(/\d+(\.\d+)?/);
return match ? parseFloat(match[0]) : null;
}