Commit 142da4a7 authored by Davve's avatar Davve

增加明星,push,帖子,用户接口

parent f8a99531
......@@ -3,4 +3,27 @@
# __author__ = "chenwei"
# 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
#! /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
#! /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
#! /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},
]
}
......@@ -7,9 +7,27 @@
from django.conf.urls import url
from .pick import *
from .push import *
from .group import *
from .user import *
from .topic import *
from .star import *
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相关
url(r'pick/list$', PickListView.as_view()),
......
#! /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
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