From d26f29dba9d27a81590674f1aa17e446a02c2605 Mon Sep 17 00:00:00 2001 From: pengtao Date: Thu, 22 Aug 2019 10:39:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8Aad=20=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ad_tasks.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/ad_tasks.py b/ad_tasks.py index a653ca5..9214136 100644 --- a/ad_tasks.py +++ b/ad_tasks.py @@ -95,21 +95,22 @@ def send_cache_data(): item['y_offset'] = item['area'].split(',')[-1].strip().strip(')') except: item['y_offset'] = 0 - # try: - # print(f"0={item}") - # temp = {} - # temp['jump_param'] = item.get('jump_param',"") - # if not isinstance(item.get('ad_property', {}), dict): - # if not item.get('ad_property', {}): - # item['ad_property']={}.update(temp) - # else: - # item['ad_property'] = json.loads(item.get('ad_property', {}).replace("'",'"')) - # item['ad_property'].update(temp) - # print(f"item['ad_property']={item['ad_property']}") - # #item['ad_property']=json.dumps(item['ad_property']) - # print(f"1={item}") - # except Exception: - # log.error(f"write {item}",exc_info=True) + try: + print(f"0={item}") + temp = {} + temp['jump_param'] = item.get('jump_param', "") + if not isinstance(item.get('ad_property', {}), dict): + if not item.get('ad_property', {}): + item['ad_property'] = {}.update(temp) + else: + pdb.set_trace() + item['ad_property'] = json.loads(item.get('ad_property', {}).replace("'", '"')) + item['ad_property'].update(temp) + print(f"item['ad_property']={item['ad_property']}") + #item['ad_property']=json.dumps(item['ad_property']) + print(f"1={item}") + except Exception: + log.error(f"write {item}", exc_info=True) all.append(item) except Exception: @@ -144,7 +145,7 @@ def send_cache_data(): remove_list = ('ad_num', 'gameid') for item in remove_list: line.pop(item) - print(f"2={item}") + print(f"2={line}") my_redis.hmset(f"ad::{line['id']}::info", line) my_redis.expire(f"ad::{line['id']}::info", 60) # my_redis.expire(f"ad::{line['id']}::info", 3600 * 24 * 7)