You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.6 KiB
59 lines
1.6 KiB
import requests |
|
from time import sleep |
|
|
|
session = requests.session() |
|
|
|
|
|
def login(): |
|
login_url = "http://passport-qas.mx.com/login" |
|
header = {'Referer': 'http://passport-qas.mx.com/login?backURL=http://showfilm.qas.cmc.com/', } |
|
data = {'backURL': 'http://showfilm.qas.cmc.com/', |
|
'username': 'wangxiaoli33', |
|
'password': 'F1887D3F9E6EE7A32FE5E76F4AB80D63'} |
|
|
|
session.post(login_url, headers=header, data=data) |
|
# print(r.headers) |
|
|
|
|
|
def check_quan(quan_barcode): |
|
quan_url = "http://voucher-info.qas.cmc.com/voucherquery/detail" |
|
|
|
data = {'voucherBarcode': quan_barcode, |
|
'voucherId': ''} |
|
|
|
r = session.post(quan_url, data=data) |
|
print(r.text) |
|
j = r.json() |
|
if j['exchangeOrderId'] == "": |
|
check_quan_bind(quan_barcode) |
|
else: |
|
print(f"'{quan_barcode}\t已回兑") |
|
|
|
|
|
def check_quan_bind(quan_barcode): |
|
quan_bind_url = 'http://voucher-trade.qas.cmc.com/relation/searchData' |
|
data = {'voucherNumber': quan_barcode, |
|
'memberNumber': '', |
|
'voucherState': '0', |
|
'mobile': '', |
|
'backupYear': '', |
|
'pageIndex': 1, |
|
'pageSize': 10, } |
|
r = session.post(quan_bind_url, data=data) |
|
# print(r.text) |
|
j = r.json() |
|
if j['totalCount'] == 1: |
|
print(f"'{quan_barcode}\t已绑定") |
|
else: |
|
print(f"'{quan_barcode}") |
|
|
|
|
|
if __name__ == '__main__': |
|
login() |
|
with open('quanid.txt', 'r', encoding='utf-8') as f: |
|
lines = f.readlines() |
|
for line in lines: |
|
q = line.strip() |
|
if q != '': |
|
check_quan(q) |
|
sleep(1)
|
|
|