Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
I
install.api
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Script
install.api
Commits
480fe1b2
Commit
480fe1b2
authored
Apr 08, 2020
by
金凯强
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
去空格
parent
09db477d
Pipeline
#22226
failed with stage
in 11 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
conncetion_service.py
app/conncetion/conncetion_service.py
+15
-3
No files found.
app/conncetion/conncetion_service.py
View file @
480fe1b2
...
...
@@ -31,6 +31,8 @@ class ConnectionService():
"db_password": "000", "mes_db_name": "HSGmtMes", "tiip_db_name": "HSTIIP"}
:return:
'''
CommonTools
.
validate_dict_value_all_not_none
(
json_data
)
id
=
json_data
.
get
(
'id'
)
project_no
=
json_data
.
get
(
'project_no'
)
.
strip
()
db_ip
=
json_data
.
get
(
'db_ip'
)
...
...
@@ -40,8 +42,6 @@ class ConnectionService():
mes_db_name
=
json_data
.
get
(
'mes_db_name'
)
.
strip
()
host_ip
=
json_data
.
get
(
'host_ip'
)
CommonTools
.
validate_dict_value_all_not_none
(
json_data
)
# 验证数据库连接是否正确
if
not
CommonTools
()
.
test_db_connection
(
db_ip
,
db_port
,
db_user
,
db_password
,
mes_db_name
):
raise
HSException
(
'您填写的数据库信息未能连接上数据库,请检查'
)
...
...
@@ -170,6 +170,11 @@ values
server_user
is
None
or
server_password
is
None
:
raise
HSException
(
'以上参数全部必填'
)
project_no
=
project_no
.
strip
()
server_ip
=
server_ip
.
strip
()
server_user
=
server_user
.
strip
()
server_password
=
server_password
.
strip
()
with
db_driver
as
session
:
if
id
:
validate_sql
=
f
"select * from remote_server_info where project_no='{project_no}' and id<>'{id}' "
...
...
@@ -202,7 +207,7 @@ values
def
set_remote_db_info
(
self
,
json_data
):
'''
设置远程服务器数据库配置
设置远程服务器数据库配置
:param param:
:return:
'''
...
...
@@ -221,6 +226,13 @@ values
db_user
is
None
or
db_password
is
None
or
mes_db_name
is
None
or
work_shop_no
is
None
:
raise
HSException
(
'以上参数全部必填'
)
project_no
=
project_no
.
strip
()
work_shop_no
=
work_shop_no
.
strip
()
db_ip
=
db_ip
.
strip
()
db_user
=
db_user
.
strip
()
db_password
=
db_password
.
strip
()
mes_db_name
=
mes_db_name
.
strip
()
with
db_driver
as
session
:
if
id
:
validate_sql
=
f
"select * from remote_server_db_info where project_no='{project_no}' and work_shop_no='{work_shop_no}' and id<>'{id}' "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment