修改ad删除流程
This commit is contained in:
parent
465b686187
commit
a807e052e7
@ -411,7 +411,7 @@ http://154.8.214.202:5015/interface/promotion?name=abc&gameid=1003&locationid=1&
|
||||
"code": 200
|
||||
}
|
||||
|
||||
#### 11、删除广告信息
|
||||
#### 11、删除广告信息,实际将status 改为4
|
||||
|
||||
##### 接口地址
|
||||
|
||||
|
@ -189,15 +189,34 @@ def send_cache_data():
|
||||
|
||||
# 删除过期的数据
|
||||
log.info("remove expire data from cache!")
|
||||
expire_sql = f"select id,gameid,locationid from ad where '{now}'>end_time"
|
||||
|
||||
expire_sql = f"""select
|
||||
a.id,a.gameid,a.channelid,a.locationid,a.status,b.area
|
||||
from
|
||||
(select
|
||||
id,gameid,channelid,locationid,status
|
||||
from
|
||||
ad
|
||||
where
|
||||
'{now}'> end_time
|
||||
or status in (3,4) ) a ,
|
||||
(select
|
||||
id,
|
||||
area
|
||||
from
|
||||
location) b
|
||||
where
|
||||
a.locationid=b.id"""
|
||||
remove_data = mydb.query(expire_sql)
|
||||
if remove_data:
|
||||
for line in remove_data:
|
||||
try:
|
||||
id, gameid, locationid = line
|
||||
key = f"{gameid}:{locationid}"
|
||||
id, gameid, channelid, locationid, _, area = line
|
||||
key = f"ad::{gameid}::{channelid}::{area.split(',')[0].strip()}::{locationid}"
|
||||
# key = f"{gameid}:{locationid}"
|
||||
if my_redis.sismember(key, id):
|
||||
my_redis.srem(key, id)
|
||||
my_redis.expire(f"ad::{id}::info", 1)
|
||||
log.info(f"remove {id} from {key} success!")
|
||||
except Exception:
|
||||
log.error("拆解过期数据出错!", exc_info=True)
|
||||
|
@ -181,7 +181,7 @@ class Ad(Resource):
|
||||
if not id:
|
||||
return jsonify({'code': 404, 'message': f'{id} not found!'})
|
||||
#del_sql = f"delete from ad where id={id};"
|
||||
del_sql = f"update ad set in_used=0 where id={id};"
|
||||
del_sql = f"update ad set status=4 where id={id};"
|
||||
try:
|
||||
self.mydb.change(del_sql)
|
||||
return jsonify({'code': 200, 'message': f'remove adid={id} success!'})
|
||||
|
Loading…
x
Reference in New Issue
Block a user