Commit a7b59391 authored by Davve's avatar Davve

完成明星创建逻辑

parent 208b2164
......@@ -13,7 +13,6 @@ class GroupListView(APIView):
filters = self.handle_filter(request.GET.get('filter', ""))
try:
data = self.rpc['venus/community/group/list'](filters=filters, offset=offset, count=count).unwrap()
print(data, '----------------')
except Exception as e:
raise e
return data
......@@ -35,3 +34,29 @@ class GroupListView(APIView):
return {
"message": "更新成功"
}
class GroupUpdateOrCreate(APIView):
def get(self, request):
id = request.GET.get('id')
try:
data = self.rpc['venus/community/group/detail'](id=id).unwrap()
except Exception as e:
data = [{
'id': 1,
'name': '我是一个小组名称',
'description': '小组简介简介',
'user_nums': 22,
'topic_nums': 32,
'user': {
'id': 22,
'name': '真好',
}
},]
return {
'total': 20,
'data': data
}
def post(self, request):
pass
\ No newline at end of file
......@@ -3,6 +3,7 @@
# __author__ = "chenwei"
# Date: 2018/11/15
import json
from utils.base import APIView
......@@ -16,3 +17,31 @@ class StarListView(APIView):
except Exception as e:
raise e
return data
class StarUpdateOrCreate(APIView):
def get(self, request):
id = request.GET.get('id')
try:
data = self.rpc['venus/community/star/detail'](id=id).unwrap()
except Exception as e:
raise e
return {'data': data}
def post(self, request):
data = {
'gender': request.POST.get('gender'),
'region': request.POST.get('region'),
'is_online': request.POST.get('is_online'),
'description': request.POST.get('description'),
'avatar': request.POST.get('avatar')[:-2],
'group_ids': list(set(json.loads(request.POST.get('group_ids', [])))),
}
try:
self.rpc['venus/community/star/create'](data=data).unwrap()
except Exception as e:
raise e
return {
'message': '更新成功'
}
\ No newline at end of file
......@@ -34,12 +34,15 @@ urlpatterns = [
# group相关
url(r'group/list$', GroupListView.as_view()),
url(r'group/update$', GroupListView.as_view()),
url(r'group/detail', GroupUpdateOrCreate.as_view()),
# topic相关
url(r'topic/list$', TopicListView.as_view()),
# star相关
url(r'star/list$', StarListView.as_view()),
url(r'star/create', StarUpdateOrCreate.as_view()),
url(r'star/detail', StarUpdateOrCreate.as_view()),
# push相关
url(r'push/list$', PushListView.as_view()),
......
......@@ -15,3 +15,11 @@ export function OffLineOrOnLine(data) {
data
})
}
export function GroupDetail(id) {
return request({
url: '/api/group/detail',
method: 'get',
params: { id }
})
}
......@@ -8,6 +8,21 @@ export function fetchList(query) {
})
}
export function starCreate(data) {
return request({
url: '/api/star/create',
method: 'post',
data
})
}
export function starDetail(id) {
return request({
url: '/api/star/detail',
method: 'get',
params: { id }
})
}
export function OffLineOrOnLine(data) {
return request({
......@@ -16,3 +31,11 @@ export function OffLineOrOnLine(data) {
data
})
}
export function fetchStarRelatedGroup(id) {
return request({
url: '/api/star/star_related_group_info',
method: 'get',
params: { id }
})
}
......@@ -241,7 +241,6 @@
this.postForm.region = Assembledata(this.temparray['region'], this.postForm.region);
this.postForm.pick_group = Assembledata(this.temparray['pick_group'], this.postForm.pick_group);
}else{
console.log(this.postForm.region)
this.postForm.region = this.postForm.region.join(',')
this.postForm.pick_group = this.postForm.pick_group.join(',')
}
......
This diff is collapsed.
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