need to remove duplicated emails
This commit is contained in:
+6
-18
@@ -50,7 +50,7 @@ def timeout_occurred(serial_modem: SerialModem):
|
||||
def start_to_handle_sms(serial_modem: SerialModem):
|
||||
global current_gsm_modem
|
||||
current_gsm_modem = serial_modem.modem
|
||||
current_gsm_modem.deleteMultipleStoredSms(memory="SM")
|
||||
# current_gsm_modem.deleteMultipleStoredSms(memory="MT")
|
||||
serial_modem.modem.smsReceivedCallback = handle_sms
|
||||
global is_finished
|
||||
is_finished = False
|
||||
@@ -85,26 +85,10 @@ def init_modems() -> list:
|
||||
modems.append(serial_modem)
|
||||
return modems
|
||||
|
||||
|
||||
def on_message_received(ch, method, properties, body):
|
||||
print(str(body))
|
||||
print(" [x] Received {} {}".format(body, datetime.datetime.now()))
|
||||
# parse the received message
|
||||
result = ReserveResultPojo.from_json(body)
|
||||
result.sim_position = current_sim_position
|
||||
result.slot_position = current_card_pool_slot
|
||||
logger.info(result)
|
||||
firebase_store_manager.save(result)
|
||||
oracle_log_sender.send_appoint_result(result)
|
||||
# set the flag to True
|
||||
global is_finished
|
||||
is_finished = True
|
||||
|
||||
|
||||
def start_book():
|
||||
slot_number = 1
|
||||
slot_sum = 2
|
||||
for i in reversed(range(slot_number, slot_sum + 1)):
|
||||
for i in range(slot_number, slot_sum + 1):
|
||||
card_pool.reset()
|
||||
logger.info("will switch to " + str(i))
|
||||
card_pool.switch_to_slot(i)
|
||||
@@ -122,6 +106,10 @@ def start_book():
|
||||
try:
|
||||
# get contact for current modem
|
||||
modem.get_ccid()
|
||||
contact = [contact for contact in contacts if contact.ccid.replace("F","") == modem.ccid.replace("F","")]
|
||||
if len(contact) > 0:
|
||||
modem.phone_number = contact[0].phone
|
||||
modem.contact = contact[0]
|
||||
start_to_handle_sms(modem)
|
||||
except Exception as error:
|
||||
print(error)
|
||||
|
||||
Reference in New Issue
Block a user