Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
janlyn06
12306
提交
aa546ac6
1
12306
项目概览
janlyn06
/
12306
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
1
12306
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
aa546ac6
编写于
1月 24, 2019
作者:
W
wenxianping
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改时间兼容性
上级
35ec27b7
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
34 addition
and
25 deletion
+34
-25
config/configCommon.py
config/configCommon.py
+30
-21
init/select_ticket_info.py
init/select_ticket_info.py
+3
-3
inter/Query.py
inter/Query.py
+1
-1
未找到文件。
config/configCommon.py
浏览文件 @
aa546ac6
...
@@ -5,13 +5,17 @@ import random
...
@@ -5,13 +5,17 @@ import random
import
sys
import
sys
import
time
import
time
saleMinDelayDay
=
0
from
myException.ticketConfigException
import
ticketConfigException
saleMaxDelayDay
=
59
saleStartTime
=
"06:00:00"
saleStopTime
=
"23:00:00"
rushRefreshMinTimeIntval
=
2000
rushRefreshMinTimeIntval
=
2000
rushRefreshMaxTimeIntval
=
3600000
rushRefreshMaxTimeIntval
=
3600000
rushRefreshTimeIntval
=
100
rushRefreshTimeIntval
=
100
# 最早运行时间
maxRunTime
=
7
# 程序停止时间
maxRunStopTime
=
23
# 可售天数
maxDate
=
29
RS_SUC
=
0
RS_SUC
=
0
RS_TIMEOUT
=
1
RS_TIMEOUT
=
1
...
@@ -39,22 +43,6 @@ def getNowTimestamp():
...
@@ -39,22 +43,6 @@ def getNowTimestamp():
return
time
.
time
()
return
time
.
time
()
def
getMinimumDate
():
return
time
.
localtime
(
getNowTimestamp
()
+
saleMinDelayDay
*
24
*
3600
)[:
3
]
def
getMaximumDate
():
return
time
.
localtime
(
getNowTimestamp
()
+
saleMaxDelayDay
*
24
*
3600
)[:
3
]
def
getMinimumTime
():
return
[
int
(
x
)
for
x
in
saleStartTime
.
split
(
":"
)]
def
getMaximumTime
():
return
[
int
(
x
)
for
x
in
saleStopTime
.
split
(
":"
)]
def
decMakeDir
(
func
):
def
decMakeDir
(
func
):
def
handleFunc
(
*
args
,
**
kwargs
):
def
handleFunc
(
*
args
,
**
kwargs
):
dirname
=
func
(
*
args
,
**
kwargs
)
dirname
=
func
(
*
args
,
**
kwargs
)
...
@@ -117,10 +105,31 @@ def getCacheFile(cacheType):
...
@@ -117,10 +105,31 @@ def getCacheFile(cacheType):
def
checkSleepTime
(
session
):
def
checkSleepTime
(
session
):
now
=
datetime
.
datetime
.
now
()
now
=
datetime
.
datetime
.
now
()
if
now
.
hour
>=
23
or
now
.
hour
<
7
:
if
now
.
hour
>=
maxRunStopTime
or
now
.
hour
<
maxRunTime
:
print
(
u
"12306休息时间,本程序自动停止,明天早上六点将自动运行"
)
print
(
u
"12306休息时间,本程序自动停止,明天早上六点将自动运行"
)
open_time
=
datetime
.
datetime
(
now
.
year
,
now
.
month
,
now
.
day
,
7
)
open_time
=
datetime
.
datetime
(
now
.
year
,
now
.
month
,
now
.
day
,
7
)
if
open_time
<
now
:
if
open_time
<
now
:
open_time
+=
datetime
.
timedelta
(
1
)
open_time
+=
datetime
.
timedelta
(
1
)
time
.
sleep
((
open_time
-
now
).
seconds
+
round
(
random
.
uniform
(
1
,
10
)))
time
.
sleep
((
open_time
-
now
).
seconds
+
round
(
random
.
uniform
(
1
,
10
)))
session
.
call_login
()
session
.
call_login
()
def
checkDate
(
station_dates
):
"""
检查日期是否合法
:param station_dates:
:return:
"""
today
=
datetime
.
datetime
.
now
()
maxDay
=
(
today
+
datetime
.
timedelta
(
maxDate
)).
strftime
(
"%Y-%m-%d"
)
for
station_date
in
station_dates
[::
-
1
]:
date
=
datetime
.
datetime
.
strftime
(
datetime
.
datetime
.
strptime
(
station_date
,
"%Y-%m-%d"
),
"%Y-%m-%d"
)
if
date
<
today
.
strftime
(
"%Y-%m-%d"
)
or
date
>
maxDay
:
print
(
u
"警告:当前时间配置有小于当前时间或者大于最大时间: {}, 已自动忽略"
.
format
(
station_date
))
station_dates
.
remove
(
station_date
)
if
not
station_dates
:
print
(
u
"当前日期设置无符合查询条件的,已被全部删除,请查证后添加!!!"
)
raise
ticketConfigException
(
u
"当前日期设置无符合查询条件的,已被全部删除,请查证后添加!!!"
)
else
:
station_dates
[
station_dates
.
index
(
station_date
)]
=
date
return
station_dates
init/select_ticket_info.py
浏览文件 @
aa546ac6
...
@@ -12,8 +12,7 @@ import wrapcache
...
@@ -12,8 +12,7 @@ import wrapcache
from
agency.cdn_utils
import
CDNProxy
from
agency.cdn_utils
import
CDNProxy
from
config
import
urlConf
,
configCommon
from
config
import
urlConf
,
configCommon
from
config.TicketEnmu
import
ticket
from
config.TicketEnmu
import
ticket
from
config.configCommon
import
seat_conf
from
config.configCommon
import
seat_conf
,
checkDate
,
seat_conf_2
from
config.configCommon
import
seat_conf_2
from
config.ticketConf
import
_get_yaml
from
config.ticketConf
import
_get_yaml
from
init.login
import
GoLogin
from
init.login
import
GoLogin
from
inter.AutoSubmitOrderRequest
import
autoSubmitOrderRequest
from
inter.AutoSubmitOrderRequest
import
autoSubmitOrderRequest
...
@@ -67,7 +66,8 @@ class select:
...
@@ -67,7 +66,8 @@ class select:
ticket_info_config
=
_get_yaml
()
ticket_info_config
=
_get_yaml
()
from_station
=
ticket_info_config
[
"set"
][
"from_station"
]
from_station
=
ticket_info_config
[
"set"
][
"from_station"
]
to_station
=
ticket_info_config
[
"set"
][
"to_station"
]
to_station
=
ticket_info_config
[
"set"
][
"to_station"
]
station_dates
=
ticket_info_config
[
"set"
][
"station_dates"
]
station_dates
=
checkDate
(
ticket_info_config
[
"set"
][
"station_dates"
])
set_names
=
ticket_info_config
[
"set"
][
"set_type"
]
set_names
=
ticket_info_config
[
"set"
][
"set_type"
]
try
:
try
:
set_type
=
[
seat_conf
[
x
.
encode
(
"utf-8"
)]
for
x
in
ticket_info_config
[
"set"
][
"set_type"
]]
set_type
=
[
seat_conf
[
x
.
encode
(
"utf-8"
)]
for
x
in
ticket_info_config
[
"set"
][
"set_type"
]]
...
...
inter/Query.py
浏览文件 @
aa546ac6
...
@@ -144,7 +144,7 @@ class query:
...
@@ -144,7 +144,7 @@ class query:
else
:
else
:
print
(
u
"设置乘车人数为: {}"
.
format
(
self
.
ticke_peoples_num
))
print
(
u
"设置乘车人数为: {}"
.
format
(
self
.
ticke_peoples_num
))
is_more_ticket_num
=
self
.
ticke_peoples_num
is_more_ticket_num
=
self
.
ticke_peoples_num
print
(
ticket
.
QUERY_C
)
print
(
ticket
.
QUERY_C
)
return
{
return
{
"secretStr"
:
secretStr
,
"secretStr"
:
secretStr
,
"train_no"
:
train_no
,
"train_no"
:
train_no
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录