调整HTML模板

This commit is contained in:
pengtao 2019-11-20 15:49:03 +08:00
parent 49cbbcaf33
commit df89597db2

View File

@ -5,8 +5,9 @@ import logging
import datetime
import json
from collections import defaultdict
define_logger("/data/logs/ops/tap_weekly.log")
define_logger("/data/logs/ops/tap_weekly.log")
log = logging.getLogger(__name__)
db_conf = {'user': 'mytga', 'pswd': 'gzVwh4HGR68G', 'host': '10.10.3.5', 'db': 'external_data'}
@ -32,7 +33,6 @@ class TapWeeklyReport:
for tap_type in tap_types:
sql = f"""select
gameid,
title,
min(`order`), max(order)
from
taptap_collect
@ -45,7 +45,31 @@ class TapWeeklyReport:
data = self.db_conn.query(sql)
if data:
all_data[tap_type].append(data) # print(f"{tap_type}\t{data}")
try:
for line in data:
gameid, min_order, max_order = line
all_data[gameid][tap_type]["min_order"] = min_order
all_data[gameid][tap_type]["max_order"] = max_order
# all_data[tap_type].append(data)
except Exception:
log.error(f"get {tap_type} min/max order failed!", exc_info=True)
sql02 = f"""select gameid,title,score,tags,order,watch,download,sell,review,reserve,topic from
taptap_collect
where
catename='{tap_type}'
and date ='{self.day}'
"""
data02 = self.db_conn.query(sql02)
if data02:
try:
for line in data02:
gameid, title, score, tags, order, watch, download, sell, review, reserve, topic = line
all_data[gameid][tap_type]["title"] = title
all_data[gameid][tap_type]["score"] = score
except Exception:
log.error(f"get {tap_type} details failed!", exc_info=True)
return all_data
def run(self):