优化代码逻辑兼容客户端没上传的情况

main
RogerWork 10 months ago
parent 8a8ed30e05
commit b7b6cfcea3
  1. 18
      update/migrations/0019_alter_clientrelease_sub_ver.py
  2. 2
      update/models.py
  3. 18
      update/utils/client_util.py

@ -0,0 +1,18 @@
# Generated by Django 4.2.7 on 2024-01-12 09:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('update', '0018_alter_updatecommand_options'),
]
operations = [
migrations.AlterField(
model_name='clientrelease',
name='sub_ver',
field=models.IntegerField(default=0, help_text='小版本', verbose_name='小版本'),
),
]

@ -74,7 +74,7 @@ class ClientRelease(BaseModels):
client_ver = models.CharField(verbose_name='客户端版本', max_length=100, null=False, default='',
help_text='客户端版本')
main_ver = models.CharField(verbose_name='主版本', max_length=100, null=False, default='', help_text='主版本')
sub_ver = models.CharField(verbose_name='小版本', max_length=10, null=False, default='', help_text='小版本')
sub_ver = models.IntegerField(verbose_name='小版本', null=False, default=0, help_text='小版本')
ver_id = models.IntegerField(verbose_name='版本id', null=False, default=0, help_text='版本id')
upload_name = models.CharField(verbose_name='上传名称', max_length=200, null=False, help_text='上传名称')
client_type = models.CharField(verbose_name='类型', max_length=10, default='test',

@ -76,12 +76,6 @@ class ClientUtil:
db_cursor.execute(GET_DEPLOY_CLIENT_INFO, (client_ver,))
result = db_cursor.fetchone()
print(result)
# for version in result:
# if version['full_version'].startswith(short_ver):
# print(version['full_version'])
# return version['full_version']
# return None
# # print(result)
if result is None:
return None
return result['full_version']
@ -113,9 +107,21 @@ class ClientUtil:
print('get_client_version')
print(short_version)
client_version = self.get_client_info_from_deploy_db(short_version)
test_client_list = self.get_smb_file_list('data1', '/客户端/测试专用', r'client_v2.033*.7z')
# 客户端打包服务器上有,smb上没有
is_exist = False
for test_client in test_client_list:
if client_version in test_client:
is_exist = True
if is_exist is False:
client = ClientRelease.objects.filter(ver_id=int(short_version[7:])).order_by('-sub_ver').first()
client_version = client.client_ver
print(is_exist)
print(client_version)
# 新版本还没有对应的包
if client_version is None:
client_version = self.get_client_version_from_cine(cinema_ip)
print(client_version)
return client_version
def get_client(self, cinema_ip, short_version):

Loading…
Cancel
Save