83 lines
3.7 KiB
Python
83 lines
3.7 KiB
Python
import pandas as pd
|
|
import requests
|
|
from module import F6_module
|
|
import time
|
|
from tqdm import tqdm
|
|
|
|
#+
|
|
# f6_module = F6_module()
|
|
#
|
|
# # 1.向服务器发送请求登录
|
|
# username = "13799889725"
|
|
# password = "Lc1234"
|
|
# store_name = "禹城榕桦"
|
|
module = 2
|
|
#
|
|
# res = f6_module.login_in(username, password, store_name)
|
|
# # cookies = requests.utils.dict_from_cookiejar(res.cookies)
|
|
|
|
cookies = {
|
|
'memberSESSIONID': 'a6c5084a-7393-426e-9cdc-c3fb8c0d6960',
|
|
'erpLanguage': 'zh-CN',
|
|
'tmall': 'false',
|
|
'Hm_lvt_25f5e7a3a5dbb293d7dd35d5f1be8d0a': '1760494904,1760510876,1760584685,1760671187',
|
|
'HMACCOUNT': '55F2182717FD6AE6',
|
|
'prodOrg': '16001002822673915925',
|
|
'unp': '16001002823772827677',
|
|
'un': '16001002823772827677',
|
|
'_up': '-NillNN-qyBEJ--t3vnSknvoOF1_zfCNsM8N0Xg4XeVVVPbHoJ7QjaZJ9Q3d-WrAAGgt60MgQHajHWBHMKKxj0CuWypi1JgKCFP1EPEk-HbqEvMdqoIq3wEI9_JRv-ZNHu3M-GTf3piwFXeqpu9WjuwYmFTEOBRorEj9mmew_aOwUBk.',
|
|
'sensorsdata2015jssdkcross': '%7B%22distinct_id%22%3A%2216001002823772827677%22%2C%22first_id%22%3A%22198a89fdaa54f-0a897244f8104b8-4c657b58-2073600-198a89fdaa61b71%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22%24device_id%22%3A%22198a89fdaa54f-0a897244f8104b8-4c657b58-2073600-198a89fdaa61b71%22%7D',
|
|
'Hm_lpvt_25f5e7a3a5dbb293d7dd35d5f1be8d0a': '1760939885',
|
|
}
|
|
|
|
print(cookies) # 登录获取cookies
|
|
|
|
df = pd.read_excel(fr"C:\Users\zy187\Desktop\钉钉文件\车辆信息-修复-太乙1020.xls",sheet_name="Sheet4").astype(str)
|
|
|
|
|
|
if module == 1: # 客户信息删除
|
|
df['手机号码'] = df['手机号码'].astype(str).str.strip().str.replace('.0$', '', regex=True)
|
|
df['手机号码'].dropna(inplace=True)
|
|
url = "https://yunxiu.f6car.cn/member/customer/listForPermission?pageSize=50000&pageNo=1" # 获取客户信息列表
|
|
res = requests.get(url, cookies=cookies)
|
|
data = res.json()
|
|
for item in tqdm(data['data']['data']):
|
|
try:
|
|
idCustomer = item['idCustomer']
|
|
phone = item['cellPhone']
|
|
phone_clean = str(phone).strip().replace('.0', '')
|
|
if phone in df['手机号码'].values:
|
|
print("删除:", phone)
|
|
url = f"https://yunxiu.f6car.cn/member/customer/{idCustomer}" # 客户信息删除url
|
|
res = requests.delete(url, cookies=cookies) # 客户信息删除
|
|
print(res.json(), idCustomer, phone)
|
|
time.sleep(3)
|
|
else:
|
|
# print("不删除:", phone)
|
|
pass
|
|
except:
|
|
idCustomer = item['idCustomer']
|
|
|
|
if module == 2: # 客户车辆信息删除
|
|
for index, row in tqdm(df.iterrows(), total=len(df)):
|
|
car_number = row['车牌号']
|
|
car_Id = row["carId"]
|
|
customerId = row["customerId"]
|
|
|
|
try:
|
|
# print("删除:", car_number)
|
|
url = f"https://yunxiu.f6car.cn/member/car/deleteCar/{car_Id}/{customerId}"
|
|
# url = f"https://yunxiu.f6car.cn/macan/coupon/car/batchRemove?customerId={customerId}&carId={carId}&operateOrgId={operateOrgId}" # 删除客户车辆信息url
|
|
res = requests.delete(url, cookies=cookies) # 客户车辆信息删除
|
|
print("delete——", res.json(), customerId, car_Id)
|
|
|
|
from datetime import datetime
|
|
now = datetime.now()
|
|
if now.hour >= 20:
|
|
time.sleep(1)
|
|
else:
|
|
time.sleep(3)
|
|
except:
|
|
print("删除失败:", res.json(), customerId, car_Id)
|
|
continue
|