tap order 数据写入mysql

This commit is contained in:
pengtao 2019-10-16 16:24:54 +08:00
parent dc05a29ea8
commit 1f7f549951

View File

@ -26,7 +26,8 @@ class TapTapReport:
def build_report(self):
all = dict()
gameid_order = dict()
gameid_info = self.get_gameid_info()
# get 最新的gameid info数据
gameid_info = self.get_gameid_info(self.day)
for item in (self.day, self.bday):
b_d = self.split_order_data(item)
for key in b_d:
@ -40,8 +41,6 @@ class TapTapReport:
all.setdefault(key, {})['current_order'] = gameid_order[key].get(self.day, 301)
for key in gameid_info.keys():
pdb.set_trace()
print(all[key])
all[key]['title'] = gameid_info[key]['title']
all[key]['cate'] = gameid_info[key]['cate']
all[key]['topic'] = gameid_info[key]['topic']
@ -52,10 +51,23 @@ class TapTapReport:
all[key]['sell'] = gameid_info[key]['sell']
all[key]['review'] = gameid_info[key]['review']
b_game_info = self.get_gameid_info(self.bday)
for key in all.keys():
if all[key].get('title', None):
all[key]['title'] = b_game_info[key]['title']
all[key]['cate'] = b_game_info[key]['cate']
all[key]['topic'] = b_game_info[key]['topic']
all[key]['score'] = b_game_info[key]['score']
all[key]['reserve'] = b_game_info[key]['reserve']
all[key]['watch'] = b_game_info[key]['watch']
all[key]['download'] = b_game_info[key]['download']
all[key]['sell'] = b_game_info[key]['sell']
all[key]['review'] = b_game_info[key]['review']
print(all)
def get_gameid_info(self):
def get_gameid_info(self, day):
all_data = dict()
sql = f"""SELECT
gameid,
@ -72,7 +84,7 @@ class TapTapReport:
FROM
v_event_25
where
"$part_date"='{self.day}'"""
"$part_date"='{day}'"""
data = self.tga.get_data(sql)
if data:
for line in data: