update contact list

This commit is contained in:
2022-03-24 09:57:36 +01:00
parent 2c3d66334e
commit 25207bb062
6 changed files with 22 additions and 5 deletions
BIN
View File
Binary file not shown.
-2
View File
@@ -38,8 +38,6 @@ def write_the_valid_profiles_to_excel():
mail=reserve_pojo.email, position=0) mail=reserve_pojo.email, position=0)
seed = 8 # number of characters in the string. seed = 8 # number of characters in the string.
# call random.choices() string module to find the string in Uppercase + numeric data. # call random.choices() string module to find the string in Uppercase + numeric data.
ran = ''.join(random.choices(string.digits, k=seed))
contact.mail = "{}_{}{}@163.com".format(contact.first_name, contact.last_name, ran)
# contact.passport = get_random_id_number() # contact.passport = get_random_id_number()
# if contact.passport == None or len(contact.passport) == 0: # if contact.passport == None or len(contact.passport) == 0:
# old_contact = [item for item in exist_contacts if item.mail == contact.mail] # old_contact = [item for item in exist_contacts if item.mail == contact.mail]
+4 -1
View File
@@ -18,6 +18,7 @@ from pojo.ReserveResultPojo import ReserveResultPojo
from pojo.serial_modem import SerialModem from pojo.serial_modem import SerialModem
from utils.excel_reader import ExcelHelper from utils.excel_reader import ExcelHelper
from utils.message_receiver import MessageReceiver from utils.message_receiver import MessageReceiver
from utils.operator import check_operator, Operator
OTP_TIMEOUT = 180 OTP_TIMEOUT = 180
is_finished = False is_finished = False
@@ -68,7 +69,9 @@ def timeout_occurred(serial_modem: SerialModem):
def start_to_handle_sms(serial_modem: SerialModem): def start_to_handle_sms(serial_modem: SerialModem):
global current_gsm_modem global current_gsm_modem
current_gsm_modem = serial_modem.modem current_gsm_modem = serial_modem.modem
# current_gsm_modem.deleteMultipleStoredSms(memory="SM") if check_operator(serial_modem.ccid) == Operator.LYCAMOBILE:
# lycamobile
current_gsm_modem.deleteMultipleStoredSms(memory="SM")
serial_modem.modem.smsReceivedCallback = handle_sms serial_modem.modem.smsReceivedCallback = handle_sms
global is_finished global is_finished
is_finished = False is_finished = False
+15
View File
@@ -0,0 +1,15 @@
from enum import Enum
class Operator(Enum):
SFR = "SFR"
LYCAMOBILE = "LYCAMOBILE"
CHINA_TELECOM = "CHINA_TELECOM"
def check_operator(ccid: str) -> Operator:
if "893313" in ccid:
return Operator.LYCAMOBILE
elif "893310" in ccid:
return Operator.SFR
return Operator.CHINA_TELECOM
View File
+3 -2
View File
@@ -13,6 +13,7 @@ from modems.card_pool import CardPool
from params import MODEM_POOL_PORTS, CARD_POOL_PORT from params import MODEM_POOL_PORTS, CARD_POOL_PORT
from pojo.serial_modem import SerialModem from pojo.serial_modem import SerialModem
from utils.excel_reader import ExcelHelper from utils.excel_reader import ExcelHelper
from utils.operator import check_operator, Operator
OTP_TIMEOUT = 40 OTP_TIMEOUT = 40
commandor = CommandorPage() commandor = CommandorPage()
@@ -48,7 +49,7 @@ def timeout_occurred(serial_modem: SerialModem):
def start_to_handle_sms(serial_modem: SerialModem): def start_to_handle_sms(serial_modem: SerialModem):
global current_gsm_modem global current_gsm_modem
current_gsm_modem = serial_modem.modem current_gsm_modem = serial_modem.modem
if "893313" in serial_modem.ccid: if check_operator(serial_modem.ccid) == Operator.LYCAMOBILE:
# lycamobile # lycamobile
current_gsm_modem.deleteMultipleStoredSms(memory="SM") current_gsm_modem.deleteMultipleStoredSms(memory="SM")
serial_modem.modem.smsReceivedCallback = handle_sms serial_modem.modem.smsReceivedCallback = handle_sms
@@ -94,7 +95,7 @@ def start_book():
modem_pool.reset_all_modems() modem_pool.reset_all_modems()
modem_list = init_modems() modem_list = init_modems()
# create listeners for chaque modem # create listeners for chaque modem
# read the contact, and contact the 2 objects together # read the contact, and merge the 2 objects together
excel_reader = ExcelHelper() excel_reader = ExcelHelper()
contacts = excel_reader.read_contacts() contacts = excel_reader.read_contacts()
global current_sim_position global current_sim_position