添加返回localtion的接口
This commit is contained in:
parent
e1d41788ab
commit
cd31fdfb97
@ -8,10 +8,10 @@ import json
|
||||
from myredis.myredis import my_redis
|
||||
import datetime
|
||||
from mysql.mmysql import MysqlBase
|
||||
from config import mysql_promotion_config
|
||||
from prod_config import mysql_promotion_config
|
||||
from log.mylog import define_logger
|
||||
import logging
|
||||
from config import BEGIN, END, ad_list_interface_port
|
||||
from prod_config import BEGIN, END, ad_list_interface_port
|
||||
from tornado import gen
|
||||
import pdb
|
||||
from urllib.parse import unquote
|
||||
@ -33,9 +33,33 @@ class DispatchHandler(tornado.web.RequestHandler):
|
||||
yield self._selfGetAdList()
|
||||
elif self.get_query_argument('c') == 'Ops' and self.get_query_argument('a') == 'upAdRecording':
|
||||
yield self._upAdRecording()
|
||||
elif self.get_query_argument('c') == 'Ops' and self.get_query_argument('a') == 'getLocation':
|
||||
yield self._selfGetLocation()
|
||||
else:
|
||||
self.write("pls check args!")
|
||||
|
||||
def _selfGetLocation(self):
|
||||
gameid = self.get_query_argument['gameid']
|
||||
channelid = self.get_query_argument['channelid'] or 6001
|
||||
mydb = MysqlBase(**mysql_promotion_config)
|
||||
sql = f"select gameid,channelid,id,area,type,mode from location where gameid={gameid} and channelid={channelid} and in_used=1;"
|
||||
try:
|
||||
data = mydb.query(sql)
|
||||
except Exception:
|
||||
log.error("get data from location failed!", exc_info=True)
|
||||
return self.write({'errcode': 2, "errmsg": f"get mysql data failed!"})
|
||||
all_data = []
|
||||
log.debug(f"get data from localtion was {data}")
|
||||
if data:
|
||||
for line in data:
|
||||
if line:
|
||||
localtion = {}
|
||||
localtion['gameid'], localtion['channelid'], localtion['id'], localtion['area'], localtion['type'], \
|
||||
localtion['mode'] = line
|
||||
all_data.append(localtion)
|
||||
del localtion
|
||||
return self.write({'errcode': 0, "errmsg": '', "message": all_data})
|
||||
|
||||
|
||||
def _upAdRecording(self):
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user