Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zzsn_spider
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
丁双波
zzsn_spider
Commits
369b5d9f
提交
369b5d9f
authored
2月 26, 2024
作者:
LiuLiYuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
baseCore 02/26
上级
6e37a78a
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
48 行增加
和
50 行删除
+48
-50
BaseCore.py
base/BaseCore.py
+48
-50
没有找到文件。
base/BaseCore.py
浏览文件 @
369b5d9f
...
...
@@ -256,51 +256,51 @@ class BaseCore:
__USER_PHONE_AGENT_LIST
=
[
'Mozilla/5.0 (Linux; Android 7.1.1; OPPO R9sk) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.111 Mobile Safari/537.36'
]
def
__init__
(
self
):
def
__init__
(
self
,
sqlFlg
=
True
):
# self.__cnx_proxy = pymysql.connect(host='114.115.159.144', user='caiji', password='zzsn9988', db='clb_project',
# charset='utf8mb4')
# self.__cursor_proxy = self.__cnx_proxy.cursor()
self
.
cnx
=
pymysql
.
connect
(
host
=
'114.115.159.144'
,
user
=
'caiji'
,
password
=
'zzsn9988'
,
db
=
'caiji'
,
charset
=
'utf8mb4'
)
self
.
cursor
=
self
.
cnx
.
cursor
()
# 11数据库
self
.
cnx_
=
pymysql
.
connect
(
host
=
'114.116.44.11'
,
user
=
'caiji'
,
password
=
'f7s0&7qqtK'
,
db
=
'clb_project'
,
charset
=
'utf8mb4'
)
self
.
cursor_
=
self
.
cnx_
.
cursor
()
# 连接到Redis
self
.
r
=
redis
.
Redis
(
host
=
"114.115.236.206"
,
port
=
6379
,
password
=
'clbzzsn'
,
db
=
6
)
self
.
pool_caiji
=
PooledDB
(
creator
=
pymysql
,
maxconnections
=
5
,
mincached
=
2
,
maxcached
=
5
,
blocking
=
True
,
host
=
'114.115.159.144'
,
port
=
3306
,
user
=
'caiji'
,
password
=
'zzsn9988'
,
database
=
'caiji'
,
charset
=
'utf8mb4'
)
self
.
pool_11
=
PooledDB
(
creator
=
pymysql
,
maxconnections
=
5
,
mincached
=
2
,
maxcached
=
5
,
blocking
=
True
,
host
=
'114.116.44.11'
,
port
=
3306
,
user
=
'caiji'
,
password
=
'f7s0&7qqtK'
,
database
=
'clb_project'
,
charset
=
'utf8mb4'
)
def
check_mysql_conn
(
self
,
conn
):
if
sqlFlg
:
self
.
cnx
=
pymysql
.
connect
(
host
=
'114.115.159.144'
,
user
=
'caiji'
,
password
=
'zzsn9988'
,
db
=
'caiji'
,
charset
=
'utf8mb4'
)
self
.
cursor
=
self
.
cnx
.
cursor
()
# 11数据库
self
.
cnx_
=
pymysql
.
connect
(
host
=
'114.116.44.11'
,
user
=
'caiji'
,
password
=
'f7s0&7qqtK'
,
db
=
'clb_project'
,
charset
=
'utf8mb4'
)
self
.
cursor_
=
self
.
cnx_
.
cursor
()
self
.
pool_caiji
=
PooledDB
(
creator
=
pymysql
,
maxconnections
=
5
,
mincached
=
2
,
maxcached
=
5
,
blocking
=
True
,
host
=
'114.115.159.144'
,
port
=
3306
,
user
=
'caiji'
,
password
=
'zzsn9988'
,
database
=
'caiji'
,
charset
=
'utf8mb4'
)
self
.
pool_11
=
PooledDB
(
creator
=
pymysql
,
maxconnections
=
5
,
mincached
=
2
,
maxcached
=
5
,
blocking
=
True
,
host
=
'114.116.44.11'
,
port
=
3306
,
user
=
'caiji'
,
password
=
'f7s0&7qqtK'
,
database
=
'clb_project'
,
charset
=
'utf8mb4'
)
def
check_mysql_conn
(
self
,
conn
):
try
:
conn
.
ping
()
return
True
...
...
@@ -542,7 +542,6 @@ class BaseCore:
except
:
log
=
self
.
getLogger
()
log
.
info
(
'=========数据库操作失败========'
)
return
data
# 根据企业名称获取企业信息
...
...
@@ -587,6 +586,7 @@ class BaseCore:
log
.
info
(
'=========数据库操作失败========'
)
return
data
# 更新企业采集次数
def
updateRun
(
self
,
social_code
,
runType
,
count
):
try
:
...
...
@@ -679,8 +679,8 @@ class BaseCore:
return
'dan'
return
result
[
0
]
#创建excel文件
def
check_excel_file
(
self
,
file_path
):
#
创建excel文件
def
check_excel_file
(
self
,
file_path
):
if
os
.
path
.
isfile
(
file_path
):
self
.
getLogger
()
.
info
(
"Excel文件已存在"
)
return
True
...
...
@@ -688,7 +688,6 @@ class BaseCore:
self
.
getLogger
()
.
info
(
"Excel文件不存在,正在创建..."
)
return
False
# 追加接入excel
def
writerToExcel
(
self
,
detailList
,
filename
):
# filename='baidu搜索.xlsx'
...
...
@@ -772,8 +771,7 @@ class BaseCore:
#
# return retData
def
deliteATT
(
self
,
id
):
def
deliteATT
(
self
,
id
):
delitesql
=
f
"delete from clb_sys_attachment where id = '{id}' "
self
.
cursor_
.
execute
(
delitesql
)
self
.
cnx_
.
commit
()
...
...
@@ -785,7 +783,7 @@ class BaseCore:
return
selects
# 插入到att表 返回附件id
def
tableUpdate
(
self
,
retData
,
com_name
,
year
,
pdf_name
,
num
,
pub_time
,
origin
):
def
tableUpdate
(
self
,
retData
,
com_name
,
year
,
pdf_name
,
num
,
pub_time
,
origin
):
item_id
=
retData
[
'item_id'
]
type_id
=
retData
[
'type_id'
]
group_name
=
retData
[
'group_name'
]
...
...
@@ -811,7 +809,7 @@ class BaseCore:
year
,
pdf_name
,
type_id
,
item_id
,
group_name
,
path
,
full_path
,
category
,
file_size
,
order_by
,
status
,
create_by
,
create_time
,
page_size
,
full_path
.
split
(
'https://zzsn.obs.cn-north-1.myhuaweicloud.com/'
)[
1
],
'zzsn'
,
pub_time
,
origin
)
pub_time
,
origin
)
self
.
cursor_
.
execute
(
Upsql
,
values
)
# 插入
self
.
cnx_
.
commit
()
# 提交
...
...
@@ -859,13 +857,13 @@ class BaseCore:
else
:
self
.
getLogger
()
.
info
(
f
'=====文件存在obs========{file_path}'
)
#uuid 根据时间戳生成 文件名 上传到obs
#
uuid 根据时间戳生成 文件名 上传到obs
def
getuuid
(
self
):
get_timestamp_uuid
=
uuid
.
uuid1
()
# 根据 时间戳生成 uuid , 保证全球唯一
return
get_timestamp_uuid
def
uptoOBS
(
self
,
pdf_url
,
name_pdf
,
type_id
,
social_code
,
pathType
,
taskType
,
start_time
,
create_by
):
def
uptoOBS
(
self
,
pdf_url
,
name_pdf
,
type_id
,
social_code
,
pathType
,
taskType
,
start_time
,
create_by
):
headers
=
{}
retData
=
{
'state'
:
False
,
'type_id'
:
type_id
,
'item_id'
:
social_code
,
'group_name'
:
''
,
'path'
:
''
,
'full_path'
:
''
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论