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
5690afa1
Commit
5690afa1
authored
Jul 02, 2020
by
李景熙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改选择分片后端
parent
9d9dc147
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
Relation.py
DAPlatform/Dao/Relation.py
+3
-3
slice.py
DAPlatform/views/slice.py
+15
-5
No files found.
DAPlatform/Dao/Relation.py
View file @
5690afa1
...
@@ -23,7 +23,7 @@ class Relation(Model):
...
@@ -23,7 +23,7 @@ class Relation(Model):
flag
=
BooleanField
(
default
=
False
)
# 代表该标注关系是否被标注
flag
=
BooleanField
(
default
=
False
)
# 代表该标注关系是否被标注
score
=
IntegerField
(
default
=
0
)
score
=
IntegerField
(
default
=
0
)
receive_time
=
DateTimeField
(
default
=
datetime
.
datetime
.
now
())
receive_time
=
DateTimeField
(
default
=
datetime
.
datetime
.
now
())
complete_time
=
DateTimeField
()
complete_time
=
DateTimeField
(
null
=
True
)
class
Meta
:
class
Meta
:
database
=
mysql
database
=
mysql
...
@@ -32,10 +32,10 @@ class Relation(Model):
...
@@ -32,10 +32,10 @@ class Relation(Model):
# 创建标注关系
# 创建标注关系
def
create_relation
(
slice_id
,
user_id
,
data_id
):
def
create_relation
(
slice_id
,
user_id
,
data_id
):
try
:
try
:
Slice
.
add_
annotation
(
slice_id
)
Slice
.
add_
file
(
slice_id
)
relation
=
Relation
(
slice_id
=
slice_id
,
user_id
=
user_id
,
data_id
=
data_id
)
relation
=
Relation
(
slice_id
=
slice_id
,
user_id
=
user_id
,
data_id
=
data_id
)
relation
.
save
()
relation
.
save
()
except
Exception
:
except
:
return
Result
(
0
,
"create failed"
,
{})
return
Result
(
0
,
"create failed"
,
{})
else
:
else
:
return
Result
(
1
,
"create success"
,
{})
return
Result
(
1
,
"create success"
,
{})
...
...
DAPlatform/views/slice.py
View file @
5690afa1
...
@@ -23,13 +23,23 @@ def get_pieces():
...
@@ -23,13 +23,23 @@ def get_pieces():
@slice.route
(
"/selectPieces"
,
methods
=
[
"Post"
])
@slice.route
(
"/selectPieces"
,
methods
=
[
"Post"
])
def
select_pieces
():
def
select_pieces
():
# 接收前端传回的用户id与分片列表,将每个分片下的每一个文件创建一个relation
# 接收前端传回的用户id与分片列表,将每个分片下的每一个文件创建一个relation
userId
=
request
.
args
[
'userId'
]
data
=
request
.
get_json
(
silent
=
True
)
selected
=
request
.
args
[
'selected'
]
userId
=
int
(
data
[
'userId'
])
print
(
"select_pieces"
)
selected
=
list
(
data
[
'selected'
]
)
for
sliceItem
in
selected
:
for
sliceItem
in
selected
:
dataList
=
Data
.
find_data_by_slice
(
sliceItem
)
ret
=
Data
.
find_data_by_slice
(
sliceItem
)
if
ret
.
code
==
0
:
res
=
{
'code'
:
ret
.
code
,
'message'
:
ret
.
message
,
'data'
:
ret
.
data
}
return
json
.
dumps
(
res
)
dataList
=
ret
.
data
for
dataItem
in
dataList
:
for
dataItem
in
dataList
:
ret
=
Relation
.
create_relation
(
sliceItem
,
userId
,
dataItem
)
dataId
=
dataItem
[
'id'
]
ret
=
Relation
.
create_relation
(
sliceItem
,
userId
,
dataId
)
if
ret
.
code
==
0
:
if
ret
.
code
==
0
:
res
=
{
res
=
{
'code'
:
ret
.
code
,
'code'
:
ret
.
code
,
...
...
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