Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DA-Platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
文档服务地址:
http://47.92.0.57:3000/
周报索引地址:
http://47.92.0.57:3000/s/NruNXRYmV
Open sidebar
Berlin
DA-Platform
Commits
29108bba
Commit
29108bba
authored
Jun 24, 2020
by
李景熙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改上传文件的相关代码,将数据库配置统一移到model文件中
parent
fedc9736
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
10 additions
and
64 deletions
+10
-64
ReleaseTask.vue
DAPlatform-front/src/components/ReleaseTask.vue
+1
-1
Data.py
DAPlatform/Dao/Data.py
+1
-10
Relation.py
DAPlatform/Dao/Relation.py
+1
-10
Slice.py
DAPlatform/Dao/Slice.py
+1
-10
Task.py
DAPlatform/Dao/Task.py
+1
-11
User.py
DAPlatform/Dao/User.py
+2
-14
app.py
DAPlatform/app.py
+1
-2
uploadDownload.py
DAPlatform/views/uploadDownload.py
+2
-6
No files found.
DAPlatform-front/src/components/ReleaseTask.vue
View file @
29108bba
...
...
@@ -367,7 +367,7 @@
if
(
res
.
code
==
0
)
alert
(
"文件上传失败,请重新上传"
);
else
{
console
(
res
.
data
.
url
);
console
(
res
.
data
);
}
})
},
...
...
DAPlatform/Dao/Data.py
View file @
29108bba
from
peewee
import
*
mysql
=
MySQLDatabase
(
'sys'
,
host
=
'127.0.0.1'
,
user
=
'root'
,
passwd
=
'root'
,
charset
=
'utf8'
)
mysql
.
connect
()
from
Dao.model
import
mysql
class
Data
(
Model
):
...
...
DAPlatform/Dao/Relation.py
View file @
29108bba
from
peewee
import
*
from
Dao.model
import
mysql
import
datetime
mysql
=
MySQLDatabase
(
'sys'
,
host
=
'127.0.0.1'
,
user
=
'root'
,
passwd
=
'root'
,
charset
=
'utf8'
)
mysql
.
connect
()
class
Result
:
code
:
int
...
...
DAPlatform/Dao/Slice.py
View file @
29108bba
from
Dao
import
Task
from
peewee
import
*
mysql
=
MySQLDatabase
(
'sys'
,
host
=
'127.0.0.1'
,
user
=
'root'
,
passwd
=
'root'
,
charset
=
'utf8'
)
mysql
.
connect
()
from
Dao.model
import
mysql
class
Result
:
code
:
int
...
...
DAPlatform/Dao/Task.py
View file @
29108bba
...
...
@@ -2,17 +2,7 @@ from peewee import *
import
datetime
import
math
from
Dao
import
User
mysql
=
MySQLDatabase
(
'sys'
,
host
=
'127.0.0.1'
,
user
=
'root'
,
passwd
=
'root'
,
charset
=
'utf8'
)
mysql
.
connect
()
from
Dao.model
import
mysql
class
Result
:
code
:
int
...
...
DAPlatform/Dao/User.py
View file @
29108bba
from
peewee
import
*
mysql
=
MySQLDatabase
(
'sys'
,
host
=
'127.0.0.1'
,
user
=
'root'
,
passwd
=
'root'
,
charset
=
'utf8'
)
mysql
.
connect
()
from
Dao.model
import
mysql
class
Result
:
code
:
int
...
...
@@ -175,7 +165,5 @@ def get_username(id):
return
tmp
.
userName
if
__name__
==
'__main__'
:
register
(
'admin'
,
'admin'
,
'admin'
)
set_type
(
3
,
1
)
# User.create_table()
User
.
create_table
()
DAPlatform/app.py
View file @
29108bba
from
flask
import
Flask
from
flask_cors
import
CORS
from
views.uploadDownload
import
uploadDownload
# from views.textAnnotation import textAnnotation
from
views.user
import
user
...
...
@@ -11,6 +9,7 @@ from views.slice import slice
from
config.config
import
DevelopmentConfig
app
=
Flask
(
__name__
)
CORS
(
app
)
app
.
config
.
from_object
(
DevelopmentConfig
)
...
...
DAPlatform/views/uploadDownload.py
View file @
29108bba
...
...
@@ -22,7 +22,6 @@ def allowed_file(filename):
# 上传文件
@uploadDownload.route
(
'/upload'
,
methods
=
[
'POST'
],
strict_slashes
=
False
)
def
upload
():
print
(
"1"
)
file_dir
=
os
.
path
.
join
(
basedir
,
UPLOAD_FOLDER
)
if
not
os
.
path
.
exists
(
file_dir
):
os
.
makedirs
(
file_dir
)
...
...
@@ -33,12 +32,9 @@ def upload():
unix_time
=
int
(
time
.
time
())
new_filename
=
str
(
unix_time
)
+
'.'
+
ext
# 修改了上传的文件名
f
.
save
(
os
.
path
.
join
(
file_dir
,
new_filename
))
# 保存文件到upload目录
print
(
new_filename
)
return
jsonify
({
"errno"
:
0
,
"msg"
:
"succeed "
,
"token"
:
new_filename
})
return
jsonify
({
"code"
:
1
,
"msg"
:
"succeed "
,
"data"
:
"http://127.0.0.1:9100/api/files/download/"
+
new_filename
})
else
:
return
jsonify
({
"errno"
:
1001
,
"errmsg"
:
u"failed"
})
return
jsonify
({
"code"
:
0
,
"errmsg"
:
u"failed"
})
# 下载接口
@uploadDownload.route
(
'/download/<fileName>'
,
methods
=
[
'GET'
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment