传递日期参数

This commit is contained in:
pengtao 2019-10-23 20:19:20 +08:00
parent e071eda29b
commit a843ed463a

View File

@ -10,7 +10,7 @@ from collections import defaultdict
from ops.plog import define_logger
import logging
import datetime
import requests
define_logger("/data/logs/ops/daily_report.log")
import pdb
@ -277,12 +277,37 @@ class Report:
else:
return None
def get_args_cn(self):
gameids_cn = dict()
channel_cn = dict()
url = "http://10.10.5.4:2333/api/open/games/list"
r = requests.get(url)
if r.status_code == requests.codes.ok:
data = r.json().get('gameList')
for line in data:
try:
gameids_cn[line.get('game_id')] = line.get('game')
channel_cn[line.get('platform_id')] = line.get('platform')
except Exception:
log.error(f"split {line} failed!", exc_info=True)
return (gameids_cn, channel_cn)
else:
return None
def run(self):
if self.project == 'mini_games':
parms = [(1004, 6001), (1011, 6001), (1001, 6001)]
else:
parms = [(2001, 6001), (2002, 6001)]
cn = self.get_args_cn()
if not cn:
return None
else:
game_cn, chanel_cn = cn
data = list()
for item in parms:
args = {}
@ -290,8 +315,8 @@ class Report:
# key = f"{args['gameid']}#{args['channelid']}"
temp = {}
temp['gameid'] = args['gameid']
temp['channelid'] = args['channelid']
temp['gameid'] = game_cn.get(args['gameid'], None)
temp['channelid'] = chanel_cn.get(args['channelid'], None)
temp['input'] = defaultdict(list)
temp['output'] = defaultdict(list)
temp['input'] = []