Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
丁双波
zzsn_spider
Commits
114102ca
提交
114102ca
authored
8月 16, 2023
作者:
薛凌堃
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加福布斯
上级
017e1b47
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
70 行增加
和
15 行删除
+70
-15
RedisPPData.py
base/RedisPPData.py
+70
-15
没有找到文件。
base/RedisPPData.py
浏览文件 @
114102ca
...
...
@@ -29,28 +29,34 @@ r = basecore.r
# gn_social_list = [item[0] for item in gn_result]
# return gn_social_list,gw_social_list
#企业动态
def
NewsEnterprise
():
#获取国内企业
gn_query
=
"select SocialCode from EnterpriseInfo where Place = '1'"
cursor
.
execute
(
gn_query
)
gn_result
=
cursor
.
fetchall
()
#
#
获取国内企业
#
gn_query = "select SocialCode from EnterpriseInfo where Place = '1'"
#
cursor.execute(gn_query)
#
gn_result = cursor.fetchall()
#获取国外企业
gw_query
=
"select SocialCode from EnterpriseInfo where Place = '2'"
cursor
.
execute
(
gw_query
)
gw_result
=
cursor
.
fetchall
()
gw_social_list
=
[
item
[
0
]
for
item
in
gw_result
]
gn_social_list
=
[
item
[
0
]
for
item
in
gn_result
]
# return gn_social_list, gw_social_list
#todo:打印长度
print
(
len
(
gw_social_list
))
# gn_social_list = [item[0] for item in gn_result]
print
(
'======='
)
# gn_social_list,gw_social_list = pullDateFromSql()
#将数据插入到redis中
for
item
in
gn_social_list
:
r
.
rpush
(
'NewsEnterprise:gnqy_socialCode'
,
item
)
#将数据插入到redis中
# for item in gn_social_list:
# r.rpush('NewsEnterprise:gnqy_socialCode', item)
count
=
0
for
item
in
gw_social_list
:
r
.
rpush
(
'NewsEnterprise:gwqy_socialCode'
,
item
)
count
+=
1
print
(
item
)
print
(
count
)
#企业动态定时任务
def
NewsEnterprise_task
():
# 实例化一个调度器
scheduler
=
BlockingScheduler
()
...
...
@@ -63,6 +69,7 @@ def NewsEnterprise_task():
print
(
'定时采集异常'
,
e
)
pass
#企业公告
def
NoticeEnterprise
():
# 获取国内企业
gn_query
=
"select SocialCode from EnterpriseInfo where Place = '1' and SecuritiesCode is not null limit 1 "
...
...
@@ -72,7 +79,7 @@ def NoticeEnterprise():
print
(
'======='
)
for
item
in
gn_social_list
:
r
.
rpush
(
'NoticeEnterprise:gnqy_socialCode'
,
item
)
#企业公告定时任务
def
NoticeEnterprise_task
():
# 实例化一个调度器
scheduler
=
BlockingScheduler
()
...
...
@@ -85,6 +92,7 @@ def NoticeEnterprise_task():
print
(
'定时采集异常'
,
e
)
pass
#企业年报
def
AnnualEnterprise
():
# 获取国内企业
gn_query
=
"select SocialCode from EnterpriseInfo where Place = '1' and SecuritiesCode is not null"
...
...
@@ -94,7 +102,7 @@ def AnnualEnterprise():
print
(
'======='
)
for
item
in
gn_social_list
:
r
.
rpush
(
'AnnualEnterprise:gnqy_socialCode'
,
item
)
#企业年报定时任务
def
AnnualEnterprise_task
():
# 实例化一个调度器
scheduler
=
BlockingScheduler
()
...
...
@@ -107,6 +115,7 @@ def AnnualEnterprise_task():
print
(
'定时采集异常'
,
e
)
pass
#企业基本信息
def
BaseInfoEnterprise
():
# 获取国内企业
gn_query
=
"select SocialCode from EnterpriseInfo where Place = '1' limit 1 "
...
...
@@ -117,7 +126,7 @@ def BaseInfoEnterprise():
for
item
in
gn_social_list
:
r
.
rpush
(
'BaseInfoEnterprise:gnqy_socialCode'
,
item
)
#企业基本信息
#企业基本信息
定时任务
def
BaseInfoEnterprise_task
():
# 实例化一个调度器
scheduler
=
BlockingScheduler
()
...
...
@@ -130,12 +139,58 @@ def BaseInfoEnterprise_task():
print
(
'定时采集异常'
,
e
)
pass
#微信公众号
def
WeiXingetFromSql
():
selectSql
=
"SELECT info_source_code from info_source where site_uri like '
%
mp.weixin.qq.com
%
'"
cursor
.
execute
(
selectSql
)
results
=
cursor
.
fetchall
()
result_list
=
[
item
[
0
]
for
item
in
results
]
#放入redis
for
item
in
result_list
:
r
.
rpush
(
'WeiXinGZH:infoSourceCode'
,
item
)
#微信公众号定时任务
def
weixin_task
():
# 实例化一个调度器
scheduler
=
BlockingScheduler
()
# 每天执行一次
scheduler
.
add_job
(
WeiXingetFromSql
,
'cron'
,
hour
=
12
,
minute
=
0
)
try
:
# redisPushData # 定时开始前执行一次
scheduler
.
start
()
except
Exception
as
e
:
print
(
'定时采集异常'
,
e
)
pass
##福布斯=====从数据库中读取信息放入redis
def
FBS
():
# todo:调整为获取福布斯的数据库
gw_query
=
"select SocialCode from EnterpriseInfo where Place = '2'"
cursor
.
execute
(
gw_query
)
gw_result
=
cursor
.
fetchall
()
# #获取国内企业
gn_query
=
"select SocialCode from EnterpriseInfo where Place = '1'"
cursor
.
execute
(
gn_query
)
gn_result
=
cursor
.
fetchall
()
gn_social_list
=
[
item
[
0
]
for
item
in
gn_result
]
gw_social_list
=
[
item
[
0
]
for
item
in
gw_result
]
for
item
in
gw_social_list
:
r
.
rpush
(
'NewsEnterprise:gwqy_socialCode'
,
item
)
for
item
in
gn_social_list
:
r
.
rpush
(
'NewsEnterprise:gnqy_socialCode'
,
item
)
if
__name__
==
"__main__"
:
start
=
time
.
time
()
# NewsEnterprise_task()
# NewsEnterprise()
FBS
()
# NoticeEnterprise_task()
AnnualEnterprise_task
()
#
AnnualEnterprise_task()
log
.
info
(
f
'====={basecore.getNowTime(1)}=====添加数据成功======耗时:{basecore.getTimeCost(start,time.time())}==='
)
# cnx.close()
# cursor.close()
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论