Compare commits

..

10 Commits
test ... master

Author SHA1 Message Date
pengtao
99889093e8 Merge remote-tracking branch 'origin/master' 2021-07-28 16:35:30 +08:00
pengtao
712d66adf2 fix bug as select id from ad where name='极乐' and gameid=3201 and locationid=[1180] and companyid=ad['companyid'] 2021-07-28 16:34:58 +08:00
root
c59eb50433 a 2021-06-02 10:21:17 +08:00
pengtao
8f0cac8aa5 取消sort by ad_sort 2019-10-30 16:24:18 +08:00
pengtao
68998216ca sort by ad_sort 2019-10-30 16:10:02 +08:00
pengtao
5f7ff0eb7b fix datetime format 2019-10-29 19:34:04 +08:00
pengtao
b7131670b6 redis key添加时间戳 2019-10-18 17:17:16 +08:00
pengtao
3442098337 数据上报添加时间 2019-10-18 17:15:49 +08:00
pengtao
0477ccb57e fix bug 2019-10-11 12:26:29 +08:00
pengtao
7030f1e45e fix redis db for prod 2019-10-11 10:53:14 +08:00
6 changed files with 12 additions and 9 deletions

1
.gitignore vendored
View File

@ -13,4 +13,3 @@ Thumbs.db
.pem
test_*
*.pid
.vscode/settings.json

View File

@ -53,7 +53,9 @@ class DispatchHandler(tornado.web.RequestHandler):
if not post_data:
post_data = self.request.body.decode('utf-8')
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:
my_redis.lpush(redis_key, json.dumps(post_data))
return self.write({'errcode': 0, "errmsg": ''})
@ -140,7 +142,7 @@ class DispatchHandler(tornado.web.RequestHandler):
input = json.loads(self.get_query_argument('body'))
gameid = input['gameid']
channelid=input.get('channelid',None) or 6001
area=input.get('area',None)
area = input.get('area', None)
locationid = input.get('locationid',0)
except Exception as 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")
if temp:
info.append(temp)
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}}
# 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), "result": info}}
except Exception as e:
result = {'errcode': 1, "errmsg": e}
return self.write(result)

View File

@ -155,7 +155,7 @@ class Ad(Resource):
# 检查该广告是否已存在
try:
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)
if data:
return jsonify({'code': 500, 'message': f"name={ad['name']} gameid={ad['gameid']} was in db!"})

View File

@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
myenv="test"
myenv="prod"

View File

@ -6,7 +6,7 @@ from ops.env import myenv
ad_mysql_pwd = os.getenv('adpwd') or 'vF4j56AfxU3P'
log_path = "/data/logs"
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'}
ad_list_interface_port = 5014
priv_i_port=5015

View File

@ -30,4 +30,4 @@ api.add_resource(RelushADinfo, '/interface/reflush_adinfo')
if __name__ == '__main__':
app.run(host='0.0.0.0', debug=True, port=6015)
app.run(host='0.0.0.0', debug=True, port=5015)