Commit 84380b68 authored by haowang's avatar haowang

add activity word parent beauty api

parent e2ff46d6
import json
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
class ActivityListView(APIView):
def get(self, request):
offset, count = get_offset_count(request)
name = request.GET.get('name', None)
is_online = request.GET.get('is_online', None)
data = self.rpc['venus/sun/activity/list'](offset=offset, count=count, name=name, is_online=is_online).unwrap()
return data
class ActivityCreateView(APIView):
def post(self, request):
name = request.POST.get('name', None)
un_join_url = request.POST.get('un_join_url', None)
in_join_url = request.POST.get('in_join_url', None)
agreement_url = request.POST.get('agreement_url', None)
if not name:
return r'缺少参数'
data = self.rpc['venus/sun/activity/add'](name=name, un_join_url=un_join_url, in_join_url=in_join_url, agreement_url=agreement_url).unwrap()
return data
class ActivityUpdateView(APIView):
def post(self, request):
id_ = request.POST.get('id', None)
name = request.POST.get('name', None)
un_join_url = request.POST.get('un_join_url', None)
in_join_url = request.POST.get('in_join_url', None)
agreement_url = request.POST.get('agreement_url', None)
rank = request.POST.get('rank', None)
if not id_:
return r'缺少参数'
data = self.rpc['venus/sun/activity/edit'](id_=id_, name=name, un_join_url=un_join_url, in_join_url=in_join_url, agreement_url=agreement_url, rank=rank).unwrap()
if not data:
return r'更新失败'
return data
class ActivityDeleteView(APIView):
def post(self, request):
id_ = request.POST.get('id', None)
if not id_:
return r'缺少参数'
data = self.rpc['venus/sun/activity/delete'](id_=id_).unwrap()
if not data:
return r'操作失败'
return data
import json
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
class BeautyListView(APIView):
def get(self, request):
offset, count = get_offset_count(request)
parent_word_id = request.GET.get('parent_word_id', None)
is_online = request.GET.get('is_online', None)
data = self.rpc['venus/sun/beauty/list'](offset=offset, count=count, parent_word_id=parent_word_id, is_online=is_online).unwrap()
return data
class BeautyCreateView(APIView):
def post(self, request):
url = request.POST.get('url', None)
parent_word_id = request.POST.get('parent_word_id', None)
if not url or not parent_word_id:
return r'缺少参数'
data = self.rpc['venus/sun/beauty/add'](url=url, parent_word_id=parent_word_id).unwrap()
return data
class BeautyUpdateView(APIView):
def post(self, request):
id_ = request.POST.get('id', None)
url = request.POST.get('url', None)
parent_word_id = request.POST.get('parent_word_id', None)
if not id_:
return r'缺少参数'
data = self.rpc['venus/sun/beauty/edit'](id_=id_, url=url, parent_word_id=parent_word_id).unwrap()
if not data:
return r'更新失败'
return data
class BeautyDeleteView(APIView):
def post(self, request):
id_ = request.POST.get('id', None)
if not id_:
return r'缺少参数'
data = self.rpc['venus/sun/beauty/delete'](id_=id_).unwrap()
if not data:
return r'操作失败'
return data
......@@ -149,6 +149,24 @@ urlpatterns = [
url(r'^tools/batch_update_topic_tag$', BatchUpdateTopicTag.as_view()),
url(r'^tools/batch_create_topic_with_ai_fashion_tag$', BatchCreateTopicWithAiFashionTag.as_view()),
# 母词
url(r'^word_parent/list$', VirtualVote.as_view()),
url(r'^word_parent/create$', VirtualVote.as_view()),
url(r'^word_parent/update$', VirtualVote.as_view()),
url(r'^word_parent/delete$', VirtualVote.as_view()),
# 美图
url(r'^beauty/list$', VirtualVote.as_view()),
url(r'^beauty/create$', VirtualVote.as_view()),
url(r'^beauty/update$', VirtualVote.as_view()),
url(r'^beauty/delete$', VirtualVote.as_view()),
# 活动
url(r'^activity/list$', VirtualVote.as_view()),
url(r'^activity/create$', VirtualVote.as_view()),
url(r'^activity/update$', VirtualVote.as_view()),
url(r'^activity/delete$', VirtualVote.as_view()),
]
search_urlpatterns = [
......
import json
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
class WordParentListView(APIView):
def get(self, request):
offset, count = get_offset_count(request)
name = request.GET.get('name', None)
is_online = request.GET.get('is_online', None)
data = self.rpc['venus/sun/word_parent/list'](offset=offset, count=count, name=name, is_online=is_online).unwrap()
return data
class WordParentCreateView(APIView):
def post(self, request):
name = request.POST.get('name', None)
children_words = json.loads(request.POST.get('children_words', '[]'))
content_ad = request.POST.get('content_ad', None)
makeup_ad = request.POST.get('makeup_ad', None)
dress_ad = request.POST.get('dress_ad', None)
if not name:
return r'缺少参数'
data = self.rpc['venus/sun/word_parent/add'](name=name, children_words=children_words, content_ad=content_ad, makeup_ad=makeup_ad, dress_ad=dress_ad).unwrap()
return data
class WordParentUpdateView(APIView):
def post(self, request):
id_ = request.POST.get('id', None)
name = request.POST.get('name', None)
children_words = json.loads(request.POST.get('children_words', '[]'))
content_ad = request.POST.get('content_ad', None)
makeup_ad = request.POST.get('makeup_ad', None)
dress_ad = request.POST.get('dress_ad', None)
if not id_:
return r'缺少参数'
data = self.rpc['venus/sun/word_parent/edit'](id_=id_, name=name, children_words=children_words, content_ad=content_ad, makeup_ad=makeup_ad, dress_ad=dress_ad).unwrap()
if not data:
return r'更新失败'
return data
class WordParentDeleteView(APIView):
def post(self, request):
id_ = request.POST.get('id', None)
if not id_:
return r'缺少参数'
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