fix some error
This commit is contained in:
parent
1520889b20
commit
43ecffc2d9
@ -35,7 +35,7 @@ def send_cache_data():
|
|||||||
item = {}
|
item = {}
|
||||||
try:
|
try:
|
||||||
item['id'], item['name'], item['ad_num'], item['ad_title'], item['ad_body'], item['ad_image'], item['ad_url'], \
|
item['id'], item['name'], item['ad_num'], item['ad_title'], item['ad_body'], item['ad_image'], item['ad_url'], \
|
||||||
item['ad_sort'], item['companyid'], item['locationid'], item['gameid'] = line
|
item['ad_sort'], item['companyid'], item['locationid'], item['gameid'] = line
|
||||||
all.append(item)
|
all.append(item)
|
||||||
except Exception:
|
except Exception:
|
||||||
log.error("split data failed", exc_info=True)
|
log.error("split data failed", exc_info=True)
|
||||||
@ -50,7 +50,7 @@ def send_cache_data():
|
|||||||
item = {}
|
item = {}
|
||||||
try:
|
try:
|
||||||
item['id'], item['name'], item['ad_num'], item['ad_title'], item['ad_body'], item['ad_image'], item['ad_url'], \
|
item['id'], item['name'], item['ad_num'], item['ad_title'], item['ad_body'], item['ad_image'], item['ad_url'], \
|
||||||
item['ad_sort'], item['companyid'], item['locationid'], item['gameid'] = line
|
item['ad_sort'], item['companyid'], item['locationid'], item['gameid'] = line
|
||||||
all.append(item)
|
all.append(item)
|
||||||
except Exception:
|
except Exception:
|
||||||
log.error("split data failed", exc_info=True)
|
log.error("split data failed", exc_info=True)
|
||||||
@ -60,7 +60,10 @@ def send_cache_data():
|
|||||||
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):
|
||||||
# 检查num是否已达到设定数值
|
# 检查num是否已达到设定数值
|
||||||
num = my_redis.get(f"{key}:num") or 0
|
num = my_redis.get(f"{key}:num")
|
||||||
|
if not num:
|
||||||
|
num=0
|
||||||
|
print("num was ",num)
|
||||||
if line['num'] != -1 and line['num'] <= num:
|
if line['num'] != -1 and line['num'] <= num:
|
||||||
# 该广告已播放达到次数,从缓存中清除
|
# 该广告已播放达到次数,从缓存中清除
|
||||||
my_redis.srem(key, line['id'])
|
my_redis.srem(key, line['id'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user