update condition place bid langtons

This commit is contained in:
nkhangg 2025-04-12 08:25:00 +07:00
parent bfcfb7bbb9
commit bd55531c46
4 changed files with 22 additions and 9 deletions

View File

@ -24,6 +24,11 @@ export default function Bids() {
const [openedBid, bidModal] = useDisclosure(false);
const columns: IColumn<IBid>[] = [
{
key: 'id',
title: 'ID',
typeFilter: 'number',
},
{
key: 'name',
title: 'Name',

View File

@ -1 +1 @@
{"createdAt":1744361020595}
{"createdAt":1744420823691}

View File

@ -35,6 +35,8 @@ export class ImapService {
tls: true,
tlsOptions: { rejectUnauthorized: false },
});
console.log(this.configService.get<string>('MAIL_USER'));
}
async connectIMAP() {

View File

@ -4,7 +4,7 @@ import { sendMessage } from '../../system/apis/notification.js';
import { createOutBidLog } from '../../system/apis/out-bid-log.js';
import configs from '../../system/config.js';
import CONSTANTS from '../../system/constants.js';
import { convertAETtoUTC, removeFalsyValues, takeSnapshot } from '../../system/utils.js';
import { convertAETtoUTC, isTimeReached, removeFalsyValues, takeSnapshot } from '../../system/utils.js';
import { ProductBid } from '../product-bid.js';
export class LangtonsProductBid extends ProductBid {
@ -24,9 +24,9 @@ export class LangtonsProductBid extends ProductBid {
return el ? el.innerText : null;
});
return time ? convertAETtoUTC(time) : null;
// return time ? convertAETtoUTC(time) : null;
// return new Date(Date.now() + 2 * 60 * 1000).toUTCString();
return new Date(Date.now() + 6 * 60 * 1000).toUTCString();
} catch (error) {
// Nếu có lỗi xảy ra trong quá trình lấy thời gian, trả về null
return null;
@ -121,12 +121,12 @@ export class LangtonsProductBid extends ProductBid {
lot_id: result?.lotId || null,
reserve_price: result.lotData?.minimumBid || null,
current_price: result.lotData?.currentMaxBid || null,
// close_time: close_time && !this.close_time ? String(close_time) : null,
close_time: close_time ? String(close_time) : null,
close_time: close_time && !this.close_time ? String(close_time) : null,
// close_time: close_time ? String(close_time) : null,
name,
},
// [],
['close_time'],
[],
// ['close_time'],
);
console.log(`🚀 [${this.id}] Processed data ready for update`);
@ -184,6 +184,12 @@ export class LangtonsProductBid extends ProductBid {
return; // Dừng hàm nếu giá đã vượt qua giới hạn
}
// Kiểm tra thời gian bid
if (this.start_bid_time && !isTimeReached(this.start_bid_time)) {
console.log(`⏳ [${this.id}] Not yet time to bid. Skipping Product: ${this.name || 'None'}`);
return;
}
// Đợi phản hồi từ API
const response = await this.waitForApiResponse();
@ -357,7 +363,7 @@ export class LangtonsProductBid extends ProductBid {
}
}
if (lotData.myBid && this.max_price != lotData.myBid) {
if (lotData.myBid && this.max_price && this.max_price != lotData.myBid) {
this.handlePlaceBid();
}
} catch (error) {