Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
丁双波
zzsn_spider
Commits
fe8ddd44
提交
fe8ddd44
authored
8月 25, 2023
作者:
薛凌堃
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
企业基本信息
上级
95687128
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
22 行增加
和
13 行删除
+22
-13
base_info.py
comData/BaseInfo_qcc/base_info.py
+22
-13
没有找到文件。
comData/BaseInfo_qcc/base_info.py
浏览文件 @
fe8ddd44
...
...
@@ -16,7 +16,7 @@ cursor_ = baseCore.cursor
log
=
baseCore
.
getLogger
()
# 通过企查查id获取企业基本信息
def
info_by_id
(
com_id
,
com_name
):
def
info_by_id
(
com_id
,
com_name
,
social_code
):
aa_dict_list
=
[]
t
=
str
(
int
(
time
.
time
())
*
1000
)
...
...
@@ -30,8 +30,10 @@ def info_by_id(com_id,com_name):
try
:
result_dict
=
resp_dict
[
'result'
][
'Company'
]
except
:
print
(
com_name
+
":获取失败"
)
#
log
.
info
(
com_name
+
":获取失败===========重新放入redis"
)
baseCore
.
rePutIntoR
(
'BaseInfoEnterpriseFbs:gnqy_social_code'
,
social_code
)
return
aa_dict_list
company_name
=
result_dict
[
'Name'
]
CreditCode
=
result_dict
[
'CreditCode'
]
if
CreditCode
is
None
:
...
...
@@ -330,7 +332,8 @@ if __name__ == '__main__':
name_list
=
[]
start_time
=
time
.
time
()
# 获取企业信息
social_code
=
baseCore
.
redicPullData
(
'BaseInfoEnterprise:gnqy_socialCode'
)
# social_code = baseCore.redicPullData('BaseInfoEnterprise:gnqy_socialCode')
social_code
=
'91110000802100433B'
if
social_code
==
''
:
time
.
sleep
(
20
)
continue
...
...
@@ -347,24 +350,30 @@ if __name__ == '__main__':
company_id
=
find_id_by_name
(
start_time
,
token
,
social_code
)
else
:
company_id
=
find_id_by_name
(
start_time
,
token
,
com_name
)
# todo:写入数据库
updateSql
=
f
"update EnterpriseInfo set QCCID = '{company_id}' where SocialCode = '{social_code}'"
cursor_
.
execute
(
updateSql
)
cnx_
.
commit
()
post_data_list
=
info_by_id
(
company_id
,
com_name
)
if
company_id
==
""
:
print
(
com_name
+
":企业ID获取失败"
)
if
not
company_id
:
log
.
info
(
com_name
+
":企业ID获取失败===重新放入redis"
)
list_weicha
.
append
(
com_name
+
":企业ID获取失败"
)
baseCore
.
rePutIntoR
(
'BaseInfoEnterprise:gnqy_socialCode'
,
social_code
)
time
.
sleep
(
20
)
continue
else
:
log
.
info
(
f
'====={social_code}===={company_id}=====获取企业id成功====='
)
# todo:写入数据库
updateSql
=
f
"update EnterpriseInfo set QCCID = '{company_id}' where SocialCode = '{social_code}'"
cursor_
.
execute
(
updateSql
)
cnx_
.
commit
()
try
:
post_data_list
=
info_by_id
(
company_id
,
com_nam
e
)
post_data_list
=
info_by_id
(
company_id
,
com_name
,
social_cod
e
)
except
:
log
.
info
(
f
'====={social_code}=====获取基本信息失败,重新放入redis====='
)
baseCore
.
rePutIntoR
(
'BaseInfoEnterprise:gnqy_social_code'
,
social_code
)
continue
if
post_data_list
:
pass
else
:
log
.
info
(
f
'======{social_code}====企查查token失效===='
)
time
.
sleep
(
20
)
continue
for
post_data
in
post_data_list
:
list_all_info
.
append
(
post_data
)
if
post_data
is
None
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论