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
1
Merge Requests
1
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
alpha
sun
Commits
142da4a7
Commit
142da4a7
authored
Nov 16, 2018
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加明星,push,帖子,用户接口
parent
f8a99531
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
157 additions
and
0 deletions
+157
-0
group.py
api/group.py
+24
-0
push.py
api/push.py
+29
-0
star.py
api/star.py
+27
-0
topic.py
api/topic.py
+27
-0
urls.py
api/urls.py
+18
-0
user.py
api/user.py
+32
-0
No files found.
api/group.py
View file @
142da4a7
...
@@ -3,4 +3,27 @@
...
@@ -3,4 +3,27 @@
# __author__ = "chenwei"
# __author__ = "chenwei"
# Date: 2018/11/15
# Date: 2018/11/15
from
utils.base
import
APIView
class
GroupListView
(
APIView
):
def
get
(
self
,
request
):
print
(
'-----------'
)
# page = request.GET.get('page', 1)
# limit = request.GET.get('limit', 10)
# filter = self.handle_filter(request.GET.get('filter', ""))
# try:
# data = self.rpc['venus/community/group/get'](offset=page, limit=limit, filters=filter).unwrap()
# except Exception as e:
data
=
{
'total'
:
200
,
'data'
:
[
{
'id'
:
1
,
'description'
:
'测试1'
,
'name'
:
'测试2'
,
"star_name"
:
"鹿晗"
,
"user_nums"
:
23
,
"topic_num"
:
12
,
'push_time'
:
'2018-08-09'
,
'create_time'
:
'2019-08-07'
,
'creator_id'
:
22
,
'creator'
:
'hi'
,
'is_online'
:
1
,
'is_recommend'
:
1
},
{
'id'
:
2
,
'description'
:
'测试1'
,
'name'
:
'测试2'
,
"star_name"
:
"鹿晗"
,
"user_nums"
:
23
,
"topic_num"
:
12
,
'push_time'
:
'2018-08-09'
,
'create_time'
:
'2019-08-07'
,
'creator_id'
:
22
,
'creator_id'
:
22
,
'creator'
:
'hi'
,
'is_online'
:
1
,
'is_recommend'
:
1
},
{
'id'
:
3
,
'description'
:
'测试1'
,
'name'
:
'测试2'
,
"star_name"
:
"鹿晗"
,
"user_nums"
:
23
,
"topic_num"
:
12
,
'push_time'
:
'2018-08-09'
,
'create_time'
:
'2019-08-07'
,
'creator_id'
:
22
,
'creator_id'
:
22
,
'creator'
:
'hi'
,
'is_online'
:
1
,
'is_recommend'
:
1
},
]
}
return
data
\ No newline at end of file
api/push.py
0 → 100644
View file @
142da4a7
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "chenwei"
# Date: 2018/11/15
from
utils.base
import
APIView
class
PushListView
(
APIView
):
def
get
(
self
,
request
):
page
=
request
.
GET
.
get
(
'page'
,
1
)
limit
=
request
.
GET
.
get
(
'limit'
,
10
)
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
try
:
data
=
self
.
rpc
[
'venus/community/push/get'
](
offset
=
page
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
data
=
{
'total'
:
200
,
'data'
:
[
{
'id'
:
1
,
'title'
:
'测试1'
,
'content'
:
'测试2'
,
'push_time'
:
'2018-08-09'
,
'create_time'
:
'2019-08-07'
,
'creator_id'
:
22
,
},
{
'id'
:
2
,
'title'
:
'测试1'
,
'content'
:
'测试2'
,
'push_time'
:
'2018-08-09'
,
'create_time'
:
'2019-08-07'
,
'creator_id'
:
22
,
},
{
'id'
:
3
,
'title'
:
'测试1'
,
'content'
:
'测试2'
,
'push_time'
:
'2018-08-09'
,
'create_time'
:
'2019-08-07'
,
'creator_id'
:
22
,
},
]
}
return
data
\ No newline at end of file
api/star.py
0 → 100644
View file @
142da4a7
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "chenwei"
# Date: 2018/11/15
from
utils.base
import
APIView
class
StarListView
(
APIView
):
def
get
(
self
,
request
):
page
=
request
.
GET
.
get
(
'page'
,
1
)
limit
=
request
.
GET
.
get
(
'limit'
,
10
)
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
try
:
data
=
self
.
rpc
[
'venus/community/push/get'
](
offset
=
page
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
data
=
{
'total'
:
200
,
'data'
:
[
{
'id'
:
1
,
'name'
:
'测试1'
,
'region'
:
'测试2'
,
'group_nums'
:
22
,
'gender'
:
1
},
{
'id'
:
2
,
'name'
:
'测试1'
,
'region'
:
'测试2'
,
'group_nums'
:
13
,
'gender'
:
1
},
{
'id'
:
3
,
'name'
:
'测试1'
,
'region'
:
'测试2'
,
'group_nums'
:
18
,
'gender'
:
0
},
]
}
return
data
\ No newline at end of file
api/topic.py
0 → 100644
View file @
142da4a7
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "chenwei"
# Date: 2018/11/15
from
utils.base
import
APIView
class
TopicListView
(
APIView
):
def
get
(
self
,
request
):
return
{
'total'
:
200
,
'data'
:[
{
"id"
:
"1"
,
"content"
:
'内容'
,
'user_name'
:
'alex'
,
'newly_reply'
:
'最新回复'
,
'group_name'
:
'小组名'
,
'update_time'
:
'2019-09-18 23:59:59'
,
'reported_time'
:
'2019-09-18 23:59:59'
,
'is_online'
:
1
,
'is_reported'
:
0
},
{
"id"
:
"2"
,
"content"
:
'内容'
,
'newly_reply'
:
'最新回复'
,
'group_name'
:
'小组名'
,
'update_time'
:
'2019-09-18 23:59:59'
,
'reported_time'
:
'2019-09-18 23:59:59'
,
'user_name'
:
'alex'
,
'is_online'
:
0
,
'is_reported'
:
0
},
{
"id"
:
"3"
,
"content"
:
'内容'
,
'user_name'
:
'alex'
,
'newly_reply'
:
'最新回复'
,
'group_name'
:
'小组名'
,
'update_time'
:
'2019-09-18 23:59:59'
,
'reported_time'
:
'2019-09-18 23:59:59'
,
'is_online'
:
1
,
'is_reported'
:
1
},
{
"id"
:
"4"
,
"content"
:
'内容'
,
'user_name'
:
'alex'
,
'newly_reply'
:
'最新回复'
,
'group_name'
:
'小组名'
,
'update_time'
:
'2019-09-18 23:59:59'
,
'reported_time'
:
'2019-09-18 23:59:59'
,
'is_online'
:
1
,
'is_reported'
:
1
},
{
"id"
:
"5"
,
"content"
:
'内容'
,
'user_name'
:
'alex'
,
'newly_reply'
:
'最新回复'
,
'group_name'
:
'小组名'
,
'update_time'
:
'2019-09-18 23:59:59'
,
'reported_time'
:
'2019-09-18 23:59:59'
,
'is_online'
:
0
,
'is_reported'
:
0
},
]
}
api/urls.py
View file @
142da4a7
...
@@ -7,9 +7,27 @@
...
@@ -7,9 +7,27 @@
from
django.conf.urls
import
url
from
django.conf.urls
import
url
from
.pick
import
*
from
.pick
import
*
from
.push
import
*
from
.group
import
*
from
.user
import
*
from
.topic
import
*
from
.star
import
*
urlpatterns
=
[
urlpatterns
=
[
# user相关
url
(
r'user/list$'
,
UserListView
.
as_view
()),
# group相关
url
(
r'group/list$'
,
GroupListView
.
as_view
()),
# topic相关
url
(
r'topic/list$'
,
TopicListView
.
as_view
()),
# star相关
url
(
r'star/list$'
,
StarListView
.
as_view
()),
# push相关
url
(
r'push/list$'
,
PushListView
.
as_view
()),
# pick相关
# pick相关
url
(
r'pick/list$'
,
PickListView
.
as_view
()),
url
(
r'pick/list$'
,
PickListView
.
as_view
()),
...
...
api/user.py
0 → 100644
View file @
142da4a7
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "chenwei"
# Date: 2018/11/15
from
utils.base
import
APIView
class
UserListView
(
APIView
):
def
get
(
self
,
request
):
page
=
request
.
GET
.
get
(
'page'
,
1
)
limit
=
request
.
GET
.
get
(
'limit'
,
10
)
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
try
:
data
=
self
.
rpc
[
'venus/community/push/get'
](
offset
=
page
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
data
=
{
'total'
:
200
,
'data'
:
[
{
"id"
:
1
,
'username'
:
'alex'
,
'phone'
:
'12345678912'
,
'email'
:
'http://www.baid.com'
,
'group_nums'
:
23
,
'topic_num'
:
12
,
'group_identify'
:
'组长,长老'
,
'user_identify'
:
'普通用户'
,
'is_recommend'
:
1
},
{
"id"
:
2
,
'username'
:
'ttt'
,
'phone'
:
'12345678912'
,
'email'
:
'http://www.baid.com'
,
'group_nums'
:
23
,
'topic_num'
:
12
,
'group_identify'
:
'长老'
,
'user_identify'
:
'马甲用户'
,
'is_recommend'
:
0
},
{
"id"
:
3
,
'username'
:
'xcc'
,
'phone'
:
'12345678912'
,
'email'
:
'http://www.baid.com'
,
'group_nums'
:
23
,
'topic_num'
:
12
,
'group_identify'
:
'精英'
,
'user_identify'
:
'普通用户'
,
'is_recommend'
:
1
},
{
"id"
:
4
,
'username'
:
'aaa'
,
'phone'
:
'12345678912'
,
'email'
:
'http://www.baid.com'
,
'group_nums'
:
23
,
'topic_num'
:
12
,
'group_identify'
:
'高级会有'
,
'user_identify'
:
'马甲用户'
,
'is_recommend'
:
0
},
]
}
return
data
\ 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