Commit 9d72d36c authored by 杨成林's avatar 杨成林

Merge branch 'ycl/like18' into 'dev'

Operation

See merge request !192
parents 958fc338 4b42d77e
......@@ -119,3 +119,68 @@ 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'))
data = {
"operation_type": operation_type,
"image_url": image_url,
"url": url,
"start_time": start_time,
"end_time": end_time
}
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
......@@ -140,6 +140,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()),
......
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