Merge branch 'master' of http://git.kingsome.cn/ops/promotion
This commit is contained in:
commit
e56b354e8f
70
README.MD
70
README.MD
@ -190,7 +190,7 @@ http://154.8.214.202:5015/interface/location
|
|||||||
|
|
||||||
##### 请求示范
|
##### 请求示范
|
||||||
|
|
||||||
http://154.8.214.202:5015/interface/location
|
http://154.8.214.202:5015/interface/location?gameid=1004
|
||||||
|
|
||||||
##### 请求参数说明
|
##### 请求参数说明
|
||||||
|
|
||||||
@ -209,15 +209,29 @@ http://154.8.214.202:5015/interface/location
|
|||||||
##### 返回示例
|
##### 返回示例
|
||||||
|
|
||||||
{
|
{
|
||||||
"code": 200,
|
|
||||||
"message": [
|
"code": 200,
|
||||||
{
|
|
||||||
"area": 1,
|
"message": [
|
||||||
"gameid": 1003,
|
|
||||||
"id": 1001,
|
{
|
||||||
"type": 1
|
|
||||||
}
|
"area": "1,1,.1",
|
||||||
]
|
|
||||||
|
"channelid": 6001,
|
||||||
|
|
||||||
|
"gameid": 1003,
|
||||||
|
|
||||||
|
"id": 1010,
|
||||||
|
|
||||||
|
"mode": 2,
|
||||||
|
|
||||||
|
"type": 1
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#### 6、添加位置服务信息
|
#### 6、添加位置服务信息
|
||||||
@ -232,7 +246,7 @@ http://154.8.214.202:5015/interface/location
|
|||||||
|
|
||||||
##### 请求示范
|
##### 请求示范
|
||||||
|
|
||||||
http://154.8.214.202:5015/interface/location?area=1&type=1&gameid=1003
|
http://154.8.214.202:5015/interface/location?gameid=1003&area=1,1,.1&type=1&mode=2
|
||||||
|
|
||||||
##### 请求参数说明
|
##### 请求参数说明
|
||||||
|
|
||||||
@ -240,7 +254,7 @@ http://154.8.214.202:5015/interface/location?area=1&type=1&gameid=1003
|
|||||||
| --------- | ------ | ---- | ------------------------------------------------------------ |
|
| --------- | ------ | ---- | ------------------------------------------------------------ |
|
||||||
| area | string | 是 | 区域(第一元素:1=首页,2=游戏中,3=结算页,4=关闭,第二元素:X轴第三元素:Y轴,其中X,Y取值范围(0,15))如(1,0,0)代表首页左上 |
|
| area | string | 是 | 区域(第一元素:1=首页,2=游戏中,3=结算页,4=关闭,第二元素:X轴第三元素:Y轴,其中X,Y取值范围(0,15))如(1,0,0)代表首页左上 |
|
||||||
| type | int | 是 | 类型(1=icon,2=banner,3=浮窗) |
|
| type | int | 是 | 类型(1=icon,2=banner,3=浮窗) |
|
||||||
| | int | 是 | 广告单播或轮播模式(1=单播,2=轮播) |
|
| mode | int | 是 | 广告单播或轮播模式(1=单播,2=轮播) |
|
||||||
| gameid | int | 是 | 游戏ID |
|
| gameid | int | 是 | 游戏ID |
|
||||||
| channelid | int | 否 | 渠道ID,默认是6001 |
|
| channelid | int | 否 | 渠道ID,默认是6001 |
|
||||||
|
|
||||||
@ -344,22 +358,22 @@ http://154.8.214.202:5015/interface/ad?name=abc&gameid=1003&locationid=1&ad_titl
|
|||||||
|
|
||||||
##### 请求参数说明
|
##### 请求参数说明
|
||||||
|
|
||||||
| 名称 | 类型 | 必填 | 说明 |
|
| 名称 | 类型 | 必填 | 说明 |
|
||||||
| ---------- | -------- | ---- | --------------------------------------------------- |
|
| ---------- | -------- | ---- | ------------------------------------------------------- |
|
||||||
| name | string | 是 | 广告名称 |
|
| name | string | 是 | 广告名称 |
|
||||||
| gameid | int | 是 | 广告投放的游戏ID |
|
| gameid | int | 是 | 广告投放的游戏ID |
|
||||||
| channelid | int | 是 | 渠道ID,默认是6001 NEW |
|
| channelid | int | 是 | 渠道ID,默认是6001 NEW |
|
||||||
| locationid | int | 是 | 位置ID |
|
| locationid | int | 是 | 位置ID,通过该ID到localtion表中获得area,type,mode信息 |
|
||||||
| ad_title | string | 是 | 广告标题 |
|
| ad_title | string | 是 | 广告标题 |
|
||||||
| ad_body | string | 是 | 广告正文 |
|
| ad_body | string | 是 | 广告正文 |
|
||||||
| ad_image | string | 是 | 头像链接 |
|
| ad_image | string | 是 | 头像链接 |
|
||||||
| ad_url | string | 是 | 跳转链接 |
|
| ad_url | string | 是 | 跳转链接 |
|
||||||
| begin_time | datetime | 否 | 开始时间,默认是1999-01-01 |
|
| begin_time | datetime | 否 | 开始时间,默认是1999-01-01 |
|
||||||
| end_time | datetime | 否 | 结束时间,默认是3000-01-01 |
|
| end_time | datetime | 否 | 结束时间,默认是3000-01-01 |
|
||||||
| ad_num | int | 否 | 投放次数,默认是0(次数无限) |
|
| ad_num | int | 否 | 投放次数,默认是0(次数无限) |
|
||||||
| ad_sort | int | 否 | 优先级默认为0 |
|
| ad_sort | int | 否 | 优先级默认为0 |
|
||||||
| status | int | 否 | 默认为0(未审批),1=审批通过,2=审批未通过,3=暂停 |
|
| status | int | 否 | 默认为0(未审批),1=审批通过,2=审批未通过,3=暂停 |
|
||||||
| companyid | int | 是 | 广告提交公司 |
|
| companyid | int | 是 | 广告提交公司 |
|
||||||
|
|
||||||
##### 返回参数说明
|
##### 返回参数说明
|
||||||
|
|
||||||
|
@ -28,7 +28,9 @@ def send_cache_data():
|
|||||||
now = datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
now = datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
all = []
|
all = []
|
||||||
# 添加无天数限定的记录
|
# 添加无天数限定的记录
|
||||||
get_full_data = f"select id,name,ad_num,ad_title,ad_body,ad_image,jump_param,ad_sort,companyid,locationid,gameid,jump_status from ad where begin_time='{BEGIN}' or end_time='{END}'"
|
get_full_data = f"""select a.id,a.name,a.ad_num,a.ad_title,a.ad_body,a.ad_image,a.jump_param,a.ad_sort," \
|
||||||
|
f"a.companyid,a.gameid,a.jump_status,b.area,b.type,b.mode from ad a,location b where \
|
||||||
|
a.locationid=b.id AND begin_time='{BEGIN}' or end_time='{END}'"""
|
||||||
full_data = mydb.query(get_full_data)
|
full_data = mydb.query(get_full_data)
|
||||||
|
|
||||||
if full_data:
|
if full_data:
|
||||||
@ -38,15 +40,16 @@ def send_cache_data():
|
|||||||
item = {}
|
item = {}
|
||||||
try:
|
try:
|
||||||
item['id'], item['name'], item['ad_num'], item['ad_title'], item['ad_body'], item['ad_image'], item[
|
item['id'], item['name'], item['ad_num'], item['ad_title'], item['ad_body'], item['ad_image'], item[
|
||||||
'jump_param'], item['ad_sort'], item['companyid'], item['locationid'], item['gameid'], item[
|
'jump_param'], item['ad_sort'], item['companyid'], item['gameid'], item['jump_status'], item[
|
||||||
'jump_status'] = line
|
'area'], item['type'], item['mode'] = line
|
||||||
all.append(item)
|
all.append(item)
|
||||||
except Exception:
|
except Exception:
|
||||||
log.error("split data failed", exc_info=True)
|
log.error("split data failed", exc_info=True)
|
||||||
|
|
||||||
# 添加有天数限定的记录
|
# 添加有天数限定的记录
|
||||||
get_data_sql = f"select id,name,ad_num,ad_title,ad_body,ad_image,jump_param,ad_sort,companyid,locationid,gameid," \
|
get_data_sql = f"""select a.id,a.name,a.ad_num,a.ad_title,a.ad_body,a.ad_image,a.jump_param,\
|
||||||
f"jump_status from ad where '{now}'>begin_time and '{now}'<end_time ;"
|
a.ad_sort,a.companyid,a.gameid,a.jump_status,b.area,b.type,b.mode from ad a ,location b \
|
||||||
|
where'{now}'>a.begin_time and '{now}'<a.end_time and a.locationid=b.id ;"""
|
||||||
|
|
||||||
data = mydb.query(get_data_sql)
|
data = mydb.query(get_data_sql)
|
||||||
if data:
|
if data:
|
||||||
@ -55,8 +58,7 @@ def send_cache_data():
|
|||||||
item = {}
|
item = {}
|
||||||
try:
|
try:
|
||||||
item['id'], item['name'], item['ad_num'], item['ad_title'], item['ad_body'], item['ad_image'], item[
|
item['id'], item['name'], item['ad_num'], item['ad_title'], item['ad_body'], item['ad_image'], item[
|
||||||
'jump_param'], item['ad_sort'], item['companyid'], item['locationid'], item['gameid'], item[
|
'jump_param'], item['ad_sort'], item['companyid'], item['gameid'], item['jump_status'],item['area'],item['type'],item['mode'] = line
|
||||||
'jump_status'] = line
|
|
||||||
all.append(item)
|
all.append(item)
|
||||||
except Exception:
|
except Exception:
|
||||||
log.error("split data failed", exc_info=True)
|
log.error("split data failed", exc_info=True)
|
||||||
|
@ -29,10 +29,8 @@ class Location(Resource):
|
|||||||
def get(self):
|
def get(self):
|
||||||
gameid = self.args['gameid']
|
gameid = self.args['gameid']
|
||||||
channelid = self.args['channelid'] or 6001
|
channelid = self.args['channelid'] or 6001
|
||||||
sql = f"select gameid,channelid,id,area,type,mode from location where gameid={gameid} and \
|
sql = f"select gameid,channelid,id,area,type,mode from location where gameid={gameid} and channelid={channelid} and in_used=1;"
|
||||||
channelid={channelid} and in_used=1;"
|
|
||||||
try:
|
try:
|
||||||
print(f"1 {sql}")
|
|
||||||
data = self.mydb.query(sql)
|
data = self.mydb.query(sql)
|
||||||
except Exception:
|
except Exception:
|
||||||
log.error("get data from location failed!", exc_info=True)
|
log.error("get data from location failed!", exc_info=True)
|
||||||
@ -49,7 +47,7 @@ class Location(Resource):
|
|||||||
del localtion
|
del localtion
|
||||||
return jsonify({'code': 200, 'message': all_data})
|
return jsonify({'code': 200, 'message': all_data})
|
||||||
else:
|
else:
|
||||||
log.error(f"{data} not found in mysql !")
|
log.error(f"{sql} not found in mysql !")
|
||||||
return jsonify({'code': 200, 'message': ""})
|
return jsonify({'code': 200, 'message': ""})
|
||||||
|
|
||||||
|
|
||||||
@ -65,7 +63,6 @@ class Location(Resource):
|
|||||||
location['mode'] = self.args['mode']
|
location['mode'] = self.args['mode']
|
||||||
location['gameid'] = self.args['gameid']
|
location['gameid'] = self.args['gameid']
|
||||||
location['channelid'] = self.args['channelid'] or 6001
|
location['channelid'] = self.args['channelid'] or 6001
|
||||||
|
|
||||||
location['id'] = self.create_id()
|
location['id'] = self.create_id()
|
||||||
self.mydb.insert("location", location)
|
self.mydb.insert("location", location)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user