mirror of https://github.com/testerSunshine/12306
常规更新
parent
33946508ac
commit
54887b6755
|
@ -2,7 +2,7 @@
|
|||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="jdk" jdkName="Python 2.7.9 (C:\Python27\python.exe)" jdkType="Python SDK" />
|
||||
<orderEntry type="jdk" jdkName="Python 2.7.10 (/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
<component name="TestRunnerService">
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7.9 (C:\Python27\python.exe)" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7.10 (/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7)" project-jdk-type="Python SDK" />
|
||||
</project>
|
1023
.idea/workspace.xml
1023
.idea/workspace.xml
File diff suppressed because it is too large
Load Diff
39
README.md
39
README.md
|
@ -1,6 +1,33 @@
|
|||
# 12306
|
||||
2017.5.13跟新
|
||||
1、增加登陆错误判断(密码错误&ip校验)
|
||||
2、修改queryOrderWaitTime,校验orderId字段bug,校验msg字段bug,校验messagesbug
|
||||
3、修改checkQueueOrder 校验 data 字段的列表推导式bug
|
||||
4、增加代理ip方法,目前已可以过滤有用ip
|
||||
### 12306
|
||||
|
||||
- python版本支持
|
||||
- 2.7
|
||||
- 依赖库
|
||||
- 项目 requirements.txt
|
||||
- 安装方法 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
|
||||
|
||||
- 项目声明:
|
||||
- 本软件只供学习交流使用,务作为商业用途,作者qq 931128603
|
||||
|
||||
- 2017.5.13跟新
|
||||
1. 增加登陆错误判断(密码错误&ip校验)
|
||||
2. 修改queryOrderWaitTime,校验orderId字段bug,校验msg字段bug,校验messagesbug
|
||||
3. 修改checkQueueOrder 校验 data 字段的列表推导式bug
|
||||
4. 增加代理ip方法,目前已可以过滤有用ip
|
||||
|
||||
|
||||
- 2018.1.7 号更新
|
||||
1. 增加自动配置
|
||||
```
|
||||
#station_date:出发日期,格式ex:2018-01-06
|
||||
#from_station: 始发站
|
||||
#to_station: 到达站
|
||||
#set_type: 坐席(商务座,二等座,特等座,软卧,硬卧,硬座,无座)
|
||||
#is_more_ticket:余票不足是否自动提交
|
||||
#select_refresh_interval:刷新间隔时间,1为一秒,0.1为100毫秒,以此类推
|
||||
#ticke_peoples: 乘客
|
||||
#damatu:打码图账号,用于自动登录
|
||||
```
|
||||
2. 优化订票流程
|
||||
3. 支持自动刷票,自动订票
|
||||
|
||||
|
|
108
yixing/12306.py
108
yixing/12306.py
|
@ -1,108 +0,0 @@
|
|||
# -*- coding: utf8 -*-
|
||||
from PyQt5 import Qt
|
||||
from PyQt5.QtGui import QPalette
|
||||
from PyQt5.QtWidgets import QAbstractItemView
|
||||
|
||||
from PyQt5.QtWidgets import QColorDialog
|
||||
from PyQt5.QtWidgets import QFileDialog
|
||||
from PyQt5.QtWidgets import QFontDialog
|
||||
from PyQt5.QtWidgets import QHeaderView
|
||||
from PyQt5.QtWidgets import QInputDialog
|
||||
from PyQt5.QtWidgets import QLineEdit
|
||||
from PyQt5.QtWidgets import QListWidgetItem
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
from PyQt5.QtWidgets import QTableWidgetItem
|
||||
|
||||
__author__ = 'MR.wen'
|
||||
|
||||
from PyQt5 import QtWidgets, QtCore
|
||||
from yixing.test import Ui_MainWindow
|
||||
from yixing.tiket import Ui_Form
|
||||
|
||||
|
||||
class myWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
_signal = QtCore.pyqtBoundSignal(str)
|
||||
|
||||
def __init__(self):
|
||||
super(myWindow, self).__init__()
|
||||
self.setupUi(self)
|
||||
self.fileOpen.triggered.connect(self.opMsg)
|
||||
self.closeFile.triggered.connect(self.close)
|
||||
self.actionTst.triggered.connect(self.childShow)
|
||||
self.pushButton_2.clicked.connect(self.call_ticket)
|
||||
|
||||
def getStr(self):
|
||||
print (self.lineEdit.text())
|
||||
self.textEdit.setText(self.lineEdit.text())
|
||||
|
||||
def call_ticket(self):
|
||||
"""
|
||||
调用添加坐席俺窗口
|
||||
:return:
|
||||
"""
|
||||
self.t = tiket()
|
||||
self.t.show()
|
||||
|
||||
def getDate(self):
|
||||
print("is ok!")
|
||||
|
||||
def opMsg(self):
|
||||
file, ok = QFileDialog.getOpenFileName(self, "打开", "C:/", "All Files (*);;Text Files (*.txt)")
|
||||
print(file)
|
||||
self.statusbar.showMessage(file)
|
||||
|
||||
def childShow(self):
|
||||
self.gridLayout.addWidget(self.child)
|
||||
print("gridLayout id ok! ")
|
||||
self.child.show()
|
||||
|
||||
|
||||
class tiket(QtWidgets.QMainWindow, Ui_Form):
|
||||
"""车票设置窗口"""
|
||||
def __init__(self):
|
||||
super(tiket, self).__init__()
|
||||
self.setWindowTitle("添加车次信息")
|
||||
self.setupUi(self)
|
||||
self.dateEdit_2.setCalendarPopup(True)
|
||||
self.tableWidget.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch) # 表格自适应窗口
|
||||
table_length = ["车次", "出发站", "到达站", "历时", "商务座", "特等座", "一等座", "二等座", "软卧", "硬卧", "软座", "无座"]
|
||||
self.tableWidget.setColumnCount(len(table_length)) # 设置表格长度
|
||||
self.tableWidget.setRowCount(10)
|
||||
self.tableWidget.setHorizontalHeaderLabels(table_length) # 设置表格行
|
||||
self.tableWidget.setSelectionBehavior(QAbstractItemView.SelectRows) # 整行选中的方式
|
||||
self.tableWidget.setSelectionMode(QAbstractItemView.ExtendedSelection) # 设置为可以选中多个目标
|
||||
newItem = QTableWidgetItem("松鼠")
|
||||
self.tableWidget.setItem(0, 0, newItem)
|
||||
|
||||
newItem = QTableWidgetItem("10cm")
|
||||
self.tableWidget.setItem(0, 1, newItem)
|
||||
|
||||
newItem = QTableWidgetItem("60g")
|
||||
self.tableWidget.setItem(0, 2, newItem)
|
||||
|
||||
newItem = QTableWidgetItem("松鼠")
|
||||
self.tableWidget.setItem(1, 0, newItem)
|
||||
|
||||
newItem = QTableWidgetItem("10cm")
|
||||
self.tableWidget.setItem(1, 1, newItem)
|
||||
|
||||
newItem = QTableWidgetItem("61g")
|
||||
self.tableWidget.setItem(1, 2, newItem)
|
||||
|
||||
self.onlySelect.clicked.connect(self.outSelect)
|
||||
|
||||
def outSelect(self, item=None):
|
||||
if item is None:
|
||||
return
|
||||
else:
|
||||
rows = self.tableWidget.currentRow
|
||||
print(rows)
|
||||
for i in range(self.tableWidget.columnCount()): # 选中行数之后,遍历改列所有数据
|
||||
print(self.tableWidget.item(rows, i).text())
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
myshow = myWindow()
|
||||
myshow.show()
|
||||
sys.exit(app.exec_())
|
|
@ -0,0 +1,32 @@
|
|||
# -*- coding: utf8 -*-
|
||||
__author__ = 'MR.wen'
|
||||
|
||||
import os
|
||||
import yaml
|
||||
|
||||
|
||||
def _get_yaml():
|
||||
"""
|
||||
解析yaml
|
||||
:return: s 字典
|
||||
"""
|
||||
path = os.path.join(os.path.dirname(__file__) + '/ticket_config.yaml')
|
||||
f = open(path)
|
||||
s = yaml.load(f)
|
||||
f.close()
|
||||
return s
|
||||
|
||||
|
||||
# def get_set_info():
|
||||
# return _get_yaml()["set"]
|
||||
#
|
||||
#
|
||||
# def get_ticke_peoples():
|
||||
# return _get_yaml()["ticke_peoples"]
|
||||
#
|
||||
#
|
||||
# def get_damatu():
|
||||
# return _get_yaml()["damatu"]
|
||||
#
|
||||
#
|
||||
# print _get_yaml()
|
|
@ -0,0 +1,31 @@
|
|||
---
|
||||
#station_date:出发日期,格式ex:2018-01-06
|
||||
#from_station: 始发站
|
||||
#to_station: 到达站
|
||||
#set_type: 坐席(商务座,二等座,特等座,软卧,硬卧,硬座,无座)
|
||||
#is_more_ticket:余票不足是否自动提交
|
||||
#select_refresh_interval:刷新间隔时间,1为一秒,0.1为100毫秒,以此类推
|
||||
#ticke_peoples: 乘客
|
||||
#damatu:打码图账号,用于自动登录
|
||||
|
||||
set:
|
||||
station_date: "2018-02-03"
|
||||
from_station: "上海"
|
||||
to_station: "长沙"
|
||||
set_type:
|
||||
- "二等座"
|
||||
# - "一等座"
|
||||
is_more_ticket: Ture
|
||||
select_refresh_interval: 0.1
|
||||
|
||||
ticke_peoples:
|
||||
- "文贤平"
|
||||
|
||||
damatu:
|
||||
uesr: ""
|
||||
pwd: ""
|
||||
|
||||
12306count:
|
||||
uesr: "931128603@qq.com"
|
||||
pwd: ""
|
||||
|
|
@ -4,7 +4,7 @@ import hashlib
|
|||
import json
|
||||
import base64
|
||||
import requests
|
||||
from myException.balanceException import balanceException
|
||||
from yixing.myException.balanceException import balanceException
|
||||
|
||||
|
||||
def md5str(str): # md5加密字符串
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
# -*- coding=utf-8 -*-
|
||||
# def fact(n):
|
||||
# print(n)
|
||||
# if n==1:
|
||||
# return 1
|
||||
# return n * fact(n - 1)
|
||||
# fact(10)
|
||||
|
||||
|
||||
def num(a, b):
|
||||
a += 1
|
||||
b -= 1
|
||||
print("a+b: {}.{}".format(a, b))
|
||||
if b is 0:
|
||||
return a, b
|
||||
return num(a, b)
|
||||
print(num(1, 1000))
|
|
@ -4,9 +4,11 @@ import random
|
|||
import json
|
||||
import re
|
||||
from time import sleep
|
||||
from yixing.config.ticketConf import _get_yaml
|
||||
|
||||
from damatuCode.damatuWeb import DamatuApi
|
||||
from myUrllib import myurllib2
|
||||
|
||||
from yixing.damatuCode.damatuWeb import DamatuApi
|
||||
from yixing.myUrllib import myurllib2
|
||||
|
||||
codeimg = 'https://kyfw.12306.cn/otn/passcodeNew/getPassCodeNew?module=login&rand=sjrand&%s' % random.random()
|
||||
|
||||
|
@ -22,11 +24,11 @@ def cookietp():
|
|||
def readImg():
|
||||
global randCode
|
||||
stoidinput("下载验证码...")
|
||||
img_path = 'd:/tkcode'
|
||||
img_path = './tkcode'
|
||||
result = myurllib2.get(codeimg)
|
||||
try:
|
||||
open(img_path, 'wb').write(result)
|
||||
randCode = DamatuApi('wenxianping', 'wen1995', img_path).main()
|
||||
randCode = DamatuApi(_get_yaml()["damatu"]["uesr"], _get_yaml()["damatu"]["pwd"], img_path).main()
|
||||
except OSError as e:
|
||||
print (e)
|
||||
pass
|
||||
|
@ -125,7 +127,7 @@ def login(user, passwd):
|
|||
fresult = json.loads(myurllib2.Post(randurl, randdata), encoding='utf8')
|
||||
checkcode = fresult['data']['msg']
|
||||
if checkcode == 'FALSE':
|
||||
errorinput("验证码有误,第%s次尝试重试".format(login_num))
|
||||
errorinput("验证码有误,第{}次尝试重试".format(login_num))
|
||||
else:
|
||||
stoidinput("验证码通过,开始登录..")
|
||||
sleep(1)
|
||||
|
@ -171,7 +173,7 @@ def getUserinfo():
|
|||
|
||||
|
||||
def main():
|
||||
login('931128603@qq.com', 'QWERTY')
|
||||
login(_get_yaml()["12306count"]["uesr"], _get_yaml()["12306count"]["pwd"])
|
||||
|
||||
|
||||
def logout():
|
||||
|
|
|
@ -6,19 +6,50 @@ import re
|
|||
import urllib
|
||||
import sys
|
||||
import time
|
||||
from myUrllib import myurllib2
|
||||
|
||||
from yixing.config.ticketConf import _get_yaml
|
||||
from yixing.myException.PassengerUserException import PassengerUserException
|
||||
from yixing.myException.ticketConfigException import ticketConfigException
|
||||
from yixing.myException.ticketIsExitsException import ticketIsExitsException
|
||||
from yixing.myUrllib import myurllib2
|
||||
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('utf-8')
|
||||
|
||||
|
||||
class select:
|
||||
def __init__(self, from_station, to_station):
|
||||
self.from_station, self.to_station = self.station_table(from_station, to_station)
|
||||
def __init__(self):
|
||||
self.from_station, self.to_station, self.station_date, self._station_seat, self.is_more_ticket, self.ticke_peoples, self.select_refresh_interval = self.get_ticket_info()
|
||||
self.order_request_params = {} # 订单提交时的参数
|
||||
self.ticketInfoForPassengerForm = {} # 初始化当前页面参数
|
||||
self.current_seats = {} # 席别信息
|
||||
self.token = ""
|
||||
self.set_type = ""
|
||||
self.user_info = ""
|
||||
self.secretStr = ""
|
||||
|
||||
def get_ticket_info(self):
|
||||
"""
|
||||
获取配置信息
|
||||
:return:
|
||||
"""
|
||||
ticket_info_config = _get_yaml()
|
||||
from_station = ticket_info_config["set"]["from_station"].encode("utf8")
|
||||
to_station = ticket_info_config["set"]["to_station"].encode("utf8")
|
||||
station_date = ticket_info_config["set"]["station_date"].encode("utf8")
|
||||
set_type = ticket_info_config["set"]["set_type"]
|
||||
is_more_ticket = ticket_info_config["set"]["is_more_ticket"].encode("utf8")
|
||||
ticke_peoples = ticket_info_config["ticke_peoples"]
|
||||
select_refresh_interval = ticket_info_config["set"]["select_refresh_interval"]
|
||||
print "*"*20
|
||||
print "当前配置:出发站:{0}\n到达站:{1}\n乘车日期:{2}\n坐席:{3}\n是否有票自动提交:{4}\n乘车人:{5}".format(from_station,
|
||||
to_station,
|
||||
station_date,
|
||||
",".join(set_type),
|
||||
is_more_ticket,
|
||||
",".join(ticke_peoples),)
|
||||
print "*"*20
|
||||
return from_station, to_station, station_date, set_type, is_more_ticket, ticke_peoples, select_refresh_interval
|
||||
|
||||
def get_order_request_params(self):
|
||||
return self.order_request_params
|
||||
|
@ -41,14 +72,14 @@ class select:
|
|||
:param seat_type:
|
||||
:return:
|
||||
"""
|
||||
seat = {32: '商务座 ',
|
||||
31: '一等座 ',
|
||||
30: '二等座 ',
|
||||
25: '特等座 ',
|
||||
23: '软卧 ',
|
||||
28: '硬卧 ',
|
||||
29: '硬座 ',
|
||||
26: '无座 '
|
||||
seat = {'商务座': 32,
|
||||
'一等座': 31,
|
||||
'二等座': 30,
|
||||
'特等座': 25,
|
||||
'软卧': 23,
|
||||
'硬卧': 28,
|
||||
'硬座': 29,
|
||||
'无座': 26,
|
||||
}
|
||||
return seat[index]
|
||||
|
||||
|
@ -63,14 +94,17 @@ class select:
|
|||
del info[0]
|
||||
station_name = {}
|
||||
for i in range(0, len(info)):
|
||||
# print info[i]
|
||||
n_info = info[i].split('|')
|
||||
station_name[n_info[1]] = n_info[2]
|
||||
from_station = station_name[from_station]
|
||||
to_station = station_name[to_station]
|
||||
from_station = station_name[from_station.encode("utf8")]
|
||||
to_station = station_name[to_station.encode("utf8")]
|
||||
return from_station, to_station
|
||||
|
||||
def time(self):
|
||||
"""
|
||||
获取日期
|
||||
:return:
|
||||
"""
|
||||
today = datetime.date.today()
|
||||
tomorrow = today+datetime.timedelta(1)
|
||||
return tomorrow.strftime('%Y-%m-%d')
|
||||
|
@ -92,11 +126,11 @@ class select:
|
|||
if re_tfpf:
|
||||
self.ticketInfoForPassengerForm = json.loads(re_tfpf[0].replace("'", '"'))
|
||||
else:
|
||||
print('车次获取信息为空')
|
||||
pass
|
||||
if re_orp:
|
||||
self.order_request_params = json.loads(re_orp[0].replace("'", '"'))
|
||||
else:
|
||||
print('订单获取信息为空')
|
||||
pass
|
||||
|
||||
def getPassengerDTOs(self):
|
||||
"""
|
||||
|
@ -111,7 +145,10 @@ class select:
|
|||
jsonData = json.loads(myurllib2.Post(get_passengerDTOs, get_data))
|
||||
if 'data' in jsonData and jsonData['data'] and 'normal_passengers' in jsonData['data'] and jsonData['data'][
|
||||
'normal_passengers']:
|
||||
return jsonData['data']['normal_passengers']
|
||||
# return jsonData['data']['normal_passengers']
|
||||
normal_passengers = jsonData['data']['normal_passengers']
|
||||
_normal_passenger = [normal_passenger for normal_passenger in normal_passengers if normal_passengers[0]["passenger_name"] in self.ticke_peoples]
|
||||
return _normal_passenger if _normal_passenger else normal_passengers[0] # 如果配置乘车人没有在账号,则默认返回第一个用户
|
||||
else:
|
||||
if 'data' in jsonData and 'exMsg' in jsonData['data'] and jsonData['data']['exMsg']:
|
||||
print(jsonData['data']['exMsg'])
|
||||
|
@ -119,64 +156,104 @@ class select:
|
|||
print(jsonData['messages'][0])
|
||||
else:
|
||||
print("未查找到常用联系人")
|
||||
raise PassengerUserException("未查找到常用联系人,请先添加联系人在试试")
|
||||
|
||||
def submitOrderRequest(self):
|
||||
"""
|
||||
提交车次信息
|
||||
:return: 车次信息,座位号
|
||||
车次对应字典
|
||||
{32: '商务座 ',
|
||||
31: '一等座 ',
|
||||
30: '二等座 ',
|
||||
25: '特等座 ',
|
||||
23: '软卧 ',
|
||||
28: '硬卧 ',
|
||||
29: '硬座 ',
|
||||
26: '无座 '
|
||||
} 参照station_seat()方法
|
||||
:return:
|
||||
"""
|
||||
from_station, to_station = self.station_table(self.from_station, self.to_station)
|
||||
select_url = 'https://kyfw.12306.cn/otn/leftTicket/queryZ?leftTicketDTO.train_date{0}&leftTicketDTO.from_station={1}&leftTicketDTO.to_station={2}&purpose_codes=ADULT'.format(self.station_date, from_station, to_station)
|
||||
leftTicketLogUrl = 'https://kyfw.12306.cn/otn/leftTicket/log?leftTicketDTO.train_date={0}&leftTicketDTO.from_station={1}&leftTicketDTO.to_station={2}&purpose_codes=ADULT'.format(self.station_date, from_station, to_station)
|
||||
leftTicketLog = json.loads(myurllib2.get(leftTicketLogUrl), encoding='utf-8')
|
||||
print leftTicketLog
|
||||
if "status" in leftTicketLog and leftTicketLog["status"] is True:
|
||||
station_ticket = json.loads(myurllib2.get(select_url), encoding='utf-8')
|
||||
value = station_ticket['data']
|
||||
if not value:
|
||||
print ('{0}-{1} 车次坐席查询为空...'.format(self.from_station, self.to_station))
|
||||
else:
|
||||
if value['result']:
|
||||
for i in value['result']:
|
||||
ticket_info = i.split('|')
|
||||
for j in range(len(self._station_seat)):
|
||||
if ticket_info[self.station_seat(self._station_seat[j].encode("utf8"))] != '' and ticket_info[self.station_seat(self._station_seat[j].encode("utf8"))] != '无': # 过滤有效目标车次
|
||||
# tiket_values = [k for k in value['map'].values()]
|
||||
self.secretStr = ticket_info[0]
|
||||
print ('车次: ' + ticket_info[3] + ' 始发车站: ' + self.to_station + ' 终点站: ' +
|
||||
self.to_station + ' ' + self._station_seat[j].encode("utf8") + ':' + ticket_info[self.station_seat(self._station_seat[j].encode("utf8"))])
|
||||
print ('正在尝试提交订票...')
|
||||
return self._station_seat[j].encode("utf8")
|
||||
else:
|
||||
pass
|
||||
print "当前车次查询无符合条件坐席,正在重新查询"
|
||||
else:
|
||||
raise ticketConfigException("车次配置信息有误,请检查")
|
||||
else:
|
||||
if "message" in leftTicketLog and leftTicketLog["message"]:
|
||||
print leftTicketLog["message"]
|
||||
elif "validateMessages" in leftTicketLog and leftTicketLog["validateMessages"]:
|
||||
print leftTicketLog["validateMessages"]
|
||||
|
||||
def check_user(self):
|
||||
"""
|
||||
检查用户是否达到订票条件
|
||||
:return:
|
||||
"""
|
||||
check_user_url = 'https://kyfw.12306.cn/otn/login/checkUser'
|
||||
data = dict(_json_att=None)
|
||||
check_user = json.loads(myurllib2.Post(check_user_url, data), encoding='utf-8')
|
||||
check_user_flag = check_user['data']['flag']
|
||||
if check_user_flag is True:
|
||||
print ('订票成功!')
|
||||
print ('尝试提交订单...')
|
||||
return True
|
||||
else:
|
||||
if check_user['messages']:
|
||||
print ('用户检查失败:%s' % check_user['messages'][0])
|
||||
else:
|
||||
print ('用户检查失败: %s' % check_user)
|
||||
|
||||
def submit_station(self):
|
||||
"""
|
||||
提交车次
|
||||
预定的请求参数,注意参数顺序
|
||||
注意这里为了防止secretStr被urllib.parse过度编码,在这里进行一次解码
|
||||
否则调用HttpTester类的post方法将会将secretStr编码成为无效码,造成提交预定请求失败
|
||||
:param self:
|
||||
:param secretStr: 提交车次加密
|
||||
:return:
|
||||
"""
|
||||
|
||||
select_url = 'https://kyfw.12306.cn/otn/leftTicket/query?' \
|
||||
'leftTicketDTO.train_date={}&leftTicketDTO.from_station={}' \
|
||||
'&leftTicketDTO.to_station={}&purpose_codes=ADULT'.format(self.time(), self.from_station, self.to_station)
|
||||
check_user_url = 'https://kyfw.12306.cn/otn/login/checkUser'
|
||||
submit_station_url = 'https://kyfw.12306.cn/otn/leftTicket/submitOrderRequest'
|
||||
station_ticket = json.loads(myurllib2.get(select_url), encoding='utf-8')
|
||||
value = station_ticket['data']
|
||||
if value.__len__() is 0:
|
||||
print ('当前车次查询为空...')
|
||||
else:
|
||||
for i in value['result']:
|
||||
ticket_info = i.split('|')
|
||||
for j in range(20, 33):
|
||||
if ticket_info[j] != '' and ticket_info[j] != '无': # 过滤有效目标车次
|
||||
print ('车次: ' + ticket_info[3] + ' 始发车站: ' + value['map']['AOH'] + ' 终点站: ' + \
|
||||
value['map']['CSQ'] + ' ' + self.station_seat(j) + ':' + ticket_info[j])
|
||||
print ('正在尝试提交订票...')
|
||||
data = dict(_json_att=None)
|
||||
check_user = json.loads(myurllib2.Post(check_user_url, data), encoding='utf-8')
|
||||
check_user_flag = check_user['data']['flag']
|
||||
if check_user_flag is True:
|
||||
print ('订票成功!')
|
||||
print ('尝试提交订单...')
|
||||
# 预定的请求参数,注意参数顺序
|
||||
# 注意这里为了防止secretStr被urllib.parse过度编码,在这里进行一次解码
|
||||
# 否则调用HttpTester类的post方法将会将secretStr编码成为无效码,造成提交预定请求失败
|
||||
data = [('secretStr', urllib.unquote(ticket_info[0])), # 字符串加密
|
||||
('train_date', self.time()), # 出发时间
|
||||
('back_train_date', self.time()), # 返程时间
|
||||
('tour_flag', 'dc'), # 旅途类型
|
||||
('purpose_codes', 'ADULT'), # 成人票还是学生票
|
||||
('query_from_station_name', self.from_station), # 起始车站
|
||||
('query_to_station_name', self.to_station), # 终点车站
|
||||
]
|
||||
submitResult = json.loads(myurllib2.Post(submit_station_url, data), encoding='utf-8')
|
||||
if 'data' in submitResult and submitResult['data']:
|
||||
if submitResult['data'] == 'N':
|
||||
print ('出票成功')
|
||||
return self.station_seat(j) # 车次信息,座位号
|
||||
else:
|
||||
print ('出票失败')
|
||||
elif 'messages' in submitResult and submitResult['messages']:
|
||||
print(submitResult['messages'][0])
|
||||
break
|
||||
else:
|
||||
if check_user['messages']:
|
||||
print ('用户检查失败:%s' % check_user['messages'][0])
|
||||
else:
|
||||
print ('用户检查失败: %s' % check_user)
|
||||
else:
|
||||
print ('未查询到有效车次,重新查询中')
|
||||
data = [('secretStr', urllib.unquote(self.secretStr)), # 字符串加密
|
||||
('train_date', self.time()), # 出发时间
|
||||
('back_train_date', self.time()), # 返程时间
|
||||
('tour_flag', 'dc'), # 旅途类型
|
||||
('purpose_codes', 'ADULT'), # 成人票还是学生票
|
||||
('query_from_station_name', self.from_station), # 起始车站
|
||||
('query_to_station_name', self.to_station), # 终点车站
|
||||
]
|
||||
submitResult = json.loads(myurllib2.Post(submit_station_url, data), encoding='utf-8')
|
||||
if 'data' in submitResult and submitResult['data']:
|
||||
if submitResult['data'] == 'N':
|
||||
print ('出票成功')
|
||||
else:
|
||||
print ('出票失败')
|
||||
elif 'messages' in submitResult and submitResult['messages']:
|
||||
print(submitResult['messages'][0])
|
||||
raise ticketIsExitsException("检查到有未支付的订单,程序自动停止")
|
||||
|
||||
def getPassengerTicketStr(self, set_type):
|
||||
"""
|
||||
|
@ -220,8 +297,10 @@ class select:
|
|||
checkOrderInfo = json.loads(myurllib2.Post(checkOrderInfoUrl, data, ))
|
||||
if 'data' in checkOrderInfo and checkOrderInfo['data']['submitStatus'] is True:
|
||||
print ('车票提交通过,正在尝试排队')
|
||||
return True
|
||||
elif 'messages' in checkOrderInfo and checkOrderInfo['messages']:
|
||||
print (checkOrderInfo['messages'])
|
||||
print ("排队失败,重新刷票中")
|
||||
|
||||
def getQueueCount(self):
|
||||
"""
|
||||
|
@ -255,6 +334,7 @@ class select:
|
|||
print("排队成功, 当前余票还剩余:" + getQueueCountResult["data"]["ticket"]+ "张")
|
||||
print("提交订单中")
|
||||
self.checkQueueOrder()
|
||||
return True
|
||||
else:
|
||||
print("正在排队,当前排队人数:" + str(countT) + "当前余票还剩余:" + getQueueCountResult["data"]["ticket"]+ "张")
|
||||
else:
|
||||
|
@ -301,7 +381,7 @@ class select:
|
|||
|
||||
def queryOrderWaitTime(self):
|
||||
"""
|
||||
排队获取订单等待信息,每隔5秒请求一次,最高请求次数为20次!
|
||||
排队获取订单等待信息,每隔3秒请求一次,最高请求次数为20次!
|
||||
:return:
|
||||
"""
|
||||
queryOrderWaitTimeUrl = "https://kyfw.12306.cn/otn/confirmPassenger/queryOrderWaitTime"
|
||||
|
@ -314,13 +394,18 @@ class select:
|
|||
while True:
|
||||
num += 1
|
||||
if num > 20:
|
||||
print("订票失败!")
|
||||
print("超出排队时间,订票失败")
|
||||
break
|
||||
queryOrderWaitTimeResult = json.loads(myurllib2.Post(queryOrderWaitTimeUrl, data))
|
||||
if "status" in queryOrderWaitTimeResult and queryOrderWaitTimeResult["status"]:
|
||||
if "orderId" in queryOrderWaitTimeResult["data"] and queryOrderWaitTimeResult["data"]["orderId"] != "null":
|
||||
print ("恭喜您订票成功,订单号为:" + queryOrderWaitTimeResult["data"]["orderId"] + ", 请立即打开浏览器登录12306,访问‘未完成订单’,在30分钟内完成支付!")
|
||||
break
|
||||
self.initNoComplete()
|
||||
orderId = self.queryMyOrderNoComplete()
|
||||
if orderId:
|
||||
print ("恭喜您订票成功,订单号为:{0}, 请立即打开浏览器登录12306,访问‘未完成订单’,在30分钟内完成支付!".format(orderId))
|
||||
break
|
||||
else:
|
||||
print("正在排队中,请耐心等待...")
|
||||
elif "msg" in queryOrderWaitTimeResult["data"] and queryOrderWaitTimeResult["data"]["msg"]:
|
||||
print("订单提交失败:" + queryOrderWaitTimeResult["data"]["msg"])
|
||||
break
|
||||
|
@ -328,15 +413,80 @@ class select:
|
|||
print("订单提交失败: " + queryOrderWaitTimeResult["messages"])
|
||||
break
|
||||
print("订单提交中,请耐心等待")
|
||||
time.sleep(5)
|
||||
time.sleep(3)
|
||||
|
||||
def queryMyOrderNoComplete(self):
|
||||
"""
|
||||
获取订单列表信息
|
||||
:return:
|
||||
"""
|
||||
queryMyOrderNoCompleteUrl = "https://kyfw.12306.cn/otn/queryOrder/queryMyOrderNoComplete"
|
||||
data = {"_json_att": None}
|
||||
queryMyOrderNoCompleteResult = json.loads(myurllib2.Post(queryMyOrderNoCompleteUrl, data))
|
||||
if "data" in queryMyOrderNoCompleteResult and queryMyOrderNoCompleteResult["data"]:
|
||||
orderId = queryMyOrderNoCompleteResult["data"]["orderDBList"][0]["sequence_no"]
|
||||
return orderId
|
||||
else:
|
||||
if "message" in queryMyOrderNoCompleteResult and queryMyOrderNoCompleteResult["message"]:
|
||||
print queryMyOrderNoCompleteResult["message"]
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
def initNoComplete(self):
|
||||
"""
|
||||
获取订单前需要进入订单列表页,获取订单列表页session
|
||||
:return:
|
||||
"""
|
||||
initNoCompleteUrl = "https://kyfw.12306.cn/otn/queryOrder/initNoComplete"
|
||||
data = {"_json_att": None}
|
||||
myurllib2.Post(initNoCompleteUrl, data)
|
||||
|
||||
# def call_submit_ticket(self, function_name=None):
|
||||
# """
|
||||
# 订票失败回调方法,默认执行submitOrderRequest()
|
||||
# 此方法暂不使用
|
||||
# :param function_name:
|
||||
# :return:
|
||||
# """
|
||||
# if function_name:
|
||||
# self.function_name()
|
||||
# else:
|
||||
# self.submitOrderRequest()
|
||||
|
||||
def main(self):
|
||||
set_type = self.submitOrderRequest()
|
||||
self.getPassengerTicketStr(set_type)
|
||||
self.getRepeatSubmitToken()
|
||||
self.user_info = self.getPassengerDTOs()
|
||||
self.checkOrderInfo()
|
||||
self.getQueueCount()
|
||||
num = 1
|
||||
while 1:
|
||||
try:
|
||||
print "正在执行第{0}次查询".format(num)
|
||||
time.sleep(self.select_refresh_interval)
|
||||
if time.strftime('%H:%M:%S', time.localtime(time.time())) > "23:00:00":
|
||||
print "12306休息时间,本程序自动停止,明天早上七点运行"
|
||||
break
|
||||
set_type = self.submitOrderRequest()
|
||||
if set_type:
|
||||
if self.check_user():
|
||||
self.submit_station()
|
||||
self.getPassengerTicketStr(set_type)
|
||||
self.getRepeatSubmitToken()
|
||||
self.user_info = self.getPassengerDTOs()
|
||||
if self.checkOrderInfo():
|
||||
if self.getQueueCount():
|
||||
break
|
||||
num += 1
|
||||
except PassengerUserException as e:
|
||||
print e.message
|
||||
break
|
||||
except ticketConfigException as e:
|
||||
print e.message
|
||||
break
|
||||
except ticketIsExitsException as e:
|
||||
print e.message
|
||||
break
|
||||
except Exception as e:
|
||||
print e.message
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
a = select('上海', '北京')
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
class PassengerUserException(Exception):
|
||||
pass
|
|
@ -0,0 +1,2 @@
|
|||
class ticketConfigException(Exception):
|
||||
pass
|
|
@ -0,0 +1,2 @@
|
|||
class ticketIsExitsException(Exception):
|
||||
pass
|
|
@ -1,10 +0,0 @@
|
|||
# -*- coding: utf8 -*-
|
||||
class a:
|
||||
def __str__(self):
|
||||
return "i am str"
|
||||
|
||||
def main(self):
|
||||
print(self)
|
||||
|
||||
b = a()
|
||||
print(b.main())
|
|
@ -1,10 +1,10 @@
|
|||
# -*- coding=utf-8 -*-
|
||||
import httplib
|
||||
import ssl
|
||||
import urllib
|
||||
import urllib2
|
||||
import sys
|
||||
from _LWPCookieJar import LWPCookieJar
|
||||
import PyQt5
|
||||
from cookielib import LWPCookieJar
|
||||
|
||||
reload(sys)
|
||||
sys.setdefaultencoding('UTF8')
|
||||
|
@ -42,15 +42,19 @@ def Post(url, data):
|
|||
request = urllib2.Request(url=url, data=urllib.urlencode(data))
|
||||
# req.add_header('User-Agent', 'Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0')
|
||||
# request = urllib2Post.Request(ajax_url, urllib.urlencode(dc))
|
||||
request.add_header("Content-Type", "application/x-www-form-urlencoded; charset=utf-8")
|
||||
request.add_header("Content-Type", "application/x-www-form-urlencoded;application/json;charset=utf-8")
|
||||
request.add_header('X-Requested-With', 'xmlHttpRequest')
|
||||
request.add_header('User-Agent',
|
||||
'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36')
|
||||
request.add_header('Referer', 'https://kyfw.12306.cn/otn/login/init')
|
||||
request.add_header('Accept', '*/*')
|
||||
# request.add_header('Accept-Encoding', 'gzip, deflate')
|
||||
result = urllib2.urlopen(request).read()
|
||||
return result
|
||||
for i in range(3):
|
||||
result = urllib2.urlopen(request).read()
|
||||
if result:
|
||||
return result
|
||||
else:
|
||||
print("返回结果为空,正在第{0}重试".format(i))
|
||||
except httplib.error as e:
|
||||
return e
|
||||
except urllib2.URLError as e:
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
beautifulsoup4==4.5.3
|
||||
bs4==0.0.1
|
||||
PyYAML==3.12
|
||||
six==1.10.0
|
|
@ -4,6 +4,6 @@ from init import login, select_ticket_info
|
|||
|
||||
def run():
|
||||
login.main()
|
||||
select_ticket_info.select('上海', '长沙').main()
|
||||
select_ticket_info.select().main()
|
||||
|
||||
run()
|
107
yixing/test.py
107
yixing/test.py
|
@ -1,107 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'test.ui'
|
||||
#
|
||||
# Created: Sun May 28 19:22:49 2017
|
||||
# by: PyQt5 UI code generator 5.3.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(836, 573)
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
|
||||
self.tabWidget.setGeometry(QtCore.QRect(11, 10, 811, 511))
|
||||
self.tabWidget.setObjectName("tabWidget")
|
||||
self.tab_4 = QtWidgets.QWidget()
|
||||
self.tab_4.setObjectName("tab_4")
|
||||
self.listView = QtWidgets.QListView(self.tab_4)
|
||||
self.listView.setGeometry(QtCore.QRect(30, 20, 661, 192))
|
||||
self.listView.setObjectName("listView")
|
||||
self.pushButton_2 = QtWidgets.QPushButton(self.tab_4)
|
||||
self.pushButton_2.setGeometry(QtCore.QRect(710, 50, 75, 23))
|
||||
self.pushButton_2.setObjectName("pushButton_2")
|
||||
self.pushButton_3 = QtWidgets.QPushButton(self.tab_4)
|
||||
self.pushButton_3.setGeometry(QtCore.QRect(710, 100, 75, 23))
|
||||
self.pushButton_3.setObjectName("pushButton_3")
|
||||
self.pushButton_4 = QtWidgets.QPushButton(self.tab_4)
|
||||
self.pushButton_4.setGeometry(QtCore.QRect(710, 150, 75, 23))
|
||||
self.pushButton_4.setObjectName("pushButton_4")
|
||||
self.plainTextEdit = QtWidgets.QPlainTextEdit(self.tab_4)
|
||||
self.plainTextEdit.setGeometry(QtCore.QRect(280, 270, 431, 71))
|
||||
self.plainTextEdit.setObjectName("plainTextEdit")
|
||||
self.textEdit = QtWidgets.QTextEdit(self.tab_4)
|
||||
self.textEdit.setGeometry(QtCore.QRect(280, 370, 431, 71))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.frame = QtWidgets.QFrame(self.tab_4)
|
||||
self.frame.setGeometry(QtCore.QRect(180, 260, 601, 191))
|
||||
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||
self.frame.setObjectName("frame")
|
||||
self.tabWidget.addTab(self.tab_4, "")
|
||||
self.tab_5 = QtWidgets.QWidget()
|
||||
self.tab_5.setObjectName("tab_5")
|
||||
self.tabWidget.addTab(self.tab_5, "")
|
||||
self.tab_3 = QtWidgets.QWidget()
|
||||
self.tab_3.setObjectName("tab_3")
|
||||
self.tabWidget.addTab(self.tab_3, "")
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 836, 23))
|
||||
self.menubar.setObjectName("menubar")
|
||||
self.menu = QtWidgets.QMenu(self.menubar)
|
||||
self.menu.setTearOffEnabled(False)
|
||||
self.menu.setObjectName("menu")
|
||||
self.menu_2 = QtWidgets.QMenu(self.menubar)
|
||||
self.menu_2.setObjectName("menu_2")
|
||||
self.menu_3 = QtWidgets.QMenu(self.menubar)
|
||||
self.menu_3.setObjectName("menu_3")
|
||||
self.menu_4 = QtWidgets.QMenu(self.menubar)
|
||||
self.menu_4.setObjectName("menu_4")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
self.fileOpen = QtWidgets.QAction(MainWindow)
|
||||
self.fileOpen.setObjectName("fileOpen")
|
||||
self.closeFile = QtWidgets.QAction(MainWindow)
|
||||
self.closeFile.setObjectName("closeFile")
|
||||
self.actionTst = QtWidgets.QAction(MainWindow)
|
||||
self.actionTst.setObjectName("actionTst")
|
||||
self.menu.addAction(self.fileOpen)
|
||||
self.menu.addAction(self.closeFile)
|
||||
self.menu.addAction(self.actionTst)
|
||||
self.menubar.addAction(self.menu.menuAction())
|
||||
self.menubar.addAction(self.menu_2.menuAction())
|
||||
self.menubar.addAction(self.menu_3.menuAction())
|
||||
self.menubar.addAction(self.menu_4.menuAction())
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
self.tabWidget.setCurrentIndex(0)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.pushButton_2.setText(_translate("MainWindow", "创建任务"))
|
||||
self.pushButton_3.setText(_translate("MainWindow", "编辑任务"))
|
||||
self.pushButton_4.setText(_translate("MainWindow", "删除任务"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), _translate("MainWindow", "Tab 2"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), _translate("MainWindow", "Page"))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("MainWindow", "Tab 1"))
|
||||
self.menu.setTitle(_translate("MainWindow", "任务"))
|
||||
self.menu_2.setTitle(_translate("MainWindow", "系统设置"))
|
||||
self.menu_3.setTitle(_translate("MainWindow", "查询订单"))
|
||||
self.menu_4.setTitle(_translate("MainWindow", "帮助"))
|
||||
self.fileOpen.setText(_translate("MainWindow", "打开"))
|
||||
self.fileOpen.setToolTip(_translate("MainWindow", "打开"))
|
||||
self.closeFile.setText(_translate("MainWindow", "关闭"))
|
||||
self.closeFile.setToolTip(_translate("MainWindow", "关闭"))
|
||||
self.actionTst.setText(_translate("MainWindow", "Tst"))
|
||||
self.actionTst.setToolTip(_translate("MainWindow", "Tst"))
|
||||
|
199
yixing/test.ui
199
yixing/test.ui
|
@ -1,199 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>836</width>
|
||||
<height>573</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>11</x>
|
||||
<y>10</y>
|
||||
<width>811</width>
|
||||
<height>511</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Tab 2</string>
|
||||
</attribute>
|
||||
<widget class="QListView" name="listView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>20</y>
|
||||
<width>661</width>
|
||||
<height>192</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>710</x>
|
||||
<y>50</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>创建任务</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>710</x>
|
||||
<y>100</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>编辑任务</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>710</x>
|
||||
<y>150</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>删除任务</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="plainTextEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>290</y>
|
||||
<width>541</width>
|
||||
<height>181</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>270</y>
|
||||
<width>91</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>显示全部日志</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>350</x>
|
||||
<y>270</y>
|
||||
<width>91</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>显示主要日志</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_5">
|
||||
<attribute name="title">
|
||||
<string>Page</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Tab 1</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>836</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menu">
|
||||
<property name="tearOffEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>任务</string>
|
||||
</property>
|
||||
<addaction name="fileOpen"/>
|
||||
<addaction name="closeFile"/>
|
||||
<addaction name="actionTst"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_2">
|
||||
<property name="title">
|
||||
<string>系统设置</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_3">
|
||||
<property name="title">
|
||||
<string>查询订单</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_4">
|
||||
<property name="title">
|
||||
<string>帮助</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menu"/>
|
||||
<addaction name="menu_2"/>
|
||||
<addaction name="menu_3"/>
|
||||
<addaction name="menu_4"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="fileOpen">
|
||||
<property name="text">
|
||||
<string>打开</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>打开</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="closeFile">
|
||||
<property name="text">
|
||||
<string>关闭</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>关闭</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTst">
|
||||
<property name="text">
|
||||
<string>Tst</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Tst</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
140
yixing/tiket.py
140
yixing/tiket.py
|
@ -1,140 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'tiket.ui'
|
||||
#
|
||||
# Created: Sun May 28 21:53:19 2017
|
||||
# by: PyQt5 UI code generator 5.3.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
class Ui_Form(object):
|
||||
def setupUi(self, Form):
|
||||
Form.setObjectName("Form")
|
||||
Form.resize(895, 563)
|
||||
self.label_6 = QtWidgets.QLabel(Form)
|
||||
self.label_6.setGeometry(QtCore.QRect(313, 34, 54, 12))
|
||||
self.label_6.setObjectName("label_6")
|
||||
self.checkBox_2 = QtWidgets.QCheckBox(Form)
|
||||
self.checkBox_2.setGeometry(QtCore.QRect(54, 67, 71, 16))
|
||||
self.checkBox_2.setObjectName("checkBox_2")
|
||||
self.lineEdit_2 = QtWidgets.QLineEdit(Form)
|
||||
self.lineEdit_2.setGeometry(QtCore.QRect(230, 30, 71, 20))
|
||||
self.lineEdit_2.setObjectName("lineEdit_2")
|
||||
self.checkBox_3 = QtWidgets.QCheckBox(Form)
|
||||
self.checkBox_3.setGeometry(QtCore.QRect(120, 68, 71, 16))
|
||||
self.checkBox_3.setObjectName("checkBox_3")
|
||||
self.checkBox_5 = QtWidgets.QCheckBox(Form)
|
||||
self.checkBox_5.setGeometry(QtCore.QRect(190, 68, 71, 16))
|
||||
self.checkBox_5.setObjectName("checkBox_5")
|
||||
self.checkBox_7 = QtWidgets.QCheckBox(Form)
|
||||
self.checkBox_7.setGeometry(QtCore.QRect(330, 68, 71, 16))
|
||||
self.checkBox_7.setObjectName("checkBox_7")
|
||||
self.label = QtWidgets.QLabel(Form)
|
||||
self.label.setGeometry(QtCore.QRect(54, 34, 54, 12))
|
||||
self.label.setObjectName("label")
|
||||
self.label_5 = QtWidgets.QLabel(Form)
|
||||
self.label_5.setGeometry(QtCore.QRect(184, 34, 54, 12))
|
||||
self.label_5.setObjectName("label_5")
|
||||
self.label_7 = QtWidgets.QLabel(Form)
|
||||
self.label_7.setGeometry(QtCore.QRect(493, 34, 54, 12))
|
||||
self.label_7.setObjectName("label_7")
|
||||
self.timeEdit = QtWidgets.QTimeEdit(Form)
|
||||
self.timeEdit.setGeometry(QtCore.QRect(553, 30, 118, 22))
|
||||
self.timeEdit.setObjectName("timeEdit")
|
||||
self.checkBox_4 = QtWidgets.QCheckBox(Form)
|
||||
self.checkBox_4.setGeometry(QtCore.QRect(260, 69, 71, 16))
|
||||
self.checkBox_4.setObjectName("checkBox_4")
|
||||
self.dateEdit_2 = QtWidgets.QDateEdit(Form)
|
||||
self.dateEdit_2.setGeometry(QtCore.QRect(373, 30, 110, 22))
|
||||
self.dateEdit_2.setObjectName("dateEdit_2")
|
||||
self.checkBox = QtWidgets.QCheckBox(Form)
|
||||
self.checkBox.setGeometry(QtCore.QRect(682, 33, 121, 16))
|
||||
self.checkBox.setObjectName("checkBox")
|
||||
self.pushButton_2 = QtWidgets.QPushButton(Form)
|
||||
self.pushButton_2.setGeometry(QtCore.QRect(770, 69, 75, 23))
|
||||
self.pushButton_2.setObjectName("pushButton_2")
|
||||
self.lineEdit = QtWidgets.QLineEdit(Form)
|
||||
self.lineEdit.setGeometry(QtCore.QRect(100, 30, 71, 20))
|
||||
self.lineEdit.setObjectName("lineEdit")
|
||||
self.tableWidget = QtWidgets.QTableWidget(Form)
|
||||
self.tableWidget.setGeometry(QtCore.QRect(50, 130, 791, 251))
|
||||
self.tableWidget.setObjectName("tableWidget")
|
||||
self.tableWidget.setColumnCount(12)
|
||||
self.tableWidget.setRowCount(0)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(1, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(2, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(3, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(4, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(5, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(6, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(7, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(8, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(9, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(10, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.tableWidget.setHorizontalHeaderItem(11, item)
|
||||
self.allSelect = QtWidgets.QPushButton(Form)
|
||||
self.allSelect.setGeometry(QtCore.QRect(50, 390, 81, 23))
|
||||
self.allSelect.setObjectName("allSelect")
|
||||
self.onlySelect = QtWidgets.QPushButton(Form)
|
||||
self.onlySelect.setGeometry(QtCore.QRect(150, 390, 75, 23))
|
||||
self.onlySelect.setObjectName("onlySelect")
|
||||
|
||||
self.retranslateUi(Form)
|
||||
QtCore.QMetaObject.connectSlotsByName(Form)
|
||||
|
||||
def retranslateUi(self, Form):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Form.setWindowTitle(_translate("Form", "Form"))
|
||||
self.label_6.setText(_translate("Form", "出发日期:"))
|
||||
self.checkBox_2.setText(_translate("Form", "G-高铁"))
|
||||
self.checkBox_3.setText(_translate("Form", "D-动车"))
|
||||
self.checkBox_5.setText(_translate("Form", "Z-直达"))
|
||||
self.checkBox_7.setText(_translate("Form", "K-快速"))
|
||||
self.label.setText(_translate("Form", "出发地:"))
|
||||
self.label_5.setText(_translate("Form", "目的地:"))
|
||||
self.label_7.setText(_translate("Form", "出发时间:"))
|
||||
self.checkBox_4.setText(_translate("Form", "T-特快"))
|
||||
self.checkBox.setText(_translate("Form", "仅显示可预订车次"))
|
||||
self.pushButton_2.setText(_translate("Form", "自动查询"))
|
||||
item = self.tableWidget.horizontalHeaderItem(0)
|
||||
item.setText(_translate("Form", "车次"))
|
||||
item = self.tableWidget.horizontalHeaderItem(1)
|
||||
item.setText(_translate("Form", "出发站"))
|
||||
item = self.tableWidget.horizontalHeaderItem(2)
|
||||
item.setText(_translate("Form", "到达站"))
|
||||
item = self.tableWidget.horizontalHeaderItem(3)
|
||||
item.setText(_translate("Form", "历时"))
|
||||
item = self.tableWidget.horizontalHeaderItem(4)
|
||||
item.setText(_translate("Form", "商务座"))
|
||||
item = self.tableWidget.horizontalHeaderItem(5)
|
||||
item.setText(_translate("Form", "特等座"))
|
||||
item = self.tableWidget.horizontalHeaderItem(6)
|
||||
item.setText(_translate("Form", "一等座"))
|
||||
item = self.tableWidget.horizontalHeaderItem(7)
|
||||
item.setText(_translate("Form", "二等座"))
|
||||
item = self.tableWidget.horizontalHeaderItem(8)
|
||||
item.setText(_translate("Form", "软卧"))
|
||||
item = self.tableWidget.horizontalHeaderItem(9)
|
||||
item.setText(_translate("Form", "硬卧"))
|
||||
item = self.tableWidget.horizontalHeaderItem(10)
|
||||
item.setText(_translate("Form", "软座"))
|
||||
item = self.tableWidget.horizontalHeaderItem(11)
|
||||
item.setText(_translate("Form", "无座"))
|
||||
self.allSelect.setText(_translate("Form", "全部选中提交"))
|
||||
self.onlySelect.setText(_translate("Form", "仅选中提交"))
|
||||
|
298
yixing/tiket.ui
298
yixing/tiket.ui
|
@ -1,298 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>895</width>
|
||||
<height>563</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>313</x>
|
||||
<y>34</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>出发日期:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>54</x>
|
||||
<y>67</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>G-高铁</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>30</y>
|
||||
<width>71</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>68</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>D-动车</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>190</x>
|
||||
<y>68</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Z-直达</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>330</x>
|
||||
<y>68</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>K-快速</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>54</x>
|
||||
<y>34</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>出发地:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>184</x>
|
||||
<y>34</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>目的地:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>493</x>
|
||||
<y>34</y>
|
||||
<width>54</width>
|
||||
<height>12</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>出发时间:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTimeEdit" name="timeEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>553</x>
|
||||
<y>30</y>
|
||||
<width>118</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>69</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>T-特快</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QDateEdit" name="dateEdit_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>373</x>
|
||||
<y>30</y>
|
||||
<width>110</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>682</x>
|
||||
<y>33</y>
|
||||
<width>121</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>仅显示可预订车次</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>770</x>
|
||||
<y>69</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>自动查询</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>30</y>
|
||||
<width>71</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>130</y>
|
||||
<width>791</width>
|
||||
<height>251</height>
|
||||
</rect>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>车次</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>出发站</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>到达站</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>历时</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>商务座</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>特等座</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>一等座</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>二等座</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>软卧</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>硬卧</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>软座</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>无座</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="allSelect">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>390</y>
|
||||
<width>81</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>全部选中提交</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="onlySelect">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>390</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>仅选中提交</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue