Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
王景浩
zzsn_spider
Commits
c0830237
提交
c0830237
authored
8月 24, 2023
作者:
薛凌堃
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
微信公众号
上级
540a101a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
165 行增加
和
10 行删除
+165
-10
fbs_tyc_qydt.py
comData/tcyQydt/fbs_tyc_qydt.py
+0
-0
tyc_qydt_add.py
comData/tcyQydt/tyc_qydt_add.py
+14
-10
test.py
test.py
+151
-0
没有找到文件。
comData/tcyQydt/fbs_tyc_qydt.py
浏览文件 @
c0830237
差异被折叠。
点击展开。
comData/tcyQydt/tyc_qydt_add.py
浏览文件 @
c0830237
...
@@ -149,7 +149,7 @@ def beinWork(tyc_code, social_code,start_time):
...
@@ -149,7 +149,7 @@ def beinWork(tyc_code, social_code,start_time):
return
retData
return
retData
try
:
try
:
time_struct
=
time
.
localtime
(
int
(
info_page
[
'rtm'
]
/
1000
))
# 首先把时间戳转换为结构化时间
time_struct
=
time
.
localtime
(
int
(
info_page
[
'rtm'
]
/
1000
))
# 首先把时间戳转换为结构化时间
time_format
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H
-
%
M-
%
S"
,
time_struct
)
# 把结构化时间转换为格式化时间
time_format
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H
:
%
M:
%
S"
,
time_struct
)
# 把结构化时间转换为格式化时间
except
:
except
:
time_format
=
baseCore
.
getNowTime
(
1
)
time_format
=
baseCore
.
getNowTime
(
1
)
try
:
try
:
...
@@ -270,20 +270,24 @@ def beinWork(tyc_code, social_code,start_time):
...
@@ -270,20 +270,24 @@ def beinWork(tyc_code, social_code,start_time):
return
retData
return
retData
# 日志信息保存至现已创建好数据库中,因此并没有再对此前保存日志信息数据库进行保存
# 日志信息保存至现已创建好数据库中,因此并没有再对此前保存日志信息数据库进行保存
def
doJob
():
def
doJob
():
while
True
:
while
True
:
# 根据从Redis中拿到的社会信用代码,在数据库中获取对应基本信息
# 根据从Redis中拿到的社会信用代码,在数据库中获取对应基本信息
social_code
=
baseCore
.
redicPullData
(
'NewsEnterprise:gnqy_socialCode'
)
social_code
=
baseCore
.
redicPullData
(
'NewsEnterprise:gnqy_socialCode'
)
# 判断 如果Redis中已经没有数据,则等待
# 判断 如果Redis中已经没有数据,则等待
if
social_code
==
'None'
:
if
social_code
==
None
:
time
.
sleep
(
20
)
time
.
sleep
(
20
)
continue
continue
start
=
time
.
time
()
start
=
time
.
time
()
try
:
try
:
data
=
baseCore
.
getInfomation
(
social_code
)
data
=
baseCore
.
getInfomation
(
social_code
)
if
len
(
data
)
!=
0
:
pass
else
:
#数据重新塞入redis
baseCore
.
rePutIntoR
(
'NewsEnterprise:gnqy_socialCode'
,
social_code
)
continue
id
=
data
[
0
]
id
=
data
[
0
]
xydm
=
data
[
2
]
xydm
=
data
[
2
]
tycid
=
data
[
11
]
tycid
=
data
[
11
]
...
@@ -299,7 +303,7 @@ def doJob():
...
@@ -299,7 +303,7 @@ def doJob():
state
=
0
state
=
0
takeTime
=
baseCore
.
getTimeCost
(
start
,
time
.
time
())
takeTime
=
baseCore
.
getTimeCost
(
start
,
time
.
time
())
baseCore
.
recordLog
(
social_code
,
taskType
,
state
,
takeTime
,
''
,
'获取天眼查id失败'
)
baseCore
.
recordLog
(
social_code
,
taskType
,
state
,
takeTime
,
''
,
'获取天眼查id失败'
)
baseCore
.
rePutIntoR
(
social_code
)
baseCore
.
rePutIntoR
(
'NewsEnterprise:gnqy_socialCode'
,
social_code
)
continue
continue
count
=
data
[
17
]
count
=
data
[
17
]
log
.
info
(
f
"{id}---{xydm}----{tycid}----开始处理"
)
log
.
info
(
f
"{id}---{xydm}----{tycid}----开始处理"
)
...
@@ -321,20 +325,20 @@ def doJob():
...
@@ -321,20 +325,20 @@ def doJob():
up_repetCount
=
retData
[
'up_repetCount'
]
up_repetCount
=
retData
[
'up_repetCount'
]
log
.
info
(
log
.
info
(
f
"{id}---{xydm}----{tycid}----结束处理,耗时{baseCore.getTimeCost(start_time, time.time())}---总数:{total}---成功数:{up_okCount}----失败数:{up_errorCount}--重复数:{up_repetCount}"
)
f
"{id}---{xydm}----{tycid}----结束处理,耗时{baseCore.getTimeCost(start_time, time.time())}---总数:{total}---成功数:{up_okCount}----失败数:{up_errorCount}--重复数:{up_repetCount}"
)
except
:
except
Exception
as
e
:
log
.
info
(
f
'==={social_code}=====获取企业信息失败===='
)
log
.
info
(
f
'==={social_code}=====获取企业信息失败===='
)
#重新塞入redis
baseCore
.
rePutIntoR
(
'NewsEnterprise:gnqy_socialCode'
,
social_code
)
state
=
0
state
=
0
takeTime
=
baseCore
.
getTimeCost
(
start
,
time
.
time
())
takeTime
=
baseCore
.
getTimeCost
(
start
,
time
.
time
())
baseCore
.
recordLog
(
social_code
,
taskType
,
state
,
takeTime
,
''
,
'获取企业信息失败
'
)
baseCore
.
recordLog
(
social_code
,
taskType
,
state
,
takeTime
,
''
,
f
'获取企业信息失败--{e}
'
)
time
.
sleep
(
5
)
cursor
.
close
()
cursor
.
close
()
cnx
.
close
()
cnx
.
close
()
# 释放资源
# 释放资源
baseCore
.
close
()
baseCore
.
close
()
# Press the green button in the gutter to run the script.
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
doJob
()
doJob
()
...
...
test.py
0 → 100644
浏览文件 @
c0830237
from
base
import
BaseCore
# 根据从Redis中拿到的社会信用代码,在数据库中获取对应基本信息
import
time
baseCore
=
BaseCore
.
BaseCore
()
# log = baseCore.getLogger()
r
=
baseCore
.
r
# social_code = baseCore.redicPullData('NewsEnterprise:gwqy_socialCode')
#
# # 判断 如果Redis中已经没有数据,则等待
# if not social_code:
#
# print('1:')
# if social_code == 'None':
#
# print('2')
#
# if social_code == None:
# print('3:')
#9131000010000595XD 91100000100003962T
# item = '91110000101690725E'
item
=
'91100000100003962T'
list
=
[
'86'
,
'122'
,
'142'
,
'168'
,
'270'
,
'282'
,
'364'
,
'407'
,
'416'
,
'563'
,
'566'
,
'588'
,
'595'
,
'597'
,
'737'
,
'750'
,
'810'
,
'838'
,
'860'
,
'875'
,
'885'
,
'886'
,
'1003'
,
'1250'
,
'1272'
,
'1362'
,
'1379'
,
'1381'
,
'1382'
,
'1392'
,
'1476'
,
'1583'
,
'1639'
,
'1748'
,
'1764'
,
'1775'
,
'1801'
,
'1839'
,
'2018'
,
'2260'
,
'2356'
,
'2471'
,
'2563'
,
'2703'
,
'2800'
,
'2815'
,
'2934'
,
'3162'
,
'3376'
,
'3474'
,
'3737'
,
'3782'
,
'3939'
,
'4118'
,
'4509'
,
'4675'
,
'4801'
,
'4818'
,
'4943'
,
'5149'
,
'5195'
,
'5429'
,
'7023'
,
'7025'
,
'7026'
,
'7039'
,
'7053'
,
'7058'
,
'7059'
,
'7060'
,
'7062'
,
'7066'
,
'7067'
,
'7069'
,
'7073'
,
'7077'
,
'7083'
,
'7091'
,
'7095'
,
'7103'
,
'7105'
,
'7107'
,
'7109'
,
'7110'
,
'7113'
,
'7131'
,
'7135'
,
'7136'
,
'7138'
,
'7140'
,
'7141'
,
'7142'
,
'7143'
,
'7144'
,
'7145'
,
'7147'
,
'7150'
,
'7151'
,
'7152'
,
'7156'
,
'7157'
,
'7160'
,
'7162'
,
'7165'
,
'7169'
,
'7174'
,
'7180'
,
'7187'
,
'7193'
,
'7197'
,
'7198'
,
'7199'
,
'7201'
,
'7202'
,
'7203'
,
'7204'
,
'7205'
,
'7206'
,
'7208'
,
'7209'
,
'7211'
,
'7212'
,
'7213'
,
'7214'
]
for
item
in
list
:
r
.
rpush
(
'NewsEnterpriseFbs:gnqy_socialCode'
,
item
)
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论