Commit ea1aca99 authored by 金凯强's avatar 金凯强 🎨

去除classmethod

parent 759a1d10
Pipeline #22206 failed with stage
in 11 seconds
...@@ -43,7 +43,7 @@ class ConnectionService(): ...@@ -43,7 +43,7 @@ class ConnectionService():
CommonTools.validate_dict_value_all_not_none(json_data) 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): if not CommonTools().test_db_connection(db_ip, db_port, db_user, db_password, mes_db_name):
raise HSException('数据库连接失败,请检查') raise HSException('数据库连接失败,请检查')
with db_driver as session: with db_driver as session:
...@@ -136,7 +136,7 @@ values ...@@ -136,7 +136,7 @@ values
db_password = json_data['db_password'] db_password = json_data['db_password']
test_db_name = json_data['mes_db_name'] test_db_name = json_data['mes_db_name']
if CommonTools.test_db_connection(db_ip, db_port, db_user, db_password, test_db_name): if CommonTools().test_db_connection(db_ip, db_port, db_user, db_password, test_db_name):
return {'message': '连接成功'} return {'message': '连接成功'}
else: else:
return {'message': '连接失败'} return {'message': '连接失败'}
......
...@@ -23,7 +23,6 @@ class CommonTools: ...@@ -23,7 +23,6 @@ class CommonTools:
# 超过四秒,基本上没救了,告辞~~~~ # 超过四秒,基本上没救了,告辞~~~~
@timeout_decorator.timeout(4) @timeout_decorator.timeout(4)
@classmethod
def test_db_connection(cls, ip: int, port: int, user_name: str, password: str, db_name: str): def test_db_connection(cls, ip: int, port: int, user_name: str, password: str, db_name: str):
''' '''
测试数据库连接 测试数据库连接
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment