Commit aba3517a authored by 钟尚武's avatar 钟尚武

Merge branch 'shangwu/feature-laboratory' into 'test'

增加测试频道管理

See merge request alpha/sun!389
parents 5334925d c51f2ce8
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('laboratory_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('laboratory_id', None)
data = self.rpc['venus/sun/laboratory/delete'](
laboratory_id=laboratory_id
).unwrap()
return {
"status": 1
}
......@@ -34,6 +34,7 @@ from .effect import *
from .skin_check import *
from .reply import *
from .survey import *
from .laboratory import *
urlpatterns = [
......@@ -256,6 +257,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 = [
......
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