Commit 76520487 by 高宇强

gyq

parent 190a5a33
......@@ -5,8 +5,9 @@ import pymysql,requests
import random
import re
import customizelogosmall
import json
import os
import time
import shutil
from threading import Thread
#随机取50个descid,其中15个模板id,35个logoid
......@@ -461,3 +462,19 @@ def ReturnLogoInfo(inputdata,curpage,pagesize):
return False, 0, []
except:
return False, 0, []
#删除临时文件
def Deletefile():
try:
dirlist = ["data", "downlogo", "generatordir", "logodir"]
for dir in dirlist:
for root, dirs, files in os.walk(dir):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
shutil.rmtree(os.path.join(root, name))
return True
except Exception as e:
print(str(e))
return False
......@@ -212,6 +212,14 @@ def CreateLogoApi():#得到场景信息
return json.dumps({"status": -1, "msg": "调用服务出错", "data": ""}, ensure_ascii=False)
@app.route('/api/deletefile', methods = ['POST'])
def DeletefileApi():#删除临时文件
istrue = LogoManage.Deletefile()
if istrue:
return json.dumps({"status": 0, "msg": "删除成功"}, ensure_ascii=False)
else:
return json.dumps({"status": -1, "msg": "删除失败"}, ensure_ascii=False)
if __name__ == '__main__':
CORS(app, supports_credentials=True)#允许跨域
app.run(host='0.0.0.0', port=80, debug=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment