diff --git a/ad_interface_tornado.py b/ad_interface_tornado.py index f0f8253..2d16865 100644 --- a/ad_interface_tornado.py +++ b/ad_interface_tornado.py @@ -9,7 +9,7 @@ import tornado.web import tornado.ioloop import tornado.web import json -from myredis import myredis +from myredis.myredis import my_redis import datetime from mysql.mmysql import MysqlBase from config import mysql_promotion_config @@ -34,10 +34,10 @@ def adlist_workflow(input): gameid = input['gameid'] localid = input['localtionid'] key = f"{gameid}::{localid}" - ids = myredis.hmgetall(key) + ids = my_redis.hmgetall(key) info = [] for id in ids: - temp = myredis.hgetall[f"{id}::info"] + temp = my_redis.hgetall[f"{id}::info"] info.append(temp) return info @@ -50,12 +50,11 @@ def getDaySeconds(time_val, incdays): def send_cache_data(): now = datetime.datetime.today().strftime("%Y-%m-%d") - all = [] # 添加无天数限定的记录 - get_full_data = f"select id,name,ad_num,ad_title,ad_body,ad_image,ad_url,ad_sort,companyid,locationid,gameid from " \ - "ad where begin_time={BEGIN} or end_time={END}" + get_full_data = f"select id,name,ad_num,ad_title,ad_body,ad_image,ad_url,ad_sort,companyid,locationid,gameid from ad where begin_time='{BEGIN}' or end_time='{END}'" full_data = mydb.query(get_full_data) + if full_data: for line in full_data: if line: @@ -68,8 +67,7 @@ def send_cache_data(): log.error("split data failed", exc_info=True) # 添加有天数限定的记录 - get_data_sql = f"select id,name,ad_num,ad_title,ad_body,ad_image,ad_url,ad_sort," \ - "companyid,locationid,gameid from ad where {now}>begin_time and {now}begin_time and '{now}'