add operator to siminfo

This commit is contained in:
2022-03-25 09:16:27 +01:00
parent 3c4f6ec88b
commit 99dd077bb2
3 changed files with 13 additions and 7 deletions
+4 -2
View File
@@ -64,7 +64,8 @@ class ModemPool:
contact.ccid.replace("F", "") == ccid.replace("F", "")] contact.ccid.replace("F", "") == ccid.replace("F", "")]
if len(contact) > 0: if len(contact) > 0:
phone_number = contact[0].phone phone_number = contact[0].phone
self._db_manager.save_sim_info(SimInfoPojo(phone=str(phone_number), ccid=ccid, position=position)) self._db_manager.save_sim_info(
SimInfoPojo(phone=str(phone_number), ccid=ccid, position=position, operator=operator.value))
else: else:
error_msg = "slot({}),sim({})".format(slot_position, sim_position) error_msg = "slot({}),sim({})".format(slot_position, sim_position)
oracle_log_sender.send_contact_not_found(error_msg) oracle_log_sender.send_contact_not_found(error_msg)
@@ -89,7 +90,8 @@ class ModemPool:
print("phone is " + phone_number) print("phone is " + phone_number)
if phone_number: if phone_number:
self._db_manager.save_sim_info(SimInfoPojo(phone=phone_number, ccid=ccid, position=position)) self._db_manager.save_sim_info(
SimInfoPojo(phone=phone_number, ccid=ccid, position=position, operator=operator.value))
self._log_sender.send_log(phone_number, source=self.TAG, subject=SUBJECT_SIM_INFO, self._log_sender.send_log(phone_number, source=self.TAG, subject=SUBJECT_SIM_INFO,
type=LOG_APPOINTMENT_SUCCESS) type=LOG_APPOINTMENT_SUCCESS)
# write the number to sim card's phonebook # write the number to sim card's phonebook
+8 -3
View File
@@ -1,4 +1,3 @@
import datetime
import time import time
@@ -7,12 +6,14 @@ class SimInfoPojo:
ccid: str ccid: str
update_at: int update_at: int
position: int position: int
operator: str
def __init__(self, phone: str, ccid: str, position, update_at: int = int(time.time())): def __init__(self, phone: str, ccid: str, position, operator: str, update_at: int = int(time.time())):
self.phone = phone self.phone = phone
self.ccid = ccid self.ccid = ccid
self.update_at = update_at self.update_at = update_at
self.position = position self.position = position
self.operator = operator
@staticmethod @staticmethod
def from_firestore_dict(source): def from_firestore_dict(source):
@@ -24,7 +25,10 @@ class SimInfoPojo:
position = None position = None
if 'position' in source: if 'position' in source:
position = source['position'] position = source['position']
result = SimInfoPojo(phone=phone, ccid=ccid, update_at=update_at, position=position) result = SimInfoPojo(phone=phone, ccid=ccid, update_at=update_at, position=position, operator="")
if 'operator' in source:
operator = source['operator']
result.operator = operator
result.id = id result.id = id
return result return result
@@ -34,6 +38,7 @@ class SimInfoPojo:
u'ccid': self.ccid, u'ccid': self.ccid,
u'update_at': self.update_at, u'update_at': self.update_at,
u'position': self.position, u'position': self.position,
u'operator': self.operator,
} }
return dest return dest
+1 -2
View File
@@ -6,13 +6,12 @@ from modems.ModemPool import ModemPool
from logs.AppLogging import init_logger from logs.AppLogging import init_logger
from logs.LogSender import LOG_SUBJECT_EVENT, TYPE_EVENT_RESET_ALL_SIM_CARDS from logs.LogSender import LOG_SUBJECT_EVENT, TYPE_EVENT_RESET_ALL_SIM_CARDS
from main import card_pool, get_devices_ports from main import card_pool, get_devices_ports
from wait_for_sms import start_waiting_sms
def read_all_the_phone_number(): def read_all_the_phone_number():
params.oracle_log_sender.send_log(msg="SIM卡自检开始", subject=LOG_SUBJECT_EVENT, type=TYPE_EVENT_RESET_ALL_SIM_CARDS) params.oracle_log_sender.send_log(msg="SIM卡自检开始", subject=LOG_SUBJECT_EVENT, type=TYPE_EVENT_RESET_ALL_SIM_CARDS)
slot_number = 1 slot_number = 1
slot_sum = 27 slot_sum = 26
params.firebase_store_manager.clear_all_sim_info() params.firebase_store_manager.clear_all_sim_info()
for i in range(slot_number, slot_sum + 1): for i in range(slot_number, slot_sum + 1):
card_pool.reset() card_pool.reset()