From eefa2dfc5656805ef6c864ba6d850c9ce24a90d5 Mon Sep 17 00:00:00 2001 From: RogerWork Date: Wed, 21 Feb 2024 08:52:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E7=BA=BF=E4=B8=8A=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/update/views.py b/update/views.py index c872bf9..912eb97 100644 --- a/update/views.py +++ b/update/views.py @@ -5,7 +5,7 @@ from django.http import JsonResponse from django.db.models import Q from rest_framework import viewsets, permissions, status, filters from rest_framework.filters import OrderingFilter - +from django_redis import get_redis_connection from update.models import Cinema from update.serializers import * from rest_framework.views import APIView @@ -125,6 +125,8 @@ def update_cine(request): } cinema_update_status[cinema_ip] = copy.deepcopy(update_status) + redis_conn = get_redis_connection() + redis_conn.set(f'cinema_update_status_{cinema_ip}', json.dumps(update_status), 10*60) print("ws调试", cinema_update_status) short_release = req.get('version') @@ -229,7 +231,8 @@ def update_cine(request): cinema_update_status[cinema_ip]['config']['result'] = 'fail' cinema_update_status[cinema_ip]['config']['msg'] = config_before_output + '
' + str(e) return JsonResponse({'result': 'fail', 'ip': cinema_ip, 'msg': str(e)}) - + d = redis_conn.get(f'cinema_update_status_{cinema_ip}') + print(d) # 传输客户端 client_list = list(set(cmd_list) & set(cmd_dict['client'])) if len(client_list) > 0: