Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sun
Project
Project
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
Open sidebar
钟尚武
sun
Commits
c51f2ce8
Commit
c51f2ce8
authored
Oct 30, 2019
by
zhongshangwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加测试频道管理
parent
5334925d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
0 deletions
+57
-0
laboratory.py
api/laboratory.py
+51
-0
urls.py
api/urls.py
+6
-0
No files found.
api/laboratory.py
0 → 100644
View file @
c51f2ce8
import
json
from
utils.base
import
APIView
,
get_offset_count
class
LaboratoryListView
(
APIView
):
def
get
(
self
,
request
):
offset
,
count
=
get_offset_count
(
request
)
data
=
self
.
rpc
[
'venus/sun/laboratory/list'
](
offset
=
offset
,
count
=
count
)
.
unwrap
()
return
data
class
LaboratoryView
(
APIView
):
def
post
(
self
,
request
):
laboratory_id
=
request
.
POST
.
get
(
'laboratory_id'
,
None
)
title
=
request
.
POST
.
get
(
"title"
,
""
)
order
=
request
.
POST
.
get
(
"order"
,
""
)
image_url
=
request
.
POST
.
get
(
"image_url"
,
""
)
agreement_url
=
request
.
POST
.
get
(
"agreement_url"
,
""
)
description_fomula
=
request
.
POST
.
get
(
"description_fomula"
,
""
)
data
=
self
.
rpc
[
"venus/sun/laboratory/create"
](
title
=
title
,
order
=
order
,
description_fomula
=
description_fomula
,
image_url
=
image_url
,
agreement_url
=
agreement_url
,
laboratory_id
=
laboratory_id
)
.
unwrap
()
return
data
class
LaboratoryDeleteView
(
APIView
):
def
post
(
self
,
request
):
laboratory_id
=
request
.
POST
.
get
(
'laboratory_id'
,
None
)
data
=
self
.
rpc
[
'venus/sun/laboratory/delete'
](
laboratory_id
=
laboratory_id
)
.
unwrap
()
return
{
"status"
:
1
}
api/urls.py
View file @
c51f2ce8
...
...
@@ -34,6 +34,7 @@ from .effect import *
from
.skin_check
import
*
from
.reply
import
*
from
.survey
import
*
from
.laboratory
import
*
urlpatterns
=
[
...
...
@@ -256,6 +257,11 @@ urlpatterns = [
url
(
r'^survey_question/get$'
,
SurveyView
.
as_view
()),
url
(
r'^survey_question/list$'
,
SurveyListView
.
as_view
()),
url
(
r'^survey_question/add_answer$'
,
SurveyAddAnswerView
.
as_view
()),
# 测试频道
url
(
r'^laboratory/create$'
,
LaboratoryView
.
as_view
()),
url
(
r'^laboratory/list$'
,
LaboratoryListView
.
as_view
()),
url
(
r'^laboratory/delete$'
,
LaboratoryDeleteView
.
as_view
()),
]
search_urlpatterns
=
[
...
...
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