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
20524ed2
Commit
20524ed2
authored
Jun 25, 2020
by
李景熙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改Data中函数的返回
parent
8510e7fd
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
6 deletions
+20
-6
Data.py
DAPlatform/Dao/Data.py
+15
-5
Slice.py
DAPlatform/Dao/Slice.py
+3
-1
Task.py
DAPlatform/Dao/Task.py
+1
-0
User.py
DAPlatform/Dao/User.py
+1
-0
No files found.
DAPlatform/Dao/Data.py
View file @
20524ed2
...
@@ -2,6 +2,17 @@ from peewee import *
...
@@ -2,6 +2,17 @@ from peewee import *
from
Dao.model
import
mysql
from
Dao.model
import
mysql
class
Result
:
code
:
int
message
:
[]
data
:
{}
def
__init__
(
self
,
code
,
message
,
data
):
self
.
code
=
code
self
.
message
=
message
self
.
data
=
data
class
Data
(
Model
):
class
Data
(
Model
):
data_id
=
AutoField
(
primary_key
=
True
,
unique
=
True
)
data_id
=
AutoField
(
primary_key
=
True
,
unique
=
True
)
slice_id
=
IntegerField
(
null
=
False
)
slice_id
=
IntegerField
(
null
=
False
)
...
@@ -17,9 +28,9 @@ def create_data(slice_id, url):
...
@@ -17,9 +28,9 @@ def create_data(slice_id, url):
data
=
Data
(
slice_id
=
slice_id
,
url
=
url
)
data
=
Data
(
slice_id
=
slice_id
,
url
=
url
)
data
.
save
()
data
.
save
()
except
Exception
:
except
Exception
:
print
(
0
)
return
Result
(
0
,
"create failed"
,
{}
)
else
:
else
:
print
(
1
)
return
Result
(
1
,
"create success"
,
{}
)
# 根据数据id寻找数据url
# 根据数据id寻找数据url
...
@@ -27,11 +38,10 @@ def find_data(id):
...
@@ -27,11 +38,10 @@ def find_data(id):
try
:
try
:
data
=
Data
.
get
(
Data
.
data_id
==
id
)
data
=
Data
.
get
(
Data
.
data_id
==
id
)
except
Exception
:
except
Exception
:
print
(
0
)
return
Result
(
0
,
"find failed"
,
{}
)
else
:
else
:
print
(
data
.
url
)
return
Result
(
1
,
"find success"
,
data
.
url
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
Data
.
drop_table
()
Data
.
create_table
()
Data
.
create_table
()
DAPlatform/Dao/Slice.py
View file @
20524ed2
...
@@ -3,6 +3,7 @@ from Dao import Task
...
@@ -3,6 +3,7 @@ from Dao import Task
from
peewee
import
*
from
peewee
import
*
from
Dao.model
import
mysql
from
Dao.model
import
mysql
class
Result
:
class
Result
:
code
:
int
code
:
int
message
:
[]
message
:
[]
...
@@ -76,7 +77,8 @@ def delete_slice(id):
...
@@ -76,7 +77,8 @@ def delete_slice(id):
# 查找某任务下的分片
# 查找某任务下的分片
def
find_slice_by_task
(
task_id
):
def
find_slice_by_task
(
task_id
):
try
:
try
:
find
=
Slice
.
select
(
Slice
.
slice_id
,
Slice
.
document_number
,
Slice
.
type
,
Slice
.
model_id
)
.
where
(
Slice
.
task_id
==
task_id
)
find
=
Slice
.
select
(
Slice
.
slice_id
,
Slice
.
document_number
,
Slice
.
type
,
Slice
.
model_id
)
.
where
(
Slice
.
task_id
==
task_id
)
index
=
0
index
=
0
list
=
[]
list
=
[]
while
index
<
len
(
find
):
while
index
<
len
(
find
):
...
...
DAPlatform/Dao/Task.py
View file @
20524ed2
...
@@ -4,6 +4,7 @@ import math
...
@@ -4,6 +4,7 @@ import math
from
Dao
import
User
from
Dao
import
User
from
Dao.model
import
mysql
from
Dao.model
import
mysql
class
Result
:
class
Result
:
code
:
int
code
:
int
message
:
[]
message
:
[]
...
...
DAPlatform/Dao/User.py
View file @
20524ed2
...
@@ -164,6 +164,7 @@ def get_username(id):
...
@@ -164,6 +164,7 @@ def get_username(id):
else
:
else
:
return
tmp
.
userName
return
tmp
.
userName
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
User
.
create_table
()
User
.
create_table
()
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