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
06422cb1
Commit
06422cb1
authored
Nov 14, 2019
by
钟尚武
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test' into 'master'
2.6跟版需求上线 See merge request
alpha/sun!395
parents
b4f181eb
2196a31c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
132 additions
and
0 deletions
+132
-0
laboratory.py
api/laboratory.py
+51
-0
tag.py
api/tag.py
+1
-0
urls.py
api/urls.py
+10
-0
user.py
api/user.py
+70
-0
No files found.
api/laboratory.py
0 → 100644
View file @
06422cb1
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
(
'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
(
'id'
,
None
)
data
=
self
.
rpc
[
'venus/sun/laboratory/delete'
](
laboratory_id
=
laboratory_id
)
.
unwrap
()
return
{
"status"
:
1
}
api/tag.py
View file @
06422cb1
...
...
@@ -270,6 +270,7 @@ class TagRelatePictorialInfo(APIView):
except
Exception
as
e
:
error_logger
.
error
(
u'获取画报列表失败
%
s'
,
e
)
raise
return
data
...
...
api/urls.py
View file @
06422cb1
...
...
@@ -34,6 +34,7 @@ from .effect import *
from
.skin_check
import
*
from
.reply
import
*
from
.survey
import
*
from
.laboratory
import
*
urlpatterns
=
[
...
...
@@ -55,6 +56,10 @@ urlpatterns = [
url
(
r'^user/create$'
,
UserUpdateOrCreate
.
as_view
()),
url
(
r'^user/images/get$'
,
UserImage
.
as_view
()),
url
(
r'^user/images/create$'
,
UserImage
.
as_view
()),
url
(
r'^user/kol_pool_list$'
,
KOLPoolList
.
as_view
()),
url
(
r'^user/kol_pool_rm$'
,
KOLPoolRm
.
as_view
()),
url
(
r'^user/kol_pool_add$'
,
KOLPoolAdd
.
as_view
()),
url
(
r'^user/kol_pool_edit$'
,
KOLPoolEdit
.
as_view
()),
# topic相关
url
(
r'^topic/list$'
,
TopicListView
.
as_view
()),
...
...
@@ -256,6 +261,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
=
[
...
...
api/user.py
View file @
06422cb1
...
...
@@ -178,3 +178,72 @@ class UserImage(APIView):
error_logger
.
error
(
u'获取
%
s用户头像失败
%
s'
%
(
user_id
,
e
))
raise
return
data
class
KOLPoolList
(
APIView
):
def
get
(
self
,
request
):
page
=
int
(
request
.
GET
.
get
(
'page'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
50
))
try
:
res
=
self
.
rpc
[
'venus/sun/user/kol_pool_list'
](
offset
=
(
page
-
1
)
*
limit
,
limit
=
limit
,
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取kol池失败
%
s'
%
e
)
raise
return
res
class
KOLPoolRm
(
APIView
):
def
post
(
self
,
request
):
user_ids
=
json
.
loads
(
request
.
POST
.
get
(
'user_ids'
,
"[]"
))
try
:
res
=
self
.
rpc
[
'venus/sun/user/kol_pool/delete'
](
user_ids
=
user_ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'kol池删除用户失败
%
s'
%
e
)
raise
return
res
class
KOLPoolAdd
(
APIView
):
def
post
(
self
,
request
):
user_ids
=
json
.
loads
(
request
.
POST
.
get
(
'user_ids'
,
"[]"
))
try
:
self
.
rpc
[
'venus/sun/user/kol_pool/add'
](
user_ids
=
user_ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'kol池增加用户失败
%
s'
%
e
)
raise
class
KOLPoolEdit
(
APIView
):
def
post
(
self
,
request
):
data
=
json
.
loads
(
request
.
POST
.
get
(
'data'
,
"{}"
))
try
:
self
.
rpc
[
'venus/sun/user/kol_pool/edit'
](
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'kol池编辑用户失败
%
s'
%
e
)
raise
\ No newline at end of file
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