解决新版本号解析失败的问题

main
RogerWork 4 days ago
parent 88a668a889
commit f0399ec3a3
  1. 2
      update/utils/client_util.py
  2. 7
      update/utils/get_version.py

@ -216,7 +216,7 @@ class ClientUtil:
def client_process(self, cinema_ip, short_release): def client_process(self, cinema_ip, short_release):
self.smb_connect() self.smb_connect()
short_version = short_release[:11] short_version = short_release[:11] if short_release.startswith('2') else short_release[:10]
print('short_version', short_version) print('short_version', short_version)
self.handle_client_db() self.handle_client_db()
self.clear_delete_file() self.clear_delete_file()

@ -66,6 +66,10 @@ class GetVersion(object):
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_id = int(ver_num[7:11]) if ver_num.startswith('2') else int(ver_num[6:10])
print('ver_id', ver_id)
update_data = { update_data = {
'name': res['cinema_name'], 'name': res['cinema_name'],
'zz_num': res['cinema_num'], 'zz_num': res['cinema_num'],
@ -76,12 +80,13 @@ class GetVersion(object):
'update_time': timezone.now(), 'update_time': timezone.now(),
'is_cloud': '云版本' if res.get('dx_sys_version', '--') == 'CLOUD' else '--', 'is_cloud': '云版本' if res.get('dx_sys_version', '--') == 'CLOUD' else '--',
'remote_label': res.get('cinema_label', '--') if res.get('cinema_label', '--') != '' else '--', 'remote_label': res.get('cinema_label', '--') if res.get('cinema_label', '--') != '' else '--',
'ver_id': int(res['server_version'][13:17]) if res['server_version'].startswith('Cloud_') else int(res['server_version'][7:11]), 'ver_id': ver_id,
'is_online': True 'is_online': True
} }
print(ip, update_data, db_config) print(ip, update_data, db_config)
cinema_obj = Cinema.objects.filter(ip=ip).update(**update_data) cinema_obj = Cinema.objects.filter(ip=ip).update(**update_data)
except Exception as e: except Exception as e:
print('-----get_cinema_ver-----')
print(e) print(e)
cinema_obj = Cinema.objects.filter(ip=ip).update(is_online=False) cinema_obj = Cinema.objects.filter(ip=ip).update(is_online=False)
finally: finally:

Loading…
Cancel
Save