fixbug
This commit is contained in:
parent
9373f843c4
commit
b9352026ec
@ -507,33 +507,42 @@ class TapWeeklyReport:
|
||||
self.db_conn = MysqlBase(**db_conf)
|
||||
self.limit = 20
|
||||
|
||||
def get_weekly_days(self):
|
||||
weekly_days = []
|
||||
for i in range(0, 7):
|
||||
current_day = (datetime.datetime.strptime(self.day, '%Y-%m-%d') - datetime.timedelta(days=i)).strftime(
|
||||
'%Y-%m-%d')
|
||||
weekly_days.append(current_day)
|
||||
return weekly_days
|
||||
# def get_weekly_days(self):
|
||||
# weekly_days = []
|
||||
# for i in range(0, 7):
|
||||
# current_day = (datetime.datetime.strptime(self.day, '%Y-%m-%d') - datetime.timedelta(days=i)).strftime(
|
||||
# '%Y-%m-%d')
|
||||
# weekly_days.append(current_day)
|
||||
# return weekly_days
|
||||
|
||||
|
||||
def build(self):
|
||||
weekly_day = json.dumps(self.get_weekly_days()).strip('[]')
|
||||
# weekly_day = json.dumps(self.get_weekly_days()).strip('[]')
|
||||
tap_types = ("new", "download", "reserve", "sell", "played")
|
||||
all_data = defaultdict(list)
|
||||
for tap_type in tap_types:
|
||||
sql = f"""select
|
||||
gameid,
|
||||
title,
|
||||
min(`order`), sum(diff_order), sum(diff_watch), sum(diff_download), sum(diff_topic), score
|
||||
from
|
||||
taptap_collect
|
||||
where
|
||||
catename='{tap_type}'
|
||||
and date in ({weekly_day})
|
||||
group by
|
||||
gameid
|
||||
order by
|
||||
sum(diff_order) desc limit {self.limit};"""
|
||||
gameid,
|
||||
title as "名称",
|
||||
`order` as "当前排名",
|
||||
min_order as "最高排名",
|
||||
max_order as "最低排名",
|
||||
diff_order as "排名变动",
|
||||
score as "评分",
|
||||
tags as "游戏标签",
|
||||
watch as "关注数",
|
||||
download as "下载数",
|
||||
sell as "购买数",
|
||||
reserve as "预约数",
|
||||
review as "评论数",
|
||||
topic as "话题"
|
||||
from
|
||||
tap_weekly
|
||||
where
|
||||
catename='{tap_type}'
|
||||
and date = {self.day}
|
||||
order by
|
||||
`order` desc limit {self.limit};"""
|
||||
|
||||
data = self.db_conn.query(sql)
|
||||
if data:
|
||||
|
@ -23,11 +23,17 @@
|
||||
<th>游戏ID</th>
|
||||
<th>游戏名称</th>
|
||||
<th>排名</th>
|
||||
<th>最高排名</th>
|
||||
<th>最低排名</th>
|
||||
<th>排名变动</th>
|
||||
<th>关注变动</th>
|
||||
<th>下载变化</th>
|
||||
<th>评论变化</th>
|
||||
<th>评分</th>
|
||||
<th>游戏标签</th>
|
||||
<th>关注数</th>
|
||||
<th>下载数</th>
|
||||
<th>购买数</th>
|
||||
<th>预约数</th>
|
||||
<th>评论数</th>
|
||||
<th>话题</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
Loading…
x
Reference in New Issue
Block a user