can read ini file
This commit is contained in:
+11
-2
@@ -2,6 +2,7 @@ const {_android: android} = require('playwright');
|
||||
const ExcelUtil = require("./excel/ExcelUtil");
|
||||
const CommandorPage = require("./workers/CommandorPage");
|
||||
const {MongoManager, formatDate} = require("./workers/mongo_manager");
|
||||
const alert = require('alert');
|
||||
|
||||
const mongoManager = new MongoManager();
|
||||
|
||||
@@ -57,18 +58,26 @@ async function startWithList(contacts, device, selectedStore) {
|
||||
}, Promise.resolve());
|
||||
}
|
||||
|
||||
async function startBookWithNumbers(startNumber, endNumber, selectedStore) {
|
||||
let allContactList = excelUtil.readContacts();
|
||||
async function startBookWithNumbers(startNumber, endNumber, selectedStore, pathToExcelFile = '/Users/lpan/Desktop/contact_all.xlsx') {
|
||||
let allContactList = excelUtil.readContacts(pathToExcelFile);
|
||||
let contactList;
|
||||
if (endNumber <= allContactList.length) {
|
||||
contactList = allContactList.slice(startNumber, endNumber);
|
||||
} else {
|
||||
contactList = allContactList;
|
||||
}
|
||||
if (contactList.length === 0) {
|
||||
alert("联系人数为0")
|
||||
return
|
||||
}
|
||||
mongoManager.connect().then(r => {
|
||||
filterAlreadyBookedContacts(contactList).then(listToBook => {
|
||||
console.log("number of contacts to book:" + listToBook.length)
|
||||
android.devices().then((devices) => {
|
||||
if (devices.length === 0) {
|
||||
alert("未找到连接的设备");
|
||||
return
|
||||
}
|
||||
let segmentNumber = listToBook.length / devices.length;
|
||||
for (let i = 0; i < devices.length; i++) {
|
||||
startWithList(listToBook.slice(i * segmentNumber, segmentNumber * (i + 1)), devices[i], selectedStore);
|
||||
|
||||
Reference in New Issue
Block a user