add interface setting
This commit is contained in:
parent
44e388ae36
commit
981bdc1a62
@ -1,5 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import requests
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Mp2shushu():
|
||||
def __init__(self, channel, gameid):
|
||||
self.mp_url = f"https://mp.kingsome.cn/api/open/promotion/co-list?channelid={channel}&gameid={gameid}"
|
||||
|
||||
def get_ad_list(self):
|
||||
r = requests.get(self.mp_url)
|
||||
if r.status_code == requests.codes.ok:
|
||||
return r.json()
|
||||
else:
|
||||
return None
|
||||
|
||||
def split_data(self, data):
|
||||
try:
|
||||
result = data['result']
|
||||
except Exception:
|
||||
log.error(f"split {data} failed!", exc_info=True)
|
||||
result = None
|
||||
return result
|
||||
|
26
web.py
26
web.py
@ -1,21 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# 推广系统对外接口,提供与客户端之间的广告信息接口及每分钟执行一次的缓存变更操作
|
||||
# http://ad.kingsome.cn/webapp/index.php?c=Ops&a=getAdList&body={"gameid":1004,"locationid":1001}
|
||||
# http://ad.kingsome.cn/webapp/index.php?c=Ops&a=upAdRecording&adid=1002
|
||||
# python ad_interface_tornado.py --port=6013
|
||||
# ops 通用接口
|
||||
# python web.py --port=6013
|
||||
import tornado.ioloop
|
||||
import tornado.web
|
||||
import tornado.options
|
||||
from tornado import gen
|
||||
import json
|
||||
import datetime
|
||||
|
||||
from ops.mylog import define_logger
|
||||
from ops.mlog import define_logger
|
||||
import logging
|
||||
|
||||
from config.config import *
|
||||
import pdb
|
||||
|
||||
from data_channel.gamelog_external import Build_Gamelog_Config
|
||||
|
||||
|
||||
define_logger("/data/logs/ops/ops_interface.log")
|
||||
@ -26,10 +22,10 @@ tornado.options.define("port", default=interface_port, type=int, help="run serve
|
||||
class DispatchHandler(tornado.web.RequestHandler):
|
||||
@gen.coroutine
|
||||
def get(self):
|
||||
if self.get_query_argument('c') == 'Ops' and self.get_query_argument('a') == 'selfChecking':
|
||||
self._selfCheckingHandler()
|
||||
elif self.get_query_argument('c') == 'Ops' and self.get_query_argument('a') == 'getAdList':
|
||||
yield self._selfGetAdList()
|
||||
if self.get_query_argument('c') == 'Ops' and self.get_query_argument('a') == 'sync_log_conf':
|
||||
self._selfgamelogexternal()
|
||||
elif self.get_query_argument('c') == 'Ops' and self.get_query_argument('a') == 'xxx':
|
||||
yield self._selfxxx()
|
||||
else:
|
||||
self.write("pls check args!")
|
||||
|
||||
@ -38,8 +34,12 @@ class DispatchHandler(tornado.web.RequestHandler):
|
||||
if self.get_query_argument('c') == 'Ops' and self.get_query_argument('a') == 'upJumpRecording':
|
||||
self._selfupJumpRecording()
|
||||
|
||||
def _selfgamelogexternal(self):
|
||||
cc = Build_Gamelog_Config()
|
||||
cc.run()
|
||||
|
||||
|
||||
def selfxxx(self):
|
||||
pass
|
||||
|
||||
|
||||
def make_app():
|
||||
|
Loading…
x
Reference in New Issue
Block a user