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

Commit 42813969 by 李景熙

修改删除任务功能,使其同时删除保存的文件

parent d7250f00
......@@ -2222,8 +2222,8 @@
},
"complex.js": {
"version": "2.0.11",
"resolved": "https://registry.npm.taobao.org/complex.js/download/complex.js-2.0.11.tgz",
"integrity": "sha1-Cahz+/Ff/YwYycIgHM70JcMri/E="
"resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.0.11.tgz",
"integrity": "sha512-6IArJLApNtdg1P1dFtn3dnyzoZBEF0MwMnrfF1exSBRpZYoy4yieMkpZhQDC0uwctw48vii0CFVyHfpgZ/DfGw=="
},
"component-emitter": {
"version": "1.3.0",
......@@ -3538,8 +3538,8 @@
},
"decimal.js": {
"version": "10.2.0",
"resolved": "https://registry.npm.taobao.org/decimal.js/download/decimal.js-10.2.0.tgz",
"integrity": "sha1-OUZhE6ngNhEdAvgkibX9awte0jE="
"resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.2.0.tgz",
"integrity": "sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw=="
},
"decode-uri-component": {
"version": "0.2.0",
......@@ -4103,8 +4103,8 @@
},
"escape-latex": {
"version": "1.2.0",
"resolved": "https://registry.npm.taobao.org/escape-latex/download/escape-latex-1.2.0.tgz",
"integrity": "sha1-B8A4GM99rCUMzlF/T9obAB7yvKE="
"resolved": "https://registry.npmjs.org/escape-latex/-/escape-latex-1.2.0.tgz",
"integrity": "sha512-nV5aVWW1K0wEiUIEdZ4erkGGH8mDxGyxSeqPzRNtWP7ataw+/olFObw7hujFWlVjNsaDFw5VZ5NzVSIqRgfTiw=="
},
"escape-string-regexp": {
"version": "1.0.5",
......@@ -4998,8 +4998,8 @@
},
"fraction.js": {
"version": "4.0.12",
"resolved": "https://registry.npm.taobao.org/fraction.js/download/fraction.js-4.0.12.tgz",
"integrity": "sha1-BSbUfGWl+0hU33i8d/e+xwjXuMM="
"resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.0.12.tgz",
"integrity": "sha512-8Z1K0VTG4hzYY7kA/1sj4/r1/RWLBD3xwReT/RCrUCbzPszjNQCCsy3ktkU/eaEqX3MYa4pY37a52eiBlPMlhA=="
},
"fragment-cache": {
"version": "0.2.1",
......@@ -6704,7 +6704,7 @@
},
"javascript-natural-sort": {
"version": "0.7.1",
"resolved": "https://registry.npm.taobao.org/javascript-natural-sort/download/javascript-natural-sort-0.7.1.tgz",
"resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz",
"integrity": "sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k="
},
"js-base64": {
......@@ -7069,8 +7069,8 @@
},
"mathjs": {
"version": "7.0.2",
"resolved": "https://registry.npm.taobao.org/mathjs/download/mathjs-7.0.2.tgz?cache=0&sync_timestamp=1592989416336&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fmathjs%2Fdownload%2Fmathjs-7.0.2.tgz",
"integrity": "sha1-8X6uKJqjpd5UPCLAXOMnFWBFRIA=",
"resolved": "https://registry.npmjs.org/mathjs/-/mathjs-7.0.2.tgz",
"integrity": "sha512-+/HTkdie4Sek66mjcclk2cgTyVgFfykutk5PGspbtZHUBbS3lOeiM8/Ax7P6nQlz1KoellFAU/kGO4q7Yv1sZA==",
"requires": {
"complex.js": "^2.0.11",
"decimal.js": "^10.2.0",
......@@ -11389,7 +11389,7 @@
},
"seed-random": {
"version": "2.2.0",
"resolved": "https://registry.npm.taobao.org/seed-random/download/seed-random-2.2.0.tgz",
"resolved": "https://registry.npmjs.org/seed-random/-/seed-random-2.2.0.tgz",
"integrity": "sha1-KpsZ4lCoFwmSMaW5mk2vgLf77VQ="
},
"select-hose": {
......@@ -12359,8 +12359,8 @@
},
"tiny-emitter": {
"version": "2.1.0",
"resolved": "https://registry.npm.taobao.org/tiny-emitter/download/tiny-emitter-2.1.0.tgz",
"integrity": "sha1-HRpW7fxRxD6GPLtTgqcjMONVVCM="
"resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
"integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q=="
},
"tmp": {
"version": "0.0.33",
......@@ -12506,8 +12506,8 @@
},
"typed-function": {
"version": "1.1.1",
"resolved": "https://registry.npm.taobao.org/typed-function/download/typed-function-1.1.1.tgz?cache=0&sync_timestamp=1593755771661&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftyped-function%2Fdownload%2Ftyped-function-1.1.1.tgz",
"integrity": "sha1-oTFhh+w2KMniGbkcqWkYZgoQE44="
"resolved": "https://registry.npmjs.org/typed-function/-/typed-function-1.1.1.tgz",
"integrity": "sha512-RbN7MaTQBZLJYzDENHPA0nUmWT0Ex80KHItprrgbTPufYhIlTePvCXZxyQK7wgn19FW5bnuaBIKcBb5mRWjB1Q=="
},
"typedarray": {
"version": "0.0.6",
......
import os
from peewee import *
from Dao.model import mysql
from Dao import Slice
from support import basedir
UPLOAD_FOLDER = 'upload'
class Result:
......@@ -47,7 +52,7 @@ def find_data(id):
return Result(1, "find success", data.url)
# 查找某分片下的文件
# 查找某分片下的文件(用于查看某分片下的文件信息)
def find_data_by_slice(slice_id):
try:
find = Data.select(Data.data_id, Data.name, Data.size, Data.url).where(
......@@ -71,7 +76,7 @@ def find_data_by_slice(slice_id):
return Result(1, "find success", list)
# 查找分片下的文件url列表
# 查找分片下的文件列表(用于修改任务时传回文件信息)
def find_url_by_slice(slice_id):
try:
find = Data.select(Data.url, Data.name, Data.size).where(
......@@ -94,6 +99,13 @@ def find_url_by_slice(slice_id):
# 删除某分片下的文件
def delete_data_by_slice(slice_id):
try:
find = Data.select(Data.url).where(Data.slice_id == slice_id)
index = 0
while index < len(find):
file_dir = os.path.join(basedir, UPLOAD_FOLDER, find[index].url)
if os.path.exists(file_dir):
os.remove(file_dir)
index += 1
Data.delete().where(Data.slice_id == slice_id).execute()
except:
return Result(0, "delete failed", {})
......@@ -102,4 +114,4 @@ def delete_data_by_slice(slice_id):
if __name__ == '__main__':
Data.create_table()
\ No newline at end of file
delete_data_by_slice(10)
\ No newline at end of file
......@@ -52,4 +52,4 @@ def select_pieces():
'code': 1,
'message': "ok",
}
return json.dumps(res)
\ No newline at end of file
return json.dumps(res)
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