Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
99889093e8 | ||
![]() |
712d66adf2 | ||
![]() |
c59eb50433 | ||
![]() |
8f0cac8aa5 | ||
![]() |
68998216ca | ||
![]() |
5f7ff0eb7b | ||
![]() |
b7131670b6 | ||
![]() |
3442098337 | ||
![]() |
0477ccb57e | ||
![]() |
7030f1e45e |
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,4 +13,3 @@ Thumbs.db
|
|||||||
.pem
|
.pem
|
||||||
test_*
|
test_*
|
||||||
*.pid
|
*.pid
|
||||||
.vscode/settings.json
|
|
||||||
|
@ -53,7 +53,9 @@ class DispatchHandler(tornado.web.RequestHandler):
|
|||||||
if not post_data:
|
if not post_data:
|
||||||
post_data = self.request.body.decode('utf-8')
|
post_data = self.request.body.decode('utf-8')
|
||||||
post_data = json.loads(post_data)
|
post_data = json.loads(post_data)
|
||||||
redis_key = f"ad::jumpRecording"
|
post_data['time']=datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
today = datetime.datetime.now().strftime("%Y%m%d")
|
||||||
|
redis_key = f"ad::jumpRecording::{today}"
|
||||||
try:
|
try:
|
||||||
my_redis.lpush(redis_key, json.dumps(post_data))
|
my_redis.lpush(redis_key, json.dumps(post_data))
|
||||||
return self.write({'errcode': 0, "errmsg": ''})
|
return self.write({'errcode': 0, "errmsg": ''})
|
||||||
@ -140,7 +142,7 @@ class DispatchHandler(tornado.web.RequestHandler):
|
|||||||
input = json.loads(self.get_query_argument('body'))
|
input = json.loads(self.get_query_argument('body'))
|
||||||
gameid = input['gameid']
|
gameid = input['gameid']
|
||||||
channelid=input.get('channelid',None) or 6001
|
channelid=input.get('channelid',None) or 6001
|
||||||
area=input.get('area',None)
|
area = input.get('area', None)
|
||||||
locationid = input.get('locationid',0)
|
locationid = input.get('locationid',0)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
result = {'errcode': 2, "errmsg": f"get args failed,{str(e)}"}
|
result = {'errcode': 2, "errmsg": f"get args failed,{str(e)}"}
|
||||||
@ -190,8 +192,10 @@ class DispatchHandler(tornado.web.RequestHandler):
|
|||||||
temp = my_redis.hgetall(f"adinfo::{id}::info")
|
temp = my_redis.hgetall(f"adinfo::{id}::info")
|
||||||
if temp:
|
if temp:
|
||||||
info.append(temp)
|
info.append(temp)
|
||||||
info_new = sorted(info, key=lambda s: int(s.get('ad_sort', 9999)))
|
# info_new = sorted(info, key=lambda s: int(s.get('ad_sort', 9999)))
|
||||||
result = {'errcode': 0, "errmsg": '', "message": {"totoal": len(info_new), "result": info_new}}
|
# result = {'errcode': 0, "errmsg": '', "message": {"totoal": len(info_new),
|
||||||
|
# "result": info_new}}
|
||||||
|
result = {'errcode': 0, "errmsg": '', "message": {"totoal": len(info), "result": info}}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
result = {'errcode': 1, "errmsg": e}
|
result = {'errcode': 1, "errmsg": e}
|
||||||
return self.write(result)
|
return self.write(result)
|
||||||
|
@ -155,7 +155,7 @@ class Ad(Resource):
|
|||||||
# 检查该广告是否已存在
|
# 检查该广告是否已存在
|
||||||
try:
|
try:
|
||||||
check_sql = f"select id from ad where name='{ad['name']}' and gameid={ad['gameid']} and \
|
check_sql = f"select id from ad where name='{ad['name']}' and gameid={ad['gameid']} and \
|
||||||
locationid={ad['locationid']} and companyid=ad['companyid']"
|
locationid=‘{ad['locationid']}’ and companyid={ad['companyid']}"
|
||||||
data = self.mydb.query(check_sql)
|
data = self.mydb.query(check_sql)
|
||||||
if data:
|
if data:
|
||||||
return jsonify({'code': 500, 'message': f"name={ad['name']} gameid={ad['gameid']} was in db!"})
|
return jsonify({'code': 500, 'message': f"name={ad['name']} gameid={ad['gameid']} was in db!"})
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
myenv="test"
|
myenv="prod"
|
||||||
|
@ -6,7 +6,7 @@ from ops.env import myenv
|
|||||||
ad_mysql_pwd = os.getenv('adpwd') or 'vF4j56AfxU3P'
|
ad_mysql_pwd = os.getenv('adpwd') or 'vF4j56AfxU3P'
|
||||||
log_path = "/data/logs"
|
log_path = "/data/logs"
|
||||||
if myenv == 'prod':
|
if myenv == 'prod':
|
||||||
redis_company_config = {'host': '10.10.4.8', 'port': 6379, 'db': 1, 'passwd': 'crs-9ltb97ds:i33dkxshh'}
|
redis_company_config = {'host': '10.10.4.8', 'port': 6379, 'db': 13, 'passwd': 'crs-9ltb97ds:i33dkxshh'}
|
||||||
mysql_promotion_config = {'user': 'ad', 'pswd': ad_mysql_pwd, 'host': '10.10.3.5', 'db': 'ad'}
|
mysql_promotion_config = {'user': 'ad', 'pswd': ad_mysql_pwd, 'host': '10.10.3.5', 'db': 'ad'}
|
||||||
ad_list_interface_port = 5014
|
ad_list_interface_port = 5014
|
||||||
priv_i_port=5015
|
priv_i_port=5015
|
||||||
|
Loading…
x
Reference in New Issue
Block a user