m2 = MongoDB('10.2.1.121:17017', 'clues_resources', "jianzhutong_shanghai") # m3 = MongoDB('10.2.1.121:17017', 'clues_resources', "jianzhutong_guangzhou") # m4 = MongoDB('10.2.1.121:17017', 'clues_resources', "jianzhutong_foshan") # m5 = MongoDB('10.2.1.121:17017', 'clues_resources', "jianzhutong_shengzheng") # m5 = MongoDB('10.2.1.121:17017', 'clues_resources', "BMD20201224-4") # 导入clues,只有这个才能推送数据 # m1.mong_find_many_updata({"companyCity": "成都"}, {"isDir": 0}) # all_data = m1.find_all() # for i in all_data: # print(i) count = 0 gd_data = m1.find_all() for i in gd_data: # if count <= 3000: m2.mongo_add(i) # elif count <= 6000: # m3.mongo_add(i) # elif count<=9000: # m4.mongo_add(i) # else: # m5.mongo_add(i) # count += 1 #all_data = m3.find_all() # 相同公司名去重 # list_data = list(m1.find_all()) # for i in range(len(list_data)):
# for i in list_data: # list_company_name.append(i["companyName"]) # # myset = set(list_company_name) # for i in myset: # if list_company_name.count(i) > 1: # tem = m2.mongo_find_company(i).next() # m2.find_one_and_remove(i) # m2.mongo_add(tem) # # m2.mongo_add(k for k in list_data if list_data["companyName"]==i) # else: # continue #去重策略3 去重非手机号电话号码 # all_data=m2.find_many("flag",0) all_data = m2.find_all() for i in all_data: if is_phone(i["companyTel"]): continue else: m2.remove_nophone(i["companyTel"]) print("删除非手机号数据", i["companyTel"]) #去重策略4 导出电话号码txt文件,上传刀鱼,下载检测成功文件,进行对比插入 # all_data=m2.find_many("flag",0) # # with open('BMD_sort.txt', 'w') as f: # # for i in all_data: # # phone = i["companyTel"] # # f.write(str(phone) + '\n') #
#空号检测文件 from Func.client import MongoDB db = MongoDB('10.2.1.121:17017', 'clues_resources', "BMD_sort") db2 = MongoDB('mongodb://localhost', 'cuiworkdb', 'BMD20210201-chengdu-check') all_data = db.find_all() # all_data=db.find_many("flag",0) #mongo 电话数据导出为txt,拿去空号检测 with open('BMD_sort', 'w') as f: for i in all_data: phone = i["companyTel"] f.write(str(phone) + '\n') #将活跃号数据导入xxxx-check表 # huoyue_list = [] # with open('活跃号(实号).txt','r',encoding='utf-8') as f: # for line in f: # huoyue_list.append(line.strip()) # # for i in all_data: # if i["companyTel"] in huoyue_list: # db2.mongo_add(i)