can handle blacklist
This commit is contained in:
+10
-8
@@ -35,12 +35,14 @@ async function needToBook(contact, mongoManager) {
|
|||||||
)
|
)
|
||||||
if (needToBook) {
|
if (needToBook) {
|
||||||
await blackListItems.forEach((blackListItem) => {
|
await blackListItems.forEach((blackListItem) => {
|
||||||
console.log("=====handle blacklist item====")
|
if (blackListItem.mail === contact.mail) {
|
||||||
console.log("update_at_s is " + blackListItem.update_at_in_s)
|
console.log("=====handle blacklist item====")
|
||||||
console.log("email is " + blackListItem.mail)
|
console.log("update_at_s is " + blackListItem.update_at_in_s)
|
||||||
needToBook = blackListItem.update_at_in_s <= (new Date()) + SEVEN_DAYS_IN_S;
|
console.log("email is " + blackListItem.mail)
|
||||||
if (!needToBook) {
|
needToBook = blackListItem.update_at_in_s + SEVEN_DAYS_IN_S <= (new Date()) / 1000;
|
||||||
console.log("skip")
|
if (!needToBook) {
|
||||||
|
console.log("skip")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -48,8 +50,8 @@ async function needToBook(contact, mongoManager) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function startBook(contactPojo, device, selectedStore, audioAnalyse, alertBeep) {
|
async function startBook(contactPojo, device, selectedStore, audioAnalyse, alertBeep) {
|
||||||
console.log(`型号: ${device.model()}`);
|
console.log(`model: ${device.model()}`);
|
||||||
console.log(`序列号: ${device.serial()}`);
|
console.log(`serial: ${device.serial()}`);
|
||||||
if (await needToBook(contactPojo, mongoManager)) {
|
if (await needToBook(contactPojo, mongoManager)) {
|
||||||
let commandor = new CommandorPage(contactPojo, device, mongoManager, selectedStore, audioAnalyse, alertBeep);
|
let commandor = new CommandorPage(contactPojo, device, mongoManager, selectedStore, audioAnalyse, alertBeep);
|
||||||
//read contacts form excel
|
//read contacts form excel
|
||||||
|
|||||||
@@ -102,14 +102,14 @@ class GeoCaptchaSolver {
|
|||||||
if (result) {
|
if (result) {
|
||||||
let audioUrl = result[0];
|
let audioUrl = result[0];
|
||||||
let fileName = crypto.randomUUID() + ".wav";
|
let fileName = crypto.randomUUID() + ".wav";
|
||||||
wget({url: audioUrl, dest: dest_dir + fileName}, function (error, response, body) {
|
wget({url: audioUrl, dest: dest_dir + fileName}, async function (error, response, body) {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log('--- error:');
|
console.log('--- error:');
|
||||||
console.log(error); // error encountered
|
console.log(error); // error encountered
|
||||||
} else {
|
} else {
|
||||||
console.log('download the file successfully');
|
console.log('download the file successfully');
|
||||||
// send request to get numbers
|
// send request to get numbers
|
||||||
sendRequest(dest_dir + fileName, callback);
|
await sendRequest(dest_dir + fileName, callback);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user