Commit 4fd50559 authored by 王浩's avatar 王浩

Merge branch 'haow/dev' into 'dev'

change delete api to mul

See merge request alpha/sun!204
parents 0f0cc071 8c09f66e
......@@ -14,6 +14,15 @@ class ActivityListView(APIView):
return data
class ActivityInfoView(APIView):
def get(self, request):
id_ = request.GET.get('id')
data = self.rpc['venus/sun/activity/get'](id_=id_).unwrap()
return data
class ActivityCreateView(APIView):
def post(self, request):
......@@ -53,13 +62,14 @@ class ActivityUpdateView(APIView):
class ActivityDeleteView(APIView):
def post(self, request):
id_ = request.POST.get('id', None)
if not id_:
ids = json.loads(request.POST.get('ids', '[]'))
if not ids:
return r'缺少参数'
data = self.rpc['venus/sun/activity/delete'](id_=id_).unwrap()
if not data:
return r'操作失败'
for id_ in ids:
data = self.rpc['venus/sun/activity/delete'](id_=id_).unwrap()
if not data:
return r'操作失败'
return data
......@@ -14,6 +14,15 @@ class BeautyListView(APIView):
return data
class BeautyInfoView(APIView):
def get(self, request):
id_ = request.GET.get('id')
data = self.rpc['venus/sun/beauty/get'](id_=id_).unwrap()
return data
class BeautyCreateView(APIView):
def post(self, request):
......@@ -48,13 +57,15 @@ class BeautyUpdateView(APIView):
class BeautyDeleteView(APIView):
def post(self, request):
id_ = request.POST.get('id', None)
if not id_:
ids = json.loads(request.POST.get('ids', '[]'))
if not ids:
return r'缺少参数'
data = self.rpc['venus/sun/beauty/delete'](id_=id_).unwrap()
if not data:
return r'操作失败'
for id_ in ids:
data = self.rpc['venus/sun/beauty/delete'](id_=id_).unwrap()
if not data:
return r'操作失败'
return data
......@@ -157,18 +157,21 @@ urlpatterns = [
# 母词
url(r'^word_parent/list$', WordParentListView.as_view()),
url(r'^word_parent/get$', WordParentInfoView.as_view()),
url(r'^word_parent/create$', WordParentCreateView.as_view()),
url(r'^word_parent/update$', WordParentUpdateView.as_view()),
url(r'^word_parent/delete$', WordParentDeleteView.as_view()),
# 美图
url(r'^beauty/list$', BeautyListView.as_view()),
url(r'^beauty/get$', BeautyInfoView.as_view()),
url(r'^beauty/create$', BeautyCreateView.as_view()),
url(r'^beauty/update$', BeautyUpdateView.as_view()),
url(r'^beauty/delete$', BeautyDeleteView.as_view()),
# 活动
url(r'^activity/list$', ActivityListView.as_view()),
url(r'^activity/get$', ActivityInfoView.as_view()),
url(r'^activity/create$', ActivityCreateView.as_view()),
url(r'^activity/update$', ActivityUpdateView.as_view()),
url(r'^activity/delete$', ActivityDeleteView.as_view()),
......
......@@ -14,6 +14,16 @@ class WordParentListView(APIView):
return data
class WordParentInfoView(APIView):
def get(self, request):
id_ = request.GET.get('id')
data = self.rpc['venus/sun/word_parent/get'](id_=id_).unwrap()
return data
class WordParentCreateView(APIView):
def post(self, request):
......@@ -54,13 +64,14 @@ class WordParentUpdateView(APIView):
class WordParentDeleteView(APIView):
def post(self, request):
id_ = request.POST.get('id', None)
ids = json.loads(request.POST.get('ids', '[]'))
if not id_:
if not ids:
return r'缺少参数'
data = self.rpc['venus/sun/word_parent/delete'](id_=id_).unwrap()
if not data:
return r'操作失败'
for id_ in ids:
data = self.rpc['venus/sun/word_parent/delete'](id_=id_).unwrap()
if not data:
return r'操作失败'
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