55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
# ops 通用接口
|
|
# python web.py --port=6013
|
|
import tornado.ioloop
|
|
import tornado.web
|
|
import tornado.options
|
|
from tornado import gen
|
|
|
|
from ops.mylog 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")
|
|
log = logging.getLogger(__name__)
|
|
tornado.options.define("port", default=interface_port, type=int, help="run server on the given port.")
|
|
|
|
|
|
class DispatchHandler(tornado.web.RequestHandler):
|
|
@gen.coroutine
|
|
def get(self):
|
|
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!")
|
|
|
|
@gen.coroutine
|
|
def post(self):
|
|
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():
|
|
return tornado.web.Application([(r"/webapp/index[\.]php", DispatchHandler)])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print('start!')
|
|
tornado.options.parse_command_line()
|
|
app = make_app()
|
|
app.listen(tornado.options.options.port)
|
|
tornado.ioloop.IOLoop.current().start()
|