applipatient.txt
从数据库提取出来的
163409534007317600107111 0.01 林
163289698977816100106112 0.01 林
162633321590100200105113 0.01 晚涵
162555748524100600105114 0.01 晚涵
获取orderId,放入列表储存
resdata=[]
def data():
path = r'applipatient.txt'
with open(path, 'r', encoding='utf-8') as f:
for line in f:
resdata.append(line[:24])
data()
print(resdata)
将获取到的orderId依次调用接执行退费
import requests
import time
def returnfree(orderId):
url="http://192.168.xx.xx:xxxxorder/refundpayment" #登录
headers = {"api-version": "6.0.0", "Content-Type": "application/json", "Connection": "keep-alive"}
data={"orderId":orderId,"type":"2","userId":"x"} #type:"1处方,2检验,3检查"
html=requests.post(url,headers=headers,json=data)
print("申请单退费:"+orderId,html.json())
data=['163409534007317600107111', '163289698977816100106112'],'162633321590100200105113','162555748524100600105114'
for orderId in data:
# print(orderId)
returnfree(orderId)
time.sleep(2)
最后查看执行结果,即可知晓是否退费成功