Files
2026-05-18 13:45:58 +08:00

261 lines
12 KiB
Plaintext

{
"cells": [
{
"metadata": {},
"cell_type": "markdown",
"source": "## 客户信息导出(含解密手机号)",
"id": "9c3ce59cd7160150"
},
{
"cell_type": "code",
"id": "initial_id",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2026-05-12T06:14:49.072001900Z",
"start_time": "2026-05-12T06:08:51.739974700Z"
}
},
"source": [
"import requests\n",
"import pandas as pd\n",
"from tqdm import tqdm\n",
"\n",
"cookies = {\n",
" 'MD_accessToken': '2701b3d9-c959-4bfc-ad17-0a9b3f237f75',\n",
"}\n",
"\n",
"headers = {\n",
" 'Accept': 'application/json, text/plain, */*',\n",
" 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',\n",
" 'Authorization': 'Bearer2701b3d9-c959-4bfc-ad17-0a9b3f237f75',\n",
" 'Connection': 'keep-alive',\n",
" 'Content-Type': 'application/json;charset=UTF-8',\n",
" 'Origin': 'https://store.fuchuang.com',\n",
" 'Referer': 'https://store.fuchuang.com/store/index.html',\n",
" 'Sec-Fetch-Dest': 'empty',\n",
" 'Sec-Fetch-Mode': 'cors',\n",
" 'Sec-Fetch-Site': 'same-origin',\n",
" 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36 Edg/147.0.0.0',\n",
" 'X-FC-TRACE-ID': '3b644c0201c34c6cbb4333f57367e40b',\n",
" 'loginPlatform': 'store_pc',\n",
" 'platform': 'store_pc',\n",
" 'searchInfo': '%E5%AE%A2%E6%88%B7%E8%BD%A6%E8%BE%86,%E5%AE%A2%E6%88%B7%E7%AE%A1%E7%90%86,%E6%9F%A5%E8%AF%A2',\n",
" 'sec-ch-ua': '\"Microsoft Edge\";v=\"147\", \"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"147\"',\n",
" 'sec-ch-ua-mobile': '?0',\n",
" 'sec-ch-ua-platform': '\"Windows\"',\n",
" 'user-info-wms': '{\"token\":\"Bearer2701b3d9-c959-4bfc-ad17-0a9b3f237f75\",\"platform\":\"store_pc\"}',\n",
" 'x-fc-client': 'web',\n",
" # 'Cookie': 'MD_accessToken=2701b3d9-c959-4bfc-ad17-0a9b3f237f75',\n",
"}\n",
"json_data = {\n",
" 'phone': '',\n",
" 'name': '',\n",
" 'storeLabelIds': [],\n",
" 'fcLabelIds': [],\n",
" 'customerSource': None,\n",
" 'customerType': None,\n",
" 'sourceChannel': None,\n",
" 'pageSize': 10,\n",
" 'pageNum': 1,\n",
"}\n",
"\n",
"all_data = []\n",
"for i in tqdm(range(1, 486)):\n",
" json_data['pageNum'] = i\n",
" response = requests.post(\n",
" 'https://store.fuchuang.com/api/store-crm/crm/customer/query',\n",
" cookies=cookies,\n",
" headers=headers,\n",
" json=json_data,\n",
" )\n",
" data_list= response.json()['data']['list']\n",
" if len(data_list) == 0:\n",
" break\n",
" data_list= response.json()['data']['list']\n",
" for data in data_list:\n",
" all_data.append(data)\n",
"\n",
"df = pd.DataFrame(all_data)\n",
"df.to_excel('D:\\Idea Project\\F6+宜搭+其它(1)\\张阳脚本\\文件输出\\美孚客户信息.xlsx', index=False)\n"
],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"<>:63: SyntaxWarning: invalid escape sequence '\\I'\n",
"<>:63: SyntaxWarning: invalid escape sequence '\\I'\n",
"C:\\Users\\hp_z66\\AppData\\Local\\Temp\\ipykernel_14680\\526967017.py:63: SyntaxWarning: invalid escape sequence '\\I'\n",
" df.to_excel('D:\\Idea Project\\F6+宜搭+其它(1)\\张阳脚本\\文件输出\\美孚客户信息.xlsx', index=False)\n",
"100%|██████████| 485/485 [05:54<00:00, 1.37it/s]\n"
]
}
],
"execution_count": 13
},
{
"metadata": {},
"cell_type": "markdown",
"source": "# 客户明细",
"id": "d9b13e7006671ff2"
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-05-12T07:23:39.540370100Z",
"start_time": "2026-05-12T06:31:05.220043700Z"
}
},
"cell_type": "code",
"source": [
"import requests\n",
"import time\n",
"from tqdm.notebook import tqdm\n",
"import pandas as pd\n",
"cookies = {\n",
" 'acw_tc': '0a0572c017785673680518302e62de2d436dcebb15d1ca5dd604f3df26743b',\n",
" 'MD_accessToken': 'fc95ef0c-1929-4fa3-95b9-2fdfd56af0eb',\n",
"}\n",
"\n",
"headers = {\n",
" 'Accept': 'application/json, text/plain, */*',\n",
" 'Accept-Language': 'zh-CN,zh;q=0.9',\n",
" 'Authorization': 'Bearerfc95ef0c-1929-4fa3-95b9-2fdfd56af0eb',\n",
" 'Connection': 'keep-alive',\n",
" 'Content-Type': 'application/json;charset=UTF-8',\n",
" 'Origin': 'https://store.fuchuang.com',\n",
" 'Referer': 'https://store.fuchuang.com/store/index.html',\n",
" 'Sec-Fetch-Dest': 'empty',\n",
" 'Sec-Fetch-Mode': 'cors',\n",
" 'Sec-Fetch-Site': 'same-origin',\n",
" 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36 Edg/147.0.0.0',\n",
" 'X-FC-TRACE-ID': '29cb0c9ab8904d85b54f1b1bb3ae33b5',\n",
" 'loginPlatform': 'store_pc',\n",
" 'platform': 'store_pc',\n",
" 'sec-ch-ua': '\"Microsoft Edge\";v=\"147\", \"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"147\"',\n",
" 'sec-ch-ua-mobile': '?0',\n",
" 'sec-ch-ua-platform': '\"Windows\"',\n",
" 'user-info-wms': '{\"token\":\"Bearerfc95ef0c-1929-4fa3-95b9-2fdfd56af0eb\",\"platform\":\"store_pc\"}',\n",
" 'x-fc-client': 'web',\n",
" # 'Cookie': 'acw_tc=0a0572c017785673680518302e62de2d436dcebb15d1ca5dd604f3df26743b; MD_accessToken=fc95ef0c-1929-4fa3-95b9-2fdfd56af0eb',\n",
"}\n",
"\n",
"df1 = pd.read_excel(r'D:\\Idea Project\\F6+宜搭+其它(1)\\张阳脚本\\文件输出\\美孚客户信息.xlsx', sheet_name =0)\n",
"detail_list = []\n",
"start_index = 0\n",
"for index, row in tqdm(df1.iterrows(), total=len(df1)):\n",
" params = {\n",
" 'id': row[\"id\"],\n",
" }\n",
"\n",
" json_data = {}\n",
" try:\n",
" response = requests.post(\n",
" 'https://store.fuchuang.com/api/store-crm/crm/customer/detail',\n",
" params=params,\n",
" cookies=cookies,\n",
" headers=headers,\n",
" json=json_data,\n",
" )\n",
"\n",
" detail_list.append(response.json()['data'])\n",
" except Exception as e:\n",
" print(e)\n",
" pass\n",
" time.sleep(0.2)\n",
"\n",
"df2 = pd.DataFrame(detail_list)\n",
"df2.to_excel('D:\\Idea Project\\F6+宜搭+其它(1)\\张阳脚本\\文件输出\\美孚客户信息明细1.xlsx', index=False)\n"
],
"id": "d096136584e77781",
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"<>:58: SyntaxWarning: invalid escape sequence '\\I'\n",
"<>:58: SyntaxWarning: invalid escape sequence '\\I'\n",
"C:\\Users\\hp_z66\\AppData\\Local\\Temp\\ipykernel_14680\\3627701310.py:58: SyntaxWarning: invalid escape sequence '\\I'\n",
" df2.to_excel('D:\\Idea Project\\F6+宜搭+其它(1)\\张阳脚本\\文件输出\\美孚客户信息明细1.xlsx', index=False)\n"
]
},
{
"data": {
"text/plain": [
" 0%| | 0/4847 [00:00<?, ?it/s]"
],
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "02a2225e158a4c208c837d37c2a525c1"
}
},
"metadata": {},
"output_type": "display_data",
"jetTransient": {
"display_id": null
}
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))\n",
"('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))\n",
"('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))\n",
"('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))\n",
"('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))\n",
"('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))\n",
"('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))\n",
"('Connection aborted.', ConnectionResetError(10054, '远程主机强迫关闭了一个现有的连接。', None, 10054, None))\n"
]
}
],
"execution_count": 20
},
{
"metadata": {
"ExecuteTime": {
"end_time": "2026-05-12T06:31:03.033486600Z",
"start_time": "2026-05-12T06:31:02.977494Z"
}
},
"cell_type": "code",
"source": "print(response.json())",
"id": "71fe765d89e1fc8d",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'code': 10000, 'message': '操作成功', 'data': {'labelConsumptionType': 2, 'labelActivityType': 1, 'labelEquityCard': 0, 'labelScCard': 0, 'labelTcCard': 0, 'fcCustomerLabels': [{'labelId': 2, 'labelType': 1, 'labelTypeName': '客户类型标签', 'labelValue': 2, 'labelName': '新客'}, {'labelId': 4, 'labelType': 2, 'labelTypeName': '客户活跃度标签', 'labelValue': 1, 'labelName': '活跃'}], 'storeCustomerLabels': [], 'storeCustomerLabelNames': [], 'id': '177849100876200134310619337', 'name': '长安', 'phoneNumber': '15566441231', 'gender': 1, 'birthday': None, 'customerType': 'person', 'customerSource': 'ZRJD', 'sourceChannel': '', 'driverLicenseNumber': '', 'driverLicenseType': 'C1', 'provinceId': None, 'cityId': None, 'countyDistrictId': None, 'provinceName': '', 'cityName': '', 'countyDistrictName': '', 'driverLicenseExpiryDate': None, 'driverLicensePhoto': '', 'address': '', 'customerRemark': '', 'isMember': 0, 'mallUser': 0, 'commonUserId': 4919522, 'updateTime': '2026-05-11 17:18:18', 'creditCycle': 30, 'creditLine': 0.0, 'vehicleResps': [{'id': '177849100876900134310619338', 'customerId': '177849100876200134310619337', 'carNum': '赣E116Q0', 'drivenDistance': 0, 'licensePlateFlag': '赣', 'licensePlateNumber': 'E116Q0', 'vehicleModel': '长安 长安汽车 CS75 2014款 2.0L 手动 2015年产', 'color': '', 'vin': '', 'vehicleType': 'B', 'engine': '', 'lastMaintenanceDate': '2026-05-11 17:18:33', 'nextMaintenanceDate': None, 'nextMaintainMileage': None, 'insuranceCompany': '', 'effectiveDate': None, 'expiryDate': None, 'description': None, 'remark': '', 'carPhoto': 'https://image.fuchuang.com/prod/f29f067f_%E9%95%BF%E5%AE%8920230901112941.png', 'brand': '长安', 'brandType': '', 'carName': '', 'saleName': '长安 CS75 2.0L 手动', 'paiLiang': '', 'avgPrice': 12.58, 'tireSize': '', 'annualInspectionDate': None, 'commonVehicleId': 3690941, 'storeMallVehicleId': None, 'fid': 0, 'fidCode': '', 'year': '2015', 'gearboxCode': '1', 'gearboxType': '手动', 'levelName': 'CS75', 'seriesId': 216, 'seriesName': 'CS75', 'updateTime': '2026-05-11 17:18:18', 'vid': 95750, 'modelYear': 2014, 'powerVersion': '', 'energyVersion': '', 'saleModel': '', 'displacementType': '2.0L', 'brandId': 207, 'vendorName': '长安汽车', 'vendorId': 204, 'carInfo': '2014款 2.0L 手动 2015年产', 'yearText': '2015年产', 'isVip': None, 'insuranceVehicleId': None, 'energyType': 1, 'energyTypeName': '汽油', 'status': 1}], 'storeMallUser': 0}, 'detail': None, 'trace': None, 'success': True}\n"
]
}
],
"execution_count": 19
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 5
}