简单的逻辑修改

main
RogerWork 10 months ago
parent 9424d8a761
commit d4f76925ba
  1. 6
      update/utils/git_util.py
  2. 2
      update/views.py

@ -149,6 +149,7 @@ class GitDbUtil:
# 从git中获取版本列表后和数据库对比,添加新的版本到数据库 # 从git中获取版本列表后和数据库对比,添加新的版本到数据库
def set_release_to_db(self): def set_release_to_db(self):
local_repo = Repo(self.local_code_path) local_repo = Repo(self.local_code_path)
local_repo.git.execute('git fetch --all')
release = [] release = []
for remote in local_repo.remotes: for remote in local_repo.remotes:
for ref in remote.refs: for ref in remote.refs:
@ -156,9 +157,12 @@ class GitDbUtil:
saved_release = Release.objects.all() saved_release = Release.objects.all()
saved_release_version_list = [rel.release for rel in saved_release] saved_release_version_list = [rel.release for rel in saved_release]
for rel in release: for rel in release:
# print(rel)
if rel in saved_release_version_list: if rel in saved_release_version_list:
print('pass') pass
# print('pass')
else: else:
print(rel)
data = { data = {
'release': rel, 'release': rel,
'short_release': rel.replace('origin/', ''), 'short_release': rel.replace('origin/', ''),

@ -126,7 +126,7 @@ def update_cine(request):
print('传输客户端') print('传输客户端')
client_release = ClientUtil() client_release = ClientUtil()
client_release.client_process(cinema_ip, short_release) client_release.client_process(cinema_ip, short_release)
return JsonResponse({'result': 'success'}) return JsonResponse({'result': 'success', 'ip': cinema_ip})
# # 测试用接口 # # 测试用接口

Loading…
Cancel
Save