文档服务地址:http://47.92.0.57:3000/ 周报索引地址:http://47.92.0.57:3000/s/NruNXRYmV

Commit 212c39b3 by 李景熙

修改任务url存储

parent a236a043
...@@ -31,7 +31,7 @@ def upload(): ...@@ -31,7 +31,7 @@ def upload():
unix_time = int(time.time()) unix_time = int(time.time())
new_filename = str(unix_time)+ext # 修改了上传的文件名 new_filename = str(unix_time)+ext # 修改了上传的文件名
f.save(os.path.join(file_dir, new_filename)) # 保存文件到upload目录 f.save(os.path.join(file_dir, new_filename)) # 保存文件到upload目录
return jsonify({"code": 1, "msg": "succeed ", "data": "http://127.0.0.1:9100/api/files/upload/"+new_filename}) return jsonify({"code": 1, "msg": "succeed ", "data": new_filename})
else: else:
return jsonify({"code": 0, "errmsg": u"failed"}) return jsonify({"code": 0, "errmsg": u"failed"})
...@@ -45,8 +45,8 @@ def download(fileName): ...@@ -45,8 +45,8 @@ def download(fileName):
@uploadDownload.route('/delFile', methods=['POST']) @uploadDownload.route('/delFile', methods=['POST'])
def delFile(): def delFile():
data = request.get_json(silent=True) data = request.get_json(silent=True)
url=data['url'] fileName=data['filename']
file_dir = os.path.join(basedir, UPLOAD_FOLDER, url[39:]) file_dir = os.path.join(basedir, UPLOAD_FOLDER, fileName)
if not os.path.exists(file_dir): if not os.path.exists(file_dir):
return jsonify({"code": 0, "errmsg": u"failed"}) return jsonify({"code": 0, "errmsg": u"failed"})
else: else:
......
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