From f946d10a270fa0e013558adb888b38add795c3b4 Mon Sep 17 00:00:00 2001 From: pengtao Date: Tue, 13 Aug 2019 14:54:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A9=BA=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mytask/tasks_1016.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/mytask/tasks_1016.py b/mytask/tasks_1016.py index daf57d1..a68a6f7 100644 --- a/mytask/tasks_1016.py +++ b/mytask/tasks_1016.py @@ -31,15 +31,16 @@ class TGA_event(GetFromTga): cast(json_extract(button_param,'$.id') as int)""" out = self.tga.get_data(sql) - for line in out: - if line: - temp = {} - try: - temp['id'], temp['num'] = line - except Exception: - log.error(f"write {line} 2 tga failed!", exc_info=True) - if temp: - self.write_tga_files(temp) + if out: + for line in out: + if line: + temp = {} + try: + temp['id'], temp['num'] = line + except Exception: + log.error(f"write {line} 2 tga failed!", exc_info=True) + if temp: + self.write_tga_files(temp) def event_shop_new(self): sql = f"""select @@ -60,15 +61,16 @@ class TGA_event(GetFromTga): out = self.tga.get_data(sql) - for line in out: - if line: - temp = {} - try: - temp['id'], temp['num'] = line - if temp: - self.write_tga_files(temp) - except Exception: - log.error(f"write {line} 2 tga failed!", exc_info=True) + if out: + for line in out: + if line: + temp = {} + try: + temp['id'], temp['num'] = line + if temp: + self.write_tga_files(temp) + except Exception: + log.error(f"write {line} 2 tga failed!", exc_info=True) def event_tap(self): for item in tap_items: