This commit is contained in:
2026-01-30 11:28:35 +08:00
commit f1831c31b4
399 changed files with 860978 additions and 0 deletions
@@ -0,0 +1,112 @@
import pandas as pd
import time
import requests
import json
import xlrd
cookies_str ='marketingSESSIONID=f9282002-952a-43ef-adeb-115a10f86582; unp=10979894419862873377; un=10979894419862873377; _up=-NillNN-qyBEJ--t3vnSknvoOFt2yviFuckB0nI3XOVVUfLCoJ7QjaZJ9Q3d-WrAAGgt60MgQHajH2BEMqCxilqvQjl2xs5PR0K-R6Uw93buFvYcrYgm0QYQ7LQU-bEeWP7G42LQ1pG1EXahputXgewZk1HELF5853znmxrs988.; sensorsdata2015jssdkcross={"distinct_id":"10979894419862873377","first_id":"1807ab08f0d1e5-01a788ed4f63b8-6b3e555b-1327104-1807ab08f0e219","props":{"$latest_traffic_source_type":"直接流量","$latest_search_keyword":"未取到值_直接打开","$latest_referrer":""},"$device_id":"1807ab08f0d1e5-01a788ed4f63b8-6b3e555b-1327104-1807ab08f0e219"}; currMenu=营销; prodOrg=11240984669917132579'
cookies_str = cookies_str.encode('utf-8').decode('latin-1')
cookie_dict = {item.split('=')[0]: item.split('=')[1]
for item in cookies_str.split('; ')}
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36 Edg/95.0.1020.40',
"Content-Type": "application/json",
'origin': 'https://yunxiu.f6car.cn'
}
#读取excel文件
data = xlrd.open_workbook(r"C:\Users\admin\Desktop\Python脚本\图形界面自动化脚本\F6系统常用脚本\Excel通用存储位置.xls")
table = data.sheet_by_index(0) # 通过索引顺序获取
h = table.nrows
l = table.ncols
print(u"表数据的行数为%s,列数为%s"%(h,l))
for i in range(1,h):
idMember =table.cell(i, 0).value #卡id
idMember1 =table.cell(i, 1).value #退款金额
idMember2 =table.cell(i, 2).value #退款金额
idOwnOrg =table.cell(i, 3).value #门店ID
employeeId =table.cell(i, 4).value #退卡服务顾问ID
#读取cardVersion信息并配置退卡data
url = 'https://yunxiu.f6car.cn/marketing/tkdBill/baseInfo?pkId={}'.format(idMember)
resget = requests.get(url,cookies=cookie_dict)
resget = json.loads(resget.text)
cardVersion = resget['data']['cardVersion']
data = {
"cardId": idMember, # 退卡实体id
"cardVersion": cardVersion,
"employeeId": employeeId, # 退卡服务顾问ID 手动更新
"idOwnOrg": idOwnOrg, # 门店ID 手动更新
"refundAmount": idMember1, # 退卡金额
"remark": "" # 备注
}
#生成退卡单
res = requests.post(f'https://yunxiu.f6car.cn/marketing/tkdBill/add',
headers=headers,cookies=cookie_dict, json=data)
resdata = res.json().get('data')
#print(data)
#读取Version信息并配置退卡data
url1 = 'https://yunxiu.f6car.cn/marketing/tkdBill/detail/{}'.format(resdata)
resget1 = requests.get(url1,cookies=cookie_dict)
resget1 = json.loads(resget1.text)
cardVersion1 = resget1['data']['version']
#完成收款
if idMember1 != "0":
data = {
"idOwnOrg": idOwnOrg,# 门店ID 手动更新
"idOperationOrg": idOwnOrg,# 退卡门店ID 手动更新
"idSourceBill": resdata,# 退卡单ID
"sourceBillType": "TKD",#类型
"receiptMemo": "",# 备注
"version": cardVersion1,
"favourableList": [],
"gatheringFavourable": 0,
"paymentTypeGroupId": "",
"czkList": [],
"paymentList": [
{
"paymentTypeId": "7941750",# 各门店不同 手动更新
"paymentType": "现金",
"paymentAmount": idMember2,
"gatheringType": 0,
"kind": "normal"
}
],
"pkId": 0,
"billType": "YSF",
"domainCode": "SAAS"
}
else:
data = {
"idOwnOrg": idOwnOrg,# 门店ID 手动更新
"idOperationOrg": idOwnOrg,# 退卡门店ID 手动更新
"idSourceBill": resdata,# 退卡单ID
"sourceBillType": "TKD",#类型
"receiptMemo": "",# 备注
"version": cardVersion1,
"favourableList": [],
"gatheringFavourable": 0,
"paymentTypeGroupId": "",
"czkList": [],
"paymentList": [
{
"status": 0,
"paymentAmount": 0
}
],
"pkId": 0,
"billType": "YSF",
"domainCode": "SAAS"
}
#print(data)
res = requests.post(f'https://yunxiu.f6car.cn/financial/advance/payment/singleGathering',
headers=headers,cookies=cookie_dict, json=data)
print("打印出响应信息:",cardVersion,cardVersion1,resdata,idMember,res.text)