set default serial to bitbrowser

This commit is contained in:
2025-03-12 20:17:52 +01:00
parent 7de7469422
commit 89a37295c0
4 changed files with 35 additions and 20 deletions
+8 -2
View File
@@ -327,7 +327,8 @@ class MongoDbManager:
return result_list return result_list
def save_links_to_validate(self, link: str, mail_address: str, _all_contact_list: list, def save_links_to_validate(self, link: str, mail_address: str, _all_contact_list: list,
_item: Union[ReserveResultPojo, None], contact_serial_map_list): _item: Union[ReserveResultPojo, None], contact_serial_map_list,
default_serial="bitbrowser"):
collection_to_use = self.db[LINKS_TO_VALIDATE] collection_to_use = self.db[LINKS_TO_VALIDATE]
updated_at = time.strftime("%H:%M:%S", time.localtime()) updated_at = time.strftime("%H:%M:%S", time.localtime())
_ip_country = "FR" _ip_country = "FR"
@@ -339,7 +340,10 @@ class MongoDbManager:
if len(serial) == 0: if len(serial) == 0:
for contact in contact_serial_map_list: for contact in contact_serial_map_list:
if contact.mail == mail_address: if contact.mail == mail_address:
serial = contact.serial if contact.serial is not None and len(contact.serial) > 0:
serial = contact.serial
else:
serial = default_serial
_model = contact.model _model = contact.model
break break
@@ -347,6 +351,8 @@ class MongoDbManager:
for _contact in _all_contact_list: for _contact in _all_contact_list:
if _contact.mail == mail_address: if _contact.mail == mail_address:
_ip_country = _contact.ip_country _ip_country = _contact.ip_country
if len(serial) == 0:
serial = default_serial
if len(mail_address) > 0: if len(mail_address) > 0:
collection_to_use.replace_one(filter={'_id': mail_address, }, replacement={ collection_to_use.replace_one(filter={'_id': mail_address, }, replacement={
+3 -6
View File
@@ -10,11 +10,9 @@ from src.pojo.ReserveResultPojo import ReserveResultPojo
@dataclass @dataclass
class AcceptedResultPojo: class AcceptedResultPojo:
def __init__(self, msg: str, slot_position, sim_position, passport, email, name, phone, ccid: str, url, def __init__(self, msg: str, passport, email, name, phone, ccid: str, url,
created_at: str, validated_at: str): created_at: str, validated_at: str):
self.message = msg self.message = msg
self.slot_position = slot_position
self.sim_position = sim_position
self.passport = "{}".format(passport) self.passport = "{}".format(passport)
self.email = email self.email = email
self.name = name self.name = name
@@ -39,13 +37,12 @@ def get_accepted_result_from(reserve_pojo: ReserveResultPojo, mongo_db_manager:
if reserve_pojo is None: if reserve_pojo is None:
# send email even there are no reserve info # send email even there are no reserve info
return AcceptedResultPojo("", slot_position=0, sim_position=0, return AcceptedResultPojo("",
passport="", email="", phone="", passport="", email="", phone="",
name="", ccid="", name="", ccid="",
url="", created_at="", validated_at="") url="", created_at="", validated_at="")
else: else:
toReturn = AcceptedResultPojo(reserve_pojo.message, slot_position=reserve_pojo.slot_position, toReturn = AcceptedResultPojo(reserve_pojo.message,
sim_position=reserve_pojo.sim_position,
passport=reserve_pojo.passport, email=reserve_pojo.mail, phone=reserve_pojo.phone, passport=reserve_pojo.passport, email=reserve_pojo.mail, phone=reserve_pojo.phone,
name="{} {}".format(reserve_pojo.last_name, reserve_pojo.first_name), name="{} {}".format(reserve_pojo.last_name, reserve_pojo.first_name),
ccid=reserve_pojo.ccid, ccid=reserve_pojo.ccid,
+8 -8
View File
@@ -1,18 +1,18 @@
from mrz.generator.td1 import TD1CodeGenerator from mrz.generator.td1 import TD1CodeGenerator
first_name = "Lei" first_name = "mingchai"
last_name = "PAN" last_name = "ao"
document_number = "HP3E1P59N" document_number = "A161BSOUG"
birth_day = "841215" birth_day = "970321"
# sex = "F" sex = "F"
sex = "M" # sex = "M"
# optinal_data = "MFMLMANK<<<<A9" #14位 # optinal_data = "MFMLMANK<<<<A9" #14位
nationality = "CHN" nationality = "CHN"
country_code = "FRA" country_code = "FRA"
# optinal_data = "<E10805074" # 14位 # optinal_data = "<E10805074" # 14位
optinal_data = "<5703070161" #总共11位,最前面那位为空,所以加< optinal_data = "<5700226691" #总共11位,最前面那位为空,所以加<
document_prefix = "IR" document_prefix = "IR"
expire_date = "270803" expire_date = "270929"
if optinal_data is not None: if optinal_data is not None:
code = TD1CodeGenerator(document_prefix, country_code, document_number, birth_day, sex, expire_date, nationality, code = TD1CodeGenerator(document_prefix, country_code, document_number, birth_day, sex, expire_date, nationality,
last_name, first_name, optional_data1=optinal_data) last_name, first_name, optional_data1=optinal_data)
+16 -4
View File
@@ -18,7 +18,7 @@ DEFAULT_SERIAL_TO_IGNORE = ["47e7e36b", "bitbrowser"]
def upload_contacts_list(): def upload_contacts_list():
_contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/contact_list_all.xlsx") _contacts_to_book = read_contacts(str(Path.home()) + "/Desktop/contact_list_2025-03-08_aol_400.xlsx")
return _contacts_to_book return _contacts_to_book
@@ -94,7 +94,7 @@ def write_new_contacts_to_excel(valid_contacts: list, file_name=str(datetime.dat
def generate_valid_contact_list_for_day(segment_number=1): def generate_valid_contact_list_for_day(segment_number=1):
_collection_name = "2025-03-08" _collection_name = "2025-03-12"
_valid_contact_list = MONGO_STORE_MANAGER.get_all_successful_items_for_one_day(_collection_name) _valid_contact_list = MONGO_STORE_MANAGER.get_all_successful_items_for_one_day(_collection_name)
_all_contacts = MONGO_STORE_MANAGER.get_all_contacts_to_book() _all_contacts = MONGO_STORE_MANAGER.get_all_contacts_to_book()
_contact_to_save = [] _contact_to_save = []
@@ -232,17 +232,29 @@ def get_old_validated_contact_list(remove_blacklisted_contact=True, _day_in_str=
# 把新的联系人存到网上 # 把新的联系人存到网上
def write_resident_card_number_to_contact_list(file_to_read, file_name="contact_list_all.xlsx"):
_contacts_to_book = read_contacts(file_to_read)
_all_contact_list = MONGO_STORE_MANAGER.get_all_contacts_to_book()
for _contact in _contacts_to_book:
for _real_contact in _all_contact_list:
if _real_contact.mail == _contact.mail:
_contact.resident_card_number = _real_contact.resident_card_number
write_list_with_segment_number(file_name, _contacts_to_book, 1)
if __name__ == '__main__': if __name__ == '__main__':
# write_resident_card_number_to_contact_list(file_to_read=str(Path.home()) + "/Desktop/contact_list_all_12.xlsx",
# file_name="contact_list_all_12")
# contacts_to_book = upload_contacts_list() # contacts_to_book = upload_contacts_list()
# MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book) # MONGO_STORE_MANAGER.upload_contact_list(contacts_to_book)
# print("start at {}".format(datetime.datetime.now())) # print("start at {}".format(datetime.datetime.now()))
# generate_valid_contact_list_for_day(segment_number=2) generate_valid_contact_list_for_day(segment_number=2)
# generate_contact_from_mail_list("/Users/lpan/Downloads/邮箱及密码_aol_400_08_03_2025.xlsx") # generate_contact_from_mail_list("/Users/lpan/Downloads/邮箱及密码_aol_400_08_03_2025.xlsx")
# print("end at {}".format(datetime.datetime.now())) # print("end at {}".format(datetime.datetime.now()))
# update_contact_list_not_received_mail() # update_contact_list_not_received_mail()
# get_old_validated_contact_list() # get_old_validated_contact_list()
# print("end at {}".format(datetime.datetime.now())) # print("end at {}".format(datetime.datetime.now()))
generate_all_contact_list() # generate_all_contact_list()
# merge_contact_list_files( # merge_contact_list_files(
# ["/Users/lpan/Desktop/contact_list_2024-11-04.xlsx", # ["/Users/lpan/Desktop/contact_list_2024-11-04.xlsx",
# "/Users/lpan/Desktop/contact_list_2024-11-07.xlsx", # "/Users/lpan/Desktop/contact_list_2024-11-07.xlsx",