|
|
|
@ -56,26 +56,22 @@ class GetVersion(object): |
|
|
|
cinema_config = q.get() |
|
|
|
cinema_config = q.get() |
|
|
|
|
|
|
|
|
|
|
|
sql_str = "SELECT cs.*, cv.server_version, cv.client_version FROM cinema_set cs LEFT JOIN cinema_version cv ON 1=1;" |
|
|
|
sql_str = "SELECT cs.*, cv.server_version, cv.client_version FROM cinema_set cs LEFT JOIN cinema_version cv ON 1=1;" |
|
|
|
ip = cinema_config.get('ip') |
|
|
|
url = cinema_config.get('url') |
|
|
|
db_config = { |
|
|
|
db_config = { |
|
|
|
'host': ip, |
|
|
|
'host': cinema_config.get('ip'), |
|
|
|
'user': cinema_config.get('db_user'), |
|
|
|
'user': cinema_config.get('db_user'), |
|
|
|
'password': cinema_config.get('db_pwd'), |
|
|
|
'password': cinema_config.get('db_pwd'), |
|
|
|
'database': cinema_config.get('db_name'), |
|
|
|
'database': cinema_config.get('db_name'), |
|
|
|
'connect_timeout': 5, |
|
|
|
'connect_timeout': 5, |
|
|
|
} |
|
|
|
} |
|
|
|
print('get_cinema_ver') |
|
|
|
|
|
|
|
print(cinema_config) |
|
|
|
|
|
|
|
print(db_config) |
|
|
|
|
|
|
|
try: |
|
|
|
try: |
|
|
|
db_conn = pymysql.Connect(**db_config) |
|
|
|
db_conn = pymysql.Connect(**db_config) |
|
|
|
with db_conn.cursor(cursor=DictCursor) as db_cursor: |
|
|
|
with db_conn.cursor(cursor=DictCursor) as db_cursor: |
|
|
|
db_cursor.execute(sql_str) |
|
|
|
db_cursor.execute(sql_str) |
|
|
|
res = db_cursor.fetchone() |
|
|
|
res = db_cursor.fetchone() |
|
|
|
print('server_version', res['server_version']) |
|
|
|
|
|
|
|
ver_num = res['server_version'].replace('Cloud_', '') |
|
|
|
ver_num = res['server_version'].replace('Cloud_', '') |
|
|
|
ver_id = int(ver_num[7:11]) if ver_num.startswith('2') else int(ver_num[6:10]) |
|
|
|
ver_id = int(ver_num[7:11]) if ver_num.startswith('2') else int(ver_num[6:10]) |
|
|
|
print('ver_id', ver_id) |
|
|
|
print('get_cinema_ver-res', db_config, res, ver_id) |
|
|
|
if cinema_config.get('url').endswith('cinema.yhz.com'): |
|
|
|
if cinema_config.get('url').endswith('cinema.yhz.com'): |
|
|
|
is_cloud = 'SAAS版' |
|
|
|
is_cloud = 'SAAS版' |
|
|
|
else: |
|
|
|
else: |
|
|
|
@ -93,13 +89,12 @@ class GetVersion(object): |
|
|
|
'ver_id': ver_id, |
|
|
|
'ver_id': ver_id, |
|
|
|
'is_online': True |
|
|
|
'is_online': True |
|
|
|
} |
|
|
|
} |
|
|
|
print(ip, update_data, db_config) |
|
|
|
print(url, update_data, db_config) |
|
|
|
cinema_obj = Cinema.objects.filter(ip=ip).update(**update_data) |
|
|
|
cinema_obj = Cinema.objects.filter(url=url).update(**update_data) |
|
|
|
db_conn.close() |
|
|
|
db_conn.close() |
|
|
|
except Exception as e: |
|
|
|
except Exception as e: |
|
|
|
print('-----get_cinema_ver-----') |
|
|
|
print('get_cinema_ver-exception', e) |
|
|
|
print(e) |
|
|
|
cinema_obj = Cinema.objects.filter(url=url).update(is_online=False) |
|
|
|
cinema_obj = Cinema.objects.filter(ip=ip).update(is_online=False) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_cinema_ver_by_ip(ip): |
|
|
|
def get_cinema_ver_by_ip(ip): |
|
|
|
|