Commit 10cccb42 authored by Davve's avatar Davve

增加列表页面get

parent 142da4a7
...@@ -8,13 +8,13 @@ from utils.base import APIView ...@@ -8,13 +8,13 @@ from utils.base import APIView
class GroupListView(APIView): class GroupListView(APIView):
def get(self, request): def get(self, request):
print('-----------') page = request.GET.get('page', 1)
# page = request.GET.get('page', 1) limit = request.GET.get('limit', 10)
# limit = request.GET.get('limit', 10) filter = self.handle_filter(request.GET.get('filter', ""))
# filter = self.handle_filter(request.GET.get('filter', "")) try:
# try: data = self.rpc['venus/community/pick/get'](offset=page, limit=limit, filters=filter).unwrap()
# data = self.rpc['venus/community/group/get'](offset=page, limit=limit, filters=filter).unwrap() except Exception as e:
# except Exception as e: # raise e
data = { data = {
'total': 200, 'total': 200,
'data': [ 'data': [
...@@ -25,5 +25,4 @@ class GroupListView(APIView): ...@@ -25,5 +25,4 @@ class GroupListView(APIView):
'creator_id': 22, 'creator_id':22, 'creator': 'hi', 'is_online':1, 'is_recommend':1}, 'creator_id': 22, 'creator_id':22, 'creator': 'hi', 'is_online':1, 'is_recommend':1},
] ]
} }
return data return data
\ No newline at end of file
...@@ -8,8 +8,14 @@ from utils.base import APIView ...@@ -8,8 +8,14 @@ from utils.base import APIView
class TopicListView(APIView): class TopicListView(APIView):
def get(self, request): def get(self, request):
page = request.GET.get('page', 1)
return { limit = request.GET.get('limit', 10)
filter = self.handle_filter(request.GET.get('filter', ""))
try:
data = self.rpc['venus/community/pick/get'](offset=page, limit=limit, filters=filter).unwrap()
except Exception as e:
# raise e
data = {
'total': 200, 'total': 200,
'data':[ 'data':[
{"id": "1", "content": '内容', 'user_name': 'alex','newly_reply': '最新回复', 'group_name': '小组名', 'update_time': '2019-09-18 23:59:59', {"id": "1", "content": '内容', 'user_name': 'alex','newly_reply': '最新回复', 'group_name': '小组名', 'update_time': '2019-09-18 23:59:59',
...@@ -24,4 +30,5 @@ class TopicListView(APIView): ...@@ -24,4 +30,5 @@ class TopicListView(APIView):
'reported_time': '2019-09-18 23:59:59', 'is_online': 0, 'is_reported': 0}, 'reported_time': '2019-09-18 23:59:59', 'is_online': 0, 'is_reported': 0},
] ]
} }
return data
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment