删除 expect_refresh_interval 无用字段,优化代码

pull/29/head
wenxianping 2018-01-25 15:52:36 +08:00
parent 01d54be85a
commit 0bdccd4526
4 changed files with 21 additions and 26 deletions

View File

@ -189,5 +189,7 @@
- 修复bug - 修复bug
- 优化抢票功能 - 优化抢票功能
- 2018.1.25更新
- 删除 expect_refresh_interval 无用字段,优化代码

View File

@ -38,21 +38,18 @@
# password: "授权码" # password: "授权码"
# host: "smtp.qq.com" # host: "smtp.qq.com"
set: set:
station_dates: station_dates:
# - "2018-01-27" - "2018-02-22"
# - "2018-01-28" - "2018-02-21"
- "2018-02-09"
- "2018-02-10"
# - "2018-02-09"
station_trains: station_trains:
- "G4741" - "G2366"
- "G2365" # - "G2365"
- "G1371" # - "G1371"
- "G1337" # - "G1337"
- "G1377" # - "G1377"
- "G1329" # - "G1329"
# - "G1302" # - "G1302"
# - "G1372" # - "G1372"
# - "G1326" # - "G1326"
@ -65,8 +62,8 @@ set:
# - "G1373" # - "G1373"
# - "G1363" # - "G1363"
# - "G4933" # - "G4933"
from_station: "上海" from_station: "邵阳"
to_station: "邵阳" to_station: "上海"
set_type: set_type:
- "二等座" - "二等座"
is_more_ticket: True is_more_ticket: True
@ -76,25 +73,24 @@ set:
12306count: 12306count:
# - uesr: "" # - uesr: ""
# - pwd: "apple1995" # - pwd: "apple1995"
- uesr: "931128603@qq.com" - uesr: "@qq.com"
- pwd: "QWERTY" - pwd: "QWERTY"
select_refresh_interval: 0.5 select_refresh_interval: 1
expect_refresh_interval: 0.1
ticket_black_list_time: 3 ticket_black_list_time: 3
is_aotu_code: True is_aotu_code: True
aotu_code_type: 2 aotu_code_type: 2
#enable_proxy: False #enable_proxy: False
damatu: damatu:
uesr: "931128603" uesr: ""
pwd: "qazWSX1995" pwd: "qazWSX1995"
email_conf: email_conf:
is_email: True is_email: True
email: "931128603@qq.com " email: "@qq.com "
notice_email_list: "61995120@qq.com" notice_email_list: "61995120@qq.com"
username: "931128603" username: ""
password: "xwopwxbkupbqbfgb" password: "xwopwxbkupbqbfgb"
host: "smtp.qq.com" host: "smtp.qq.com"

View File

@ -26,7 +26,7 @@ sys.setdefaultencoding('utf-8')
class select: class select:
def __init__(self): def __init__(self):
self.from_station, self.to_station, self.station_dates, self._station_seat, self.is_more_ticket, self.ticke_peoples, self.select_refresh_interval, self.station_trains, self.expect_refresh_interval, self.ticket_black_list_time = self.get_ticket_info() self.from_station, self.to_station, self.station_dates, self._station_seat, self.is_more_ticket, self.ticke_peoples, self.select_refresh_interval, self.station_trains, self.ticket_black_list_time = self.get_ticket_info()
self.is_aotu_code = _get_yaml()["is_aotu_code"] self.is_aotu_code = _get_yaml()["is_aotu_code"]
self.aotu_code_type = _get_yaml()["aotu_code_type"] self.aotu_code_type = _get_yaml()["aotu_code_type"]
self.order_request_params = {} # 订单提交时的参数 self.order_request_params = {} # 订单提交时的参数
@ -56,10 +56,9 @@ class select:
ticke_peoples = ticket_info_config["set"]["ticke_peoples"] ticke_peoples = ticket_info_config["set"]["ticke_peoples"]
select_refresh_interval = ticket_info_config["select_refresh_interval"] select_refresh_interval = ticket_info_config["select_refresh_interval"]
station_trains = ticket_info_config["set"]["station_trains"] station_trains = ticket_info_config["set"]["station_trains"]
expect_refresh_interval = ticket_info_config["expect_refresh_interval"]
ticket_black_list_time = ticket_info_config["ticket_black_list_time"] ticket_black_list_time = ticket_info_config["ticket_black_list_time"]
print "*"*20 print "*"*20
print "当前配置:出发站:{0}\n到达站:{1}\n乘车日期:{2}\n坐席:{3}\n是否有票自动提交:{4}\n乘车人:{5}\n刷新间隔:{6}\n候选购买车次:{7}\n未开始刷票间隔时间:{8}\n僵尸票关小黑屋时长:{9}\n".format\ print "当前配置:出发站:{0}\n到达站:{1}\n乘车日期:{2}\n坐席:{3}\n是否有票自动提交:{4}\n乘车人:{5}\n刷新间隔:{6}\n候选购买车次:{7}\n僵尸票关小黑屋时长:{8}\n".format\
( (
from_station, from_station,
to_station, to_station,
@ -69,11 +68,10 @@ class select:
",".join(ticke_peoples), ",".join(ticke_peoples),
select_refresh_interval, select_refresh_interval,
",".join(station_trains), ",".join(station_trains),
expect_refresh_interval,
ticket_black_list_time, ticket_black_list_time,
) )
print "*"*20 print "*"*20
return from_station, to_station, station_dates, set_type, is_more_ticket, ticke_peoples, select_refresh_interval, station_trains, expect_refresh_interval, ticket_black_list_time return from_station, to_station, station_dates, set_type, is_more_ticket, ticke_peoples, select_refresh_interval, station_trains, ticket_black_list_time
def get_order_request_params(self): def get_order_request_params(self):
return self.order_request_params return self.order_request_params
@ -240,7 +238,6 @@ class select:
pass pass
else: else:
pass pass
time.sleep(self.expect_refresh_interval)
else: else:
print "车次配置信息有误,或者返回数据异常,请检查 {}".format(station_ticket) print "车次配置信息有误,或者返回数据异常,请检查 {}".format(station_ticket)

BIN
tkcode

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 11 KiB