diff --git a/src/excel/ExcelUtil.js b/src/excel/ExcelUtil.js index 44ce9a2..f01ae93 100644 --- a/src/excel/ExcelUtil.js +++ b/src/excel/ExcelUtil.js @@ -19,7 +19,11 @@ class ExcelUtil { if (store === undefined || store.length === 0) { store = "random" } - let newContact = new ContactPojo(phoneNumber, passportNumber, lastName, firstName, mail, store); + let ipCountry = info[5]; + if (ipCountry === undefined || ipCountry.length === 0) { + ipCountry = "FR" + } + let newContact = new ContactPojo(phoneNumber, passportNumber, lastName, firstName, mail, store, ipCountry); contactList.push(newContact); } } diff --git a/src/models/ContactPojo.js b/src/models/ContactPojo.js index ef083cd..6088605 100644 --- a/src/models/ContactPojo.js +++ b/src/models/ContactPojo.js @@ -1,15 +1,14 @@ class ContactPojo { - constructor(phoneNumber, passportNumber, lastName, firstName, mail, store) { + constructor(phoneNumber, passportNumber, lastName, firstName, mail, store, ipCountry) { this.phoneNumber = phoneNumber; this.passportNumber = passportNumber; this.lastName = lastName; this.firstName = firstName; this.mail = mail; this.store = store; + this.ipCountry = ipCountry; } - - } module.exports = ContactPojo \ No newline at end of file diff --git a/src/queue/Sender.js b/src/queue/Sender.js index 0854bfa..3cccd6e 100644 --- a/src/queue/Sender.js +++ b/src/queue/Sender.js @@ -1,7 +1,8 @@ const amqp = require("amqplib"); const QUEUE_HOST = "amqp://appointment:ZyuhJZ2xEYWhElhpJjy7YEpZGZwNYJz2fHIu@appointment.lpaconsulting.fr:5672" -const REQUEST_DATA_QUEUE = 'REQUEST_DATA'; +const REQUEST_DATA_QUEUE_FR = 'REQUEST_DATA'; +const REQUEST_DATA_QUEUE_DE = 'REQUEST_DATA_DE'; class Sender { channel; @@ -10,11 +11,11 @@ class Sender { async initConnection() { this.connection = await amqp.connect(QUEUE_HOST); this.channel = await this.connection.createChannel(); - await this.channel.assertQueue(REQUEST_DATA_QUEUE, {persistent: true}); + await this.channel.assertQueue(REQUEST_DATA_QUEUE_FR, {persistent: true}); } - sendMessage(msg) { - this.channel.sendToQueue(REQUEST_DATA_QUEUE, Buffer.from(msg)) + sendMessage(msg, queue_name = REQUEST_DATA_QUEUE_FR) { + this.channel.sendToQueue(queue_name, Buffer.from(msg)) } } diff --git a/src/workers/CommandorPage.js b/src/workers/CommandorPage.js index e64919a..e13ed21 100644 --- a/src/workers/CommandorPage.js +++ b/src/workers/CommandorPage.js @@ -891,7 +891,11 @@ class CommandorPage { cookiesString = cookiesString + cookie.name + "=" + cookie.value + ";" }) console.log(cookiesString); - this.sender.sendMessage(cookiesString) + + if (this.contact.ipCountry === "DE") + this.sender.sendMessage(cookiesString, "REQUEST_DATA_DE") + else + this.sender.sendMessage(cookiesString) // let content = await this.page.content() // console.log(content) await this.page.bringToFront(); @@ -1228,21 +1232,21 @@ class CommandorPage { async enableDisableAirPlanMode() { logWithDevice("will enable/disable airplane mode", this.device) - try { - // await this.device.shell("cmd connectivity airplane-mode enable") - await exceutShellCmd(this.device, "cmd connectivity airplane-mode enable") - await delay(1000) - await exceutShellCmd(this.device, "cmd connectivity airplane-mode disable") - // await this.device.shell("cmd connectivity airplane-mode disable") - await delay(2000) - } catch (e) { - try { - await this.device.shell("cmd connectivity airplane-mode disable") - } catch (e) { - console.log(e) - } - console.log(e) - } + // try { + // // await this.device.shell("cmd connectivity airplane-mode enable") + // await exceutShellCmd(this.device, "cmd connectivity airplane-mode enable") + // await delay(1000) + // await exceutShellCmd(this.device, "cmd connectivity airplane-mode disable") + // // await this.device.shell("cmd connectivity airplane-mode disable") + // await delay(2000) + // } catch (e) { + // try { + // await this.device.shell("cmd connectivity airplane-mode disable") + // } catch (e) { + // console.log(e) + // } + // console.log(e) + // } } async tapGoogleDisconnectBtn() {