202 lines
23 KiB
Plaintext
202 lines
23 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"# 获取储值卡现有属性信息,组合生成修改需要的载荷内容"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"{'f6sid': 'c17338cf-0251-41d7-9a58-65bf1c2efc4c', 'un': '10691192243916872391', 'prodOrg': '10691192243916872380', 'unp': '10691192243916872391', '_up': '-NillNN-qyBEJ--t3vnSknvoOFt5xPCMuc8H13g2W-FVUfPCrpjQjaZJ9Q3d-WrAAGgt60MgQHajHWBHMKKxj0CuWypi1JgKCFP1EPEk-HbqFvoSro8i0wcF9_BRv-ZNHu3M-GTZ2JGwFH6qrOlWgOocmFHBPRpurEj93WH59sixNhc.'}\n",
|
|
"{'success': True, 'code': 200, 'message': None, 'data': {'pkId': '11970411734348357687', 'idCustomer': '11970410900592029718', 'customerName': '赵诗杰', 'customerExclusiveConsultantId': '10691192243916872390', 'customerExclusiveConsultantName': 'F6', 'cellPhone': '1835734324', 'idMemberCard': '10907434497385940020', 'memberCardNo': 'HYWYCZ4324', 'cardType': 'CZK', 'useType': 0, 'name': 'HYWY储值卡', 'password': None, 'memo': '', 'permanent': 0, 'validate': 1, 'endDate': 1830268799000, 'activeDate': 1680192000000, 'idOwnOrg': '11240984669918141605', 'abbreviation': '海盐吾悦店', 'isDel': 0, 'useTerm': '', 'availableForOwnerOnly': 0, 'usable': 1, 'activationDeadline': None, 'realActiveDate': 1680192000000, 'idBuyer': '11970410900592029718', 'buyerName': '赵诗杰', 'buyerCellPhone': '1835734324', 'version': '8', 'czkBusinessType': 1, 'czkBusinessLabelId': None, 'czkBusinessLabelName': None, 'totalAmount': '1440.00', 'consumeAmount': '0.00', 'balanceAmount': '1440.00', 'consumeLimitFlag': 0, 'consumeLimitAmount': '0.00', 'cardEntityStationList': [{'id': 29970443, 'entityCardId': '11970411734348357687', 'orgId': '11240984669918141605', 'abbreviation': '海盐吾悦店', 'creator': '10691192243916872391', 'createTime': 1729664416000, 'modifier': None, 'modifiedTime': None, 'groupId': '10691192243916496229'}], 'cardEntityCarInfoList': None, 'itemList': None, 'partList': None, 'packageInfoList': None, 'cardEntityBusinessList': None, 'cardEntityBusinessDiscountList': [{'id': 956691, 'cardEntityId': '11970411734348357687', 'labelId': '741375', 'businessType': 0, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '维修'}, {'id': 956692, 'cardEntityId': '11970411734348357687', 'labelId': '741376', 'businessType': 0, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '保养'}, {'id': 956693, 'cardEntityId': '11970411734348357687', 'labelId': '741377', 'businessType': 0, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '美容'}, {'id': 956694, 'cardEntityId': '11970411734348357687', 'labelId': '741378', 'businessType': 0, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '钣喷'}, {'id': 956695, 'cardEntityId': '11970411734348357687', 'labelId': '741379', 'businessType': 0, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '轮胎'}, {'id': 956696, 'cardEntityId': '11970411734348357687', 'labelId': '741380', 'businessType': 0, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '洗车'}, {'id': 956697, 'cardEntityId': '11970411734348357687', 'labelId': '741381', 'businessType': 0, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '精品'}, {'id': 956698, 'cardEntityId': '11970411734348357687', 'labelId': '741382', 'businessType': 0, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '其他'}, {'id': 956699, 'cardEntityId': '11970411734348357687', 'labelId': '741383', 'businessType': 0, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '零售'}, {'id': 956700, 'cardEntityId': '11970411734348357687', 'labelId': '741375', 'businessType': 1, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '维修'}, {'id': 956701, 'cardEntityId': '11970411734348357687', 'labelId': '741376', 'businessType': 1, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '保养'}, {'id': 956702, 'cardEntityId': '11970411734348357687', 'labelId': '741377', 'businessType': 1, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '美容'}, {'id': 956703, 'cardEntityId': '11970411734348357687', 'labelId': '741378', 'businessType': 1, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '钣喷'}, {'id': 956704, 'cardEntityId': '11970411734348357687', 'labelId': '741379', 'businessType': 1, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '轮胎'}, {'id': 956705, 'cardEntityId': '11970411734348357687', 'labelId': '741380', 'businessType': 1, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '洗车'}, {'id': 956706, 'cardEntityId': '11970411734348357687', 'labelId': '741381', 'businessType': 1, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '精品'}, {'id': 956707, 'cardEntityId': '11970411734348357687', 'labelId': '741382', 'businessType': 1, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '其他'}, {'id': 956708, 'cardEntityId': '11970411734348357687', 'labelId': '741383', 'businessType': 1, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': '零售'}, {'id': 956709, 'cardEntityId': '11970411734348357687', 'labelId': '0', 'businessType': 2, 'discount': '0.63', 'creationtime': 1729664416000, 'creator': None, 'modifier': None, 'modifiedtime': None, 'isDeleted': None, 'groupId': None, 'labelName': None}]}}\n",
|
|
"{'code': 200, 'data': None, 'errInfo': None, 'ext': None, 'info': {'benefitPackageEventLogVoList': None, 'carInfoList': [], 'detailDTOList': None, 'entityDTO': {'activeDate': 1680192000000, 'amount': 1440.0, 'amountBackup': 0, 'amountChangeFlag': 0, 'balanceStatus': '7100', 'businessType': 0, 'cardEditFlag': 0, 'cardType': 'CZK', 'cellPhone': '1835734324', 'channelType': 1, 'consumeLimitAmount': 0.0, 'consumeLimitFlag': 0, 'creationtime': None, 'creator': '10691192243916872391', 'customerName': '赵诗杰', 'discount': 1.0, 'endDate': 1830268799000, 'favourableMoney': 0.0, 'grossProfit': 0, 'groupId': '10691192243916496229', 'idBuyer': '11970410900592029718', 'idCar': 0, 'idCustomer': '11970410900592029718', 'idEmployee': '15860665516159954963', 'idMemberCard': '10907434497385940020', 'idOwnOrg': '11240984669918141605', 'isDel': 0, 'labelId': 0, 'lastConsumptionTime': None, 'memberCardNo': 'HYWYCZ4324', 'memo': '', 'modifiedtime': None, 'modifier': '10691192243916872391', 'name': 'HYWY储值卡', 'orgAbbreviation': '', 'oweAmount': 0, 'password': '', 'performanceFlag': '', 'permanent': 0, 'pkId': '11970411734348357687', 'prestoreAmount': 0, 'realActiveDate': 1680192000000, 'realAmount': 1440.0, 'receiveAmount': 1440.0, 'taxRate': 0, 'totalNumber': 0, 'unUseNumber': 0, 'unusedNumberBackup': 0, 'usable': 1, 'useNumber': 0, 'useTerm': '', 'useType': '0', 'usedNumberBackup': 0, 'validate': 1, 'version': 0, 'vipMoney': 1440.0}, 'packageDTOList': None, 'partDetailDTOList': None, 'settledBenefitVo': None, 'useStationDTOList': [{'abbreviation': '', 'entityCardId': '11970411734348357687', 'id': 29970443, 'orgId': '11240984669918141605'}], 'valueCardBusinessDiscountInfoList': [{'businessType': 0, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956691, 'labelId': '741375', 'labelName': '维修'}, {'businessType': 0, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956692, 'labelId': '741376', 'labelName': '保养'}, {'businessType': 0, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956693, 'labelId': '741377', 'labelName': '美容'}, {'businessType': 0, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956694, 'labelId': '741378', 'labelName': '钣喷'}, {'businessType': 0, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956695, 'labelId': '741379', 'labelName': '轮胎'}, {'businessType': 0, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956696, 'labelId': '741380', 'labelName': '洗车'}, {'businessType': 0, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956697, 'labelId': '741381', 'labelName': '精品'}, {'businessType': 0, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956698, 'labelId': '741382', 'labelName': '其他'}, {'businessType': 0, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956699, 'labelId': '741383', 'labelName': '零售'}, {'businessType': 1, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956700, 'labelId': '741375', 'labelName': '维修'}, {'businessType': 1, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956701, 'labelId': '741376', 'labelName': '保养'}, {'businessType': 1, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956702, 'labelId': '741377', 'labelName': '美容'}, {'businessType': 1, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956703, 'labelId': '741378', 'labelName': '钣喷'}, {'businessType': 1, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956704, 'labelId': '741379', 'labelName': '轮胎'}, {'businessType': 1, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956705, 'labelId': '741380', 'labelName': '洗车'}, {'businessType': 1, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956706, 'labelId': '741381', 'labelName': '精品'}, {'businessType': 1, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956707, 'labelId': '741382', 'labelName': '其他'}, {'businessType': 1, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956708, 'labelId': '741383', 'labelName': '零售'}, {'businessType': 2, 'cardEntityId': '11970411734348357687', 'discount': 0.63, 'groupId': '10691192243916496229', 'id': 956709, 'labelId': '0', 'labelName': ''}], 'valueCardBusinessInfoList': [], 'valueCardEntitySkuDiscountInfoList': []}, 'message': '', 'msg': 'success', 'traceId': ''}\n",
|
|
"{'id': '11970411734348357687', 'carList': [], 'cardNo': 'HYWYCZ4324', 'memo': '', 'useTerm': '', 'idCustomer': '11970410900592029718', 'version': '8', 'useType': '0', 'consumeLimitFlag': 0, 'consumeLimitAmount': 0, 'permanent': 0, 'endDate': '2027-12-31 23:59:59', 'cardEntityBusinessList': [{'labelName': '维修', 'businessType': 0, 'labelId': '741375'}, {'labelName': '保养', 'businessType': 0, 'labelId': '741376'}, {'labelName': '美容', 'businessType': 0, 'labelId': '741377'}, {'labelName': '钣喷', 'businessType': 0, 'labelId': '741378'}, {'labelName': '轮胎', 'businessType': 0, 'labelId': '741379'}, {'labelName': '洗车', 'businessType': 0, 'labelId': '741380'}, {'labelName': '精品', 'businessType': 0, 'labelId': '741381'}, {'labelName': '其他', 'businessType': 0, 'labelId': '741382'}, {'labelName': '零售', 'businessType': 0, 'labelId': '741383'}, {'labelName': '维修', 'businessType': 1, 'labelId': '741375'}, {'labelName': '保养', 'businessType': 1, 'labelId': '741376'}, {'labelName': '美容', 'businessType': 1, 'labelId': '741377'}, {'labelName': '钣喷', 'businessType': 1, 'labelId': '741378'}, {'labelName': '轮胎', 'businessType': 1, 'labelId': '741379'}, {'labelName': '洗车', 'businessType': 1, 'labelId': '741380'}, {'labelName': '精品', 'businessType': 1, 'labelId': '741381'}, {'labelName': '其他', 'businessType': 1, 'labelId': '741382'}, {'labelName': '零售', 'businessType': 1, 'labelId': '741383'}, {'labelName': '', 'businessType': 2, 'labelId': '0'}], 'cardEntityBusinessDiscountList': [{'labelName': '维修', 'businessType': 0, 'discount': '0.63', 'labelId': '741375'}, {'labelName': '保养', 'businessType': 0, 'discount': '0.63', 'labelId': '741376'}, {'labelName': '美容', 'businessType': 0, 'discount': '0.63', 'labelId': '741377'}, {'labelName': '钣喷', 'businessType': 0, 'discount': '0.63', 'labelId': '741378'}, {'labelName': '轮胎', 'businessType': 0, 'discount': '0.63', 'labelId': '741379'}, {'labelName': '洗车', 'businessType': 0, 'discount': '0.63', 'labelId': '741380'}, {'labelName': '精品', 'businessType': 0, 'discount': '0.63', 'labelId': '741381'}, {'labelName': '其他', 'businessType': 0, 'discount': '0.63', 'labelId': '741382'}, {'labelName': '零售', 'businessType': 0, 'discount': '0.63', 'labelId': '741383'}, {'labelName': '维修', 'businessType': 1, 'discount': '0.63', 'labelId': '741375'}, {'labelName': '保养', 'businessType': 1, 'discount': '0.63', 'labelId': '741376'}, {'labelName': '美容', 'businessType': 1, 'discount': '0.63', 'labelId': '741377'}, {'labelName': '钣喷', 'businessType': 1, 'discount': '0.63', 'labelId': '741378'}, {'labelName': '轮胎', 'businessType': 1, 'discount': '0.63', 'labelId': '741379'}, {'labelName': '洗车', 'businessType': 1, 'discount': '0.63', 'labelId': '741380'}, {'labelName': '精品', 'businessType': 1, 'discount': '0.63', 'labelId': '741381'}, {'labelName': '其他', 'businessType': 1, 'discount': '0.63', 'labelId': '741382'}, {'labelName': '零售', 'businessType': 1, 'discount': '0.63', 'labelId': '741383'}, {'labelName': '', 'businessType': 2, 'discount': '0.63', 'labelId': '0'}], 'businessType': 1, 'useIdOwnOrgList': ['11240984669918141605'], 'cardEntitySkuDiscountList': []}\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"# # 获取储值卡现有属性信息,组合生成修改需要的载荷内容\n",
|
|
"import pandas as pd\n",
|
|
"import time\n",
|
|
"import requests\n",
|
|
"import json\n",
|
|
"import datetime\n",
|
|
"import hashlib\n",
|
|
"from urllib.parse import quote, quote_plus\n",
|
|
"\n",
|
|
"def login_in( username, password): # 登录模块(单店)\n",
|
|
" url = \"https://yunxiu.f6car.com/kzf6/login/confirm\"\n",
|
|
" session = requests.Session() # 使用 Session 对象保持会话状态\n",
|
|
" header = {\n",
|
|
" 'Referer': url,\n",
|
|
" 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0'\n",
|
|
" }\n",
|
|
" data = {\n",
|
|
" 'username': username,\n",
|
|
" 'password': hashlib.md5(password.encode('utf-8')).hexdigest(),\n",
|
|
" }\n",
|
|
" try:\n",
|
|
" res = session.post(url=url, headers=header, data=data)\n",
|
|
" # print(f\"Login Response Status Code: {res.status_code}\")\n",
|
|
" # print(f\"Login Response Headers: {res.headers}\")\n",
|
|
" # print(f\"Login Response Content: {res.content.decode('utf-8')}\")\n",
|
|
" return res\n",
|
|
" except Exception as e:\n",
|
|
" print(f\"Error during login: {e}\")\n",
|
|
" return None\n",
|
|
"\n",
|
|
"def more_login(username, password, store_name):\n",
|
|
" session = requests.Session() # 使用相同的 Session 对象\n",
|
|
" res = login_in(username, password)\n",
|
|
" if res is None:\n",
|
|
" return None\n",
|
|
"\n",
|
|
" try:\n",
|
|
" res_json = res.json()\n",
|
|
" if res_json.get(\"data\"):\n",
|
|
" for group in res_json.get('data', []):\n",
|
|
" if group[\"groupName\"] == store_name:\n",
|
|
" groupId = group.get(\"groupId\")\n",
|
|
" \n",
|
|
" token = res_json['token']\n",
|
|
"\n",
|
|
" token = quote(token) # url 编码\n",
|
|
" # token = 'b9rzRQki%2Bs%2BBmJtrtG7j%2BEXF7VnGhHKDS8F8zt78bqdDieK63p%2Bdjw%3D%3D'# 返回error可以尝试更改token\n",
|
|
" url = f'https://yunxiu.f6car.cn/kzf6/user/loginAfterChooseGroup?token={token}&groupId={groupId}&macAddress=' # 登录分组url\n",
|
|
" \n",
|
|
" # print(url)\n",
|
|
" res1 = session.get(url, cookies=res.cookies) # 使用正确的 cookies 获取方式\n",
|
|
" return res1\n",
|
|
" except Exception as e:\n",
|
|
" print(f\"Error during more_login: {e}\")\n",
|
|
" return None\n",
|
|
"\n",
|
|
"username = \"18662394600\"\n",
|
|
"password = \"cF9MqQzV\"\n",
|
|
"store_name = \"F6汽车科技数据组测试(废弃)\"\n",
|
|
"\n",
|
|
"res = login_in(username,password)\n",
|
|
"\n",
|
|
"headers = {\n",
|
|
" 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0',\n",
|
|
" \"Content-Type\": \"application/json\",\n",
|
|
" 'Referer':'https://yunxiu.f6car.cn/erp/view/index.html'\n",
|
|
" }\n",
|
|
"\n",
|
|
"try:\n",
|
|
" df = pd.read_excel(r'D:\\Idea Project\\F6+宜搭+其它(1)\\new\\文件输入\\会员卡信息(1).xlsx',sheet_name='Sheet1',dtype='string')\n",
|
|
" # print(df)\n",
|
|
" cookies = requests.utils.dict_from_cookiejar(res.cookies)\n",
|
|
" print(cookies)\n",
|
|
" for da in df.values:\n",
|
|
" try:\n",
|
|
"\n",
|
|
" # 获取储值卡属性信息\n",
|
|
" url_version = 'https://yunxiu.f6car.cn/marketing/card/detail/'+da[0]\n",
|
|
" res_version = requests.get(url_version,cookies=cookies,headers=headers)\n",
|
|
" res_version = res_version.json()\n",
|
|
" print(res_version)\n",
|
|
" # # 获取储值卡属性信息\n",
|
|
" url = 'https://yunxiu.f6car.cn/macan/card/entity/czk/queryWithBenefit?pkId='+da[0]\n",
|
|
" res = requests.get(url,cookies=cookies,headers=headers)\n",
|
|
" res =res.json()\n",
|
|
" print(res)\n",
|
|
" # # 组合载荷内容\n",
|
|
" # # 时间戳转格式\n",
|
|
" timestamp = res['info']['entityDTO']['endDate'] / 1000\n",
|
|
" dt_object = datetime.datetime.fromtimestamp(timestamp)\n",
|
|
" endDate = dt_object.strftime(\"%Y-%m-%d %H:%M:%S\")\n",
|
|
" # # 提取carInfoList\n",
|
|
" carInfoList = []\n",
|
|
" for carInfo in res['info']['carInfoList']:\n",
|
|
" List = {\n",
|
|
" \"idCar\": carInfo['idCar'],\n",
|
|
" \"idCustomer\": carInfo['idCustomer']\n",
|
|
" }\n",
|
|
" carInfoList.append(List)\n",
|
|
" # # 提取cardEntityBusinessList\n",
|
|
" cardEntityBusinessList = []\n",
|
|
" for cardEntityBusiness in res['info']['valueCardBusinessDiscountInfoList']:\n",
|
|
" List = {\n",
|
|
" \"labelName\": cardEntityBusiness['labelName'],\n",
|
|
" \"businessType\": cardEntityBusiness['businessType'],\n",
|
|
" \"labelId\": cardEntityBusiness['labelId']\n",
|
|
" }\n",
|
|
" cardEntityBusinessList.append(List)\n",
|
|
"\n",
|
|
" # 提取cardEntityBusinessDiscountList\n",
|
|
" cardEntityBusinessDiscountList = []\n",
|
|
" for cardEntityBusinessDiscount in res['info']['valueCardBusinessDiscountInfoList']:\n",
|
|
" List = {\n",
|
|
" \"labelName\": cardEntityBusinessDiscount['labelName'],\n",
|
|
" \"businessType\": cardEntityBusinessDiscount['businessType'],\n",
|
|
" # \"discount\": cardEntityBusinessDiscount['discount'],\n",
|
|
" \"discount\": '0.63',\n",
|
|
" \"labelId\": cardEntityBusinessDiscount['labelId']\n",
|
|
" }\n",
|
|
" cardEntityBusinessDiscountList.append(List)\n",
|
|
"\n",
|
|
" data = {\n",
|
|
" \"id\": res['info']['entityDTO']['pkId'],\n",
|
|
" \"carList\": carInfoList,\n",
|
|
" \"cardNo\": res['info']['entityDTO']['memberCardNo'],\n",
|
|
" \"memo\": res['info']['entityDTO']['memo'],\n",
|
|
" \"useTerm\": res['info']['entityDTO']['useTerm'],\n",
|
|
" \"idCustomer\": res['info']['entityDTO']['idCustomer'],\n",
|
|
" \"version\": res_version['data']['version'],\n",
|
|
" \"useType\": res['info']['entityDTO']['useType'],\n",
|
|
" \"consumeLimitFlag\": res['info']['entityDTO']['consumeLimitFlag'],\n",
|
|
" \"consumeLimitAmount\": int(float(res['info']['entityDTO']['consumeLimitAmount'])),\n",
|
|
" \"permanent\": res['info']['entityDTO']['permanent'],\n",
|
|
" \"endDate\": endDate,\n",
|
|
" \"cardEntityBusinessList\": cardEntityBusinessList,\n",
|
|
" \"cardEntityBusinessDiscountList\": cardEntityBusinessDiscountList,\n",
|
|
" \"businessType\": 1,\n",
|
|
" \"useIdOwnOrgList\":res_version['data']['idOwnOrg'], # 适用门店需要获取\n",
|
|
" \"cardEntitySkuDiscountList\": res['info']['valueCardEntitySkuDiscountInfoList']\n",
|
|
" }\n",
|
|
" url = 'https://yunxiu.f6car.cn/marketing/card/modifyCzkCardEntity4Gray'\n",
|
|
" res = requests.post(url,cookies=cookies,headers=headers,json=data)\n",
|
|
" res = res.json()\n",
|
|
" print(res,da[0])\n",
|
|
" except:\n",
|
|
" print(da)\n",
|
|
" pass\n",
|
|
"\n",
|
|
"except:\n",
|
|
" pass"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "base",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.12.4"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
}
|