This commit is contained in:
root 2019-07-15 19:18:18 +08:00
parent 5f9e232c9f
commit afa26ebb93

View File

@ -56,11 +56,13 @@ def send_cache_data():
log.error("split data failed", exc_info=True) log.error("split data failed", exc_info=True)
# 检查ID是否存在播放列表中以及播放次数是否完毕 # 检查ID是否存在播放列表中以及播放次数是否完毕
if all: if all:
log.info(f"get data was {all}!\n")
for line in all: for line in all:
key = f"{line.get('gameid', 0)}::{line.get('locationid', 0)}" key = f"{line.get('gameid', 0)}::{line.get('locationid', 0)}"
if my_redis.exists(key): if my_redis.exists(key):
my_redis.sadd(key,line['id'])
# 检查num是否已达到设定数值 # 检查num是否已达到设定数值
num = my_redis.get(f"{key}:num") num = my_redis.get(f"{line['id']::num")
if not num: if not num:
num = 0 num = 0
if line['ad_num'] > 0 and line['ad_num'] <= num: if line['ad_num'] > 0 and line['ad_num'] <= num:
@ -70,9 +72,9 @@ def send_cache_data():
my_redis.expire(f"{line['id']}::info", 0) my_redis.expire(f"{line['id']}::info", 0)
else: else:
my_redis.sadd(key, line['id']) my_redis.sadd(key, line['id'])
log.info(f"check {line['id']}::info")
if not my_redis.exists(f"{line['id']}::info"): if not my_redis.exists(f"{line['id']}::info"):
my_redis.hmset(f"{line['id']}::info", line) my_redis.hmset(f"{line['id']}::info", line)
len_all = len(all) len_all = len(all)
log.info(f"write {len_all} to cache!") log.info(f"write {len_all} to cache!")
@ -95,7 +97,6 @@ class DispatchHandler(tornado.web.RequestHandler):
def _selfGetAdList(self): def _selfGetAdList(self):
pdb.set_trace()
try: try:
input = json.loads(self.get_query_argument('body')) input = json.loads(self.get_query_argument('body'))
gameid = input['gameid'] gameid = input['gameid']