Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
王景浩
zzsn_spider
Commits
8a9ce091
提交
8a9ce091
authored
9月 11, 2023
作者:
薛凌堃
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
天眼查企业动态增量采集维护
上级
27dc9aa3
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
10 行增加
和
7 行删除
+10
-7
getTycId.py
comData/tcyQydt/getTycId.py
+6
-5
tyc_qydt_add.py
comData/tcyQydt/tyc_qydt_add.py
+4
-2
没有找到文件。
comData/tcyQydt/getTycId.py
浏览文件 @
8a9ce091
...
@@ -27,7 +27,7 @@ cursor= cnx.cursor()
...
@@ -27,7 +27,7 @@ cursor= cnx.cursor()
#根据信用代码获取天眼查id 企业名字等信息
#根据信用代码获取天眼查id 企业名字等信息
def
getTycIdByXYDM
(
xydm
):
def
getTycIdByXYDM
(
xydm
):
retData
=
{
'state'
:
False
,
'tycData'
:
None
}
retData
=
{
'state'
:
False
,
'tycData'
:
None
,
'reput'
:
True
}
url
=
f
"https://capi.tianyancha.com/cloud-tempest/search/suggest/v3?_={baseCore.getNowTime(3)}"
url
=
f
"https://capi.tianyancha.com/cloud-tempest/search/suggest/v3?_={baseCore.getNowTime(3)}"
ip
=
baseCore
.
get_proxy
()
ip
=
baseCore
.
get_proxy
()
paramJsonData
=
{
'keyword'
:
xydm
}
paramJsonData
=
{
'keyword'
:
xydm
}
...
@@ -41,20 +41,21 @@ def getTycIdByXYDM(xydm):
...
@@ -41,20 +41,21 @@ def getTycIdByXYDM(xydm):
pass
pass
else
:
else
:
log
.
error
(
f
"---{xydm}-未查询到该企业---"
)
log
.
error
(
f
"---{xydm}-未查询到该企业---"
)
return
retData
[
'tycData'
]
retData
[
'reput'
]
=
False
return
retData
matchType
=
retJsonData
[
'data'
][
0
][
'matchType'
]
matchType
=
retJsonData
[
'data'
][
0
][
'matchType'
]
if
matchType
==
'信用代码匹配'
:
if
matchType
==
'信用代码匹配'
:
retData
[
'state'
]
=
True
retData
[
'state'
]
=
True
retData
[
'tycData'
]
=
retJsonData
[
'data'
][
0
]
retData
[
'tycData'
]
=
retJsonData
[
'data'
][
0
]
response
.
close
()
response
.
close
()
return
retData
[
'tycData'
]
return
retData
else
:
else
:
log
.
error
(
f
"{xydm}------{retJsonData}"
)
log
.
error
(
f
"{xydm}------{retJsonData}"
)
response
.
close
()
response
.
close
()
return
retData
[
'tycData'
]
return
retData
except
:
except
:
log
.
error
(
f
"---{xydm}--天眼查token失效---"
)
log
.
error
(
f
"---{xydm}--天眼查token失效---"
)
return
retData
[
'tycData'
]
return
retData
# 更新天眼查企业基本信息
# 更新天眼查企业基本信息
...
...
comData/tcyQydt/tyc_qydt_add.py
浏览文件 @
8a9ce091
...
@@ -282,19 +282,21 @@ def doJob():
...
@@ -282,19 +282,21 @@ def doJob():
if
tycid
==
None
or
tycid
==
''
:
if
tycid
==
None
or
tycid
==
''
:
try
:
try
:
retData
=
getTycIdByXYDM
(
xydm
)
retData
=
getTycIdByXYDM
(
xydm
)
if
retData
:
if
retData
[
'tycData'
]
and
retData
[
'reput'
]
:
tycid
=
retData
[
'id'
]
tycid
=
retData
[
'id'
]
# todo:写入数据库
# todo:写入数据库
updateSql
=
f
"update EnterpriseInfo set TYCID = '{tycid}' where SocialCode = '{xydm}'"
updateSql
=
f
"update EnterpriseInfo set TYCID = '{tycid}' where SocialCode = '{xydm}'"
cursor_
.
execute
(
updateSql
)
cursor_
.
execute
(
updateSql
)
cnx_
.
commit
()
cnx_
.
commit
()
el
se
:
el
if
not
retData
[
'tycData'
]
and
retData
[
'reput'
]
:
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失败'
)
log
.
info
(
f
'======={social_code}====重新放入redis===='
)
log
.
info
(
f
'======={social_code}====重新放入redis===='
)
baseCore
.
rePutIntoR
(
'NewsEnterprise:gnqy_socialCode'
,
social_code
)
baseCore
.
rePutIntoR
(
'NewsEnterprise:gnqy_socialCode'
,
social_code
)
continue
continue
elif
not
retData
[
'reput'
]
and
not
retData
[
'tycData'
]:
continue
except
:
except
:
state
=
0
state
=
0
takeTime
=
baseCore
.
getTimeCost
(
start
,
time
.
time
())
takeTime
=
baseCore
.
getTimeCost
(
start
,
time
.
time
())
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论