From a50172a9e047c7436b11934ed6dcd1ad153924f2 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 22 Aug 2019 11:04:57 +0800 Subject: [PATCH] fix bug --- ad_tasks.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ad_tasks.py b/ad_tasks.py index 9214136..e4b101d 100644 --- a/ad_tasks.py +++ b/ad_tasks.py @@ -96,19 +96,17 @@ def send_cache_data(): except: item['y_offset'] = 0 try: - print(f"0={item}") temp = {} temp['jump_param'] = item.get('jump_param', "") + if not item['ad_property']: + item['ad_property']={} if not isinstance(item.get('ad_property', {}), dict): - if not item.get('ad_property', {}): + 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'] = json.loads(item.get('ad_property', {}).replace("‘", '"').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}") + item['ad_property']=json.dumps(item['ad_property']) except Exception: log.error(f"write {item}", exc_info=True) @@ -145,7 +143,6 @@ def send_cache_data(): remove_list = ('ad_num', 'gameid') for item in remove_list: line.pop(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)