新增周报脚本
This commit is contained in:
parent
ba2f7ce4b7
commit
4e7de25c4c
@ -4,6 +4,7 @@ from ops.plog import define_logger
|
|||||||
import logging
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
|
from collections import defaultdict
|
||||||
define_logger("/data/logs/ops/tap_weekly.log")
|
define_logger("/data/logs/ops/tap_weekly.log")
|
||||||
|
|
||||||
db_conf = {'user': 'mytga', 'pswd': 'gzVwh4HGR68G', 'host': '10.10.3.5', 'db': 'external_data'}
|
db_conf = {'user': 'mytga', 'pswd': 'gzVwh4HGR68G', 'host': '10.10.3.5', 'db': 'external_data'}
|
||||||
@ -27,6 +28,7 @@ class TapWeeklyReport:
|
|||||||
def build(self):
|
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")
|
tap_types = ("new", "download", "reserve", "sell", "played")
|
||||||
|
all_data = defaultdict(list)
|
||||||
for tap_type in tap_types:
|
for tap_type in tap_types:
|
||||||
sql = f"""select
|
sql = f"""select
|
||||||
gameid,
|
gameid,
|
||||||
@ -44,8 +46,8 @@ class TapWeeklyReport:
|
|||||||
|
|
||||||
data = self.db_conn.query(sql)
|
data = self.db_conn.query(sql)
|
||||||
if data:
|
if data:
|
||||||
print(f"{tap_type}\t{data}")
|
all_data[tap_type].append(data) # print(f"{tap_type}\t{data}")
|
||||||
return True
|
return all_data
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
data = self.build()
|
data = self.build()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user