From db074070ea4533340ec0d934df58d99357ca4fd5 Mon Sep 17 00:00:00 2001 From: RogerWork Date: Wed, 21 Feb 2024 09:37:00 +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/consumers.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/update/consumers.py b/update/consumers.py index 1fe251b..6a674d1 100644 --- a/update/consumers.py +++ b/update/consumers.py @@ -13,7 +13,6 @@ class UpdateConsumer(WebsocketConsumer): redis_conn = get_redis_connection() - if text_data is None: self.send('你发了啥') else: @@ -27,12 +26,15 @@ class UpdateConsumer(WebsocketConsumer): redis_key = f'cinema_update_status_{ip}' if redis_conn.exists(redis_key): redis_conn.delete(redis_key) - print(cinema_update_status.get(ip, None)) + data = json.loads(redis_conn.get(redis_key)) + print('ws任务完成消息', data) + if data.get('ip', False): ip = data['ip'] redis_key = f'cinema_update_status_{ip}' # print('ws发送消息前', cinema_update_status) data = json.loads(redis_conn.get(redis_key)) + print('ws发送消息前', data) self.send(json.dumps({'status': {'ip': ip, 'result': data}})) else: self.send(text_data)