Merge pull request 'Deploy to statging' (#102) from main into staging
Reviewed-on: #102
This commit is contained in:
commit
8f3b95dc11
|
|
@ -250,18 +250,26 @@ export class GraysProductBid extends ProductBid {
|
|||
.$eval(".dls-heading-3.lotPageTitle", (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);
|
||||
const current_price = await page
|
||||
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}`];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue