Commit 1397beca authored by haowang's avatar haowang

fix dev conflicts

parents 3b0db7fd a63d42f3
......@@ -119,3 +119,72 @@ class PictorialHomeRecommendUpdate(APIView):
return u'操作失败'
return data
class OperationDelete(APIView):
"""删除运营位"""
def post(self, request):
operation_id = request.POST.get('id')
try:
data = self.rpc['venus/sun/operation/delete'](id_=operation_id).unwrap()
except Exception as e:
error_logger.error(u'操作失败', e)
raise
if not data:
return u'操作失败'
return data
class OperationEdit(APIView):
"""编辑运营位"""
def post(self, request):
operation_id = request.POST.get('id')
operation_type = int(request.POST.get('operation_type'))
image_url = request.POST.get('image_url')
url = request.POST.get('url')
start_time = int(request.POST.get('start_time'))
end_time = int(request.POST.get('end_time'))
long_image_url = request.POST.get('long_image_url')
is_repeat_read = int(request.POST.get('is_repeat_read', 1))
data = {
"operation_type": operation_type,
"image_url": image_url,
"long_image_url": long_image_url,
"url": url,
"start_time": start_time,
"end_time": end_time,
"is_repeat_read": is_repeat_read
}
try:
data = self.rpc['venus/sun/operation/edit'](id_=operation_id, data=data).unwrap()
except Exception as e:
error_logger.error(u'操作失败', e)
raise
if not data:
return u'操作失败'
return data
class OperationList(APIView):
"""获取运营位列表"""
def get(self, request):
operation_type = request.GET.get('operation_type')
try:
data = self.rpc['venus/sun/operation/list'](operation_type=operation_type).unwrap()
except Exception as e:
error_logger.error(u'获取失败', e)
raise
return data
......@@ -115,11 +115,14 @@ class TopicUpdateOrCreateView(APIView):
return {'data': data}
def post(self, request):
id = request.POST.get('id', '')
topic_images = list(map(lambda x: x[:-2], json.loads(request.POST.get('topic_images', '[]'))))
tag_ids = list(map(lambda x: x.split(':')[0], json.loads(request.POST.get('tags', '[]'))))
collection_tag_ids = list(map(lambda x: x.split(':')[0], json.loads(request.POST.get('collection_tags', '[]'))))
cut_word_tag_ids = list(map(lambda x: x.split(':')[0], json.loads(request.POST.get('cut_word_tags', '[]'))))
body_esthetics_tag_ids = list(
map(lambda x: x.split(':')[0], json.loads(request.POST.get('body_esthetics_tags', '[]'))))
pictorial_ids = list(json.loads(request.POST.get('pictorial_ids', '[]')))
data = {
......@@ -141,6 +144,7 @@ class TopicUpdateOrCreateView(APIView):
'virtual_vote_num': request.POST.get('virtual_vote_num', ''),
'is_home': int(request.POST.get('is_home', 0)),
'is_recommend': int(request.POST.get('is_recommend', 0)),
'body_esthetics_tag_ids': body_esthetics_tag_ids,
}
try:
self.rpc['venus/sun/topic/edit'](id=id, data=data).unwrap()
......
......@@ -143,6 +143,9 @@ urlpatterns = [
url(r'^operation/home_fix', TopicHomeFixOperation.as_view()),
url(r'^operation/pictorial/recommend/list', PictorialHomeRecommendList.as_view()),
url(r'^operation/pictorial/recommend/update', PictorialHomeRecommendUpdate.as_view()),
url(r'^operation/edit', OperationEdit.as_view()),
url(r'^operation/list', OperationList.as_view()),
url(r'^operation/delete', OperationDelete.as_view()),
# 工具
url(r'^tools/virtual_vote$', VirtualVote.as_view()),
......
......@@ -55,10 +55,13 @@ class UserUpdateOrCreate(APIView):
return data
def post(self, request):
id = request.POST.get('id', '')
user_id = request.POST.get('user_id', '')
tag_ids = list(map(lambda x: x.split(":")[0], json.loads(request.POST.get('tags', '[]'))))
password = make_password(settings.PUPPET_PASSWORD, None, 'pbkdf2_sha256')
body_esthetics_tag_ids = list(
map(lambda x: x.split(':')[0], json.loads(request.POST.get('body_esthetics_tags', '[]'))))
data = {
'user_id': user_id,
......@@ -73,6 +76,7 @@ class UserUpdateOrCreate(APIView):
'email': request.POST.get('email'),
'gender': request.POST.get('gender'),
'is_tcc': int(request.POST.get('is_tcc', 0)),
'body_esthetics_tag_ids': body_esthetics_tag_ids,
}
try:
......
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