Commit e0d18329 authored by haowang's avatar haowang

Merge branch 'master' of http://git.wanmeizhensuo.com/alpha/sun into haow/dev

parents db396e88 31260d9d
......@@ -124,7 +124,7 @@ class PictorialActivityView(APIView):
return data
class PictorialActivityOlineView(APIView):
class PictorialActivityOnlineView(APIView):
def post(self, request):
......
......@@ -46,7 +46,7 @@ class PictorialUpdateOrCreate(APIView):
def post(self, request):
id = request.POST.get('id')
id = int(request.POST.get('id')) if request.POST.get('id') else None
star_ids = json.loads(request.POST.get('star', '[]'))
pictorial_user_ids = json.loads(request.POST.get('pictorial_user_ids', '[]'))
collection_tag_ids = json.loads(request.POST.get('collection_tag_ids', '[]'))
......@@ -65,7 +65,8 @@ class PictorialUpdateOrCreate(APIView):
'add_score': int(request.POST.get('add_score', 0)),
'is_public': True if request.POST.get('is_public') == "true" else False,
'is_feed': int(request.POST.get('is_feed', 0)),
'pictorial_activity_ids': [int(pictorial_activity_id) if pictorial_activity_id else None]
'pictorial_activity_ids': [int(pictorial_activity_id)] if pictorial_activity_id else [],
'alias': request.POST.get('alias', ''),
}
try:
......
......@@ -97,11 +97,29 @@ class TagTypeSearchView(APIView):
class PictorialSearchView(APIView):
def get(self, request):
name = request.GET.get('name')
offset, count = get_offset_count(request)
try:
data = self.rpc['venus/sun/pictorial/search'](name=name).unwrap()
data = self.rpc['venus/sun/pictorial/search'](name=name, offset=offset, count=count).unwrap()
except Exception as e:
raise e
return {
'data': ['{id}:{name}'.format(id=search_data['id'], name=search_data['name']) for search_data in data]
}
class PictorialActivitySearchView(APIView):
def get(self, request):
name = request.GET.get('name')
offset, count = get_offset_count(request)
try:
data = self.rpc['venus/sun/activity/pictorial/search'](name=name, offset=offset, count=count).unwrap()
except Exception as e:
raise e
return {
'data': ['{id}:{name}'.format(id=search_data['id'], name=search_data['name']) for search_data in data]
}
\ No newline at end of file
......@@ -48,10 +48,12 @@ class TagUpdateOrCreateView(APIView):
return {'data': data}
def post(self, request):
id = request.POST.get('id')
down_tags = list(set(map(lambda x: x.split(":")[0], json.loads((request.POST.get('down_tags', '[]'))))))
up_tags = list(set(map(lambda x: x.split(":")[0], json.loads((request.POST.get('up_tags', '[]'))))))
tagtypes = list(set(map(lambda x: x.split(":")[0], json.loads((request.POST.get('tagtypes', '[]'))))))
data = {
'name': request.POST.get('name').lower(),
'description': request.POST.get('description', ''),
......@@ -62,7 +64,9 @@ class TagUpdateOrCreateView(APIView):
'platform': request.POST.get('platform', 1),
'collection': request.POST.get('collection', 0),
'alias': request.POST.get('alias', ''),
'is_show_in_register': request.POST.get('is_show_in_register', 'false')
'is_show_in_register': request.POST.get('is_show_in_register', 'false'),
'pictorial_ids': list(
(map(lambda x: int(x.split(":")[0]), json.loads((request.POST.get('pictorial_ids', '[]'))))))
}
try:
data = self.rpc['venus/sun/tag/edit'](id=id, data=data).unwrap()
......
......@@ -191,10 +191,10 @@ urlpatterns = [
url(r'^activity/create$', ActivityCreateView.as_view()),
url(r'^activity/update$', ActivityUpdateView.as_view()),
url(r'^activity/delete$', ActivityDeleteView.as_view()),
url(r'^activity/pictorial', PictorialActivityView.as_view()),
url(r'^activity/pictorial', PictorialActivityView.as_view()),
url(r'^activity/pictorial/list', PictorialActivityListView.as_view()),
url(r'^activity/pictorial/online', PictorialActivityView.as_view()),
url(r'^activity/pictorial$', PictorialActivityView.as_view()),
url(r'^activity/pictorial$', PictorialActivityView.as_view()),
url(r'^activity/pictorial/list$', PictorialActivityListView.as_view()),
url(r'^activity/pictorial/online$', PictorialActivityOnlineView.as_view()),
# 品牌
url(r'^brand/list$', BrandListView.as_view()),
......@@ -232,6 +232,7 @@ search_urlpatterns = [
url(r'search/topic$', TopicSearchView.as_view()),
url(r'search/tagtype$', TagTypeSearchView.as_view()),
url(r'search/pictorial$', PictorialSearchView.as_view()),
url(r'search/pictorial_activity$', PictorialActivitySearchView.as_view()),
]
common_urlpatterns = [
......
......@@ -69,7 +69,7 @@ class UserUpdateOrCreate(APIView):
data = {
'user_id': user_id,
'password': password,
'is_recommend': int(request.POST.get('is_recommend')),
'is_recommend': int(request.POST.get('is_recommend')) if request.POST.get('is_recommend') else 0,
'profile_pic': request.POST.get('avatar')[:-2],
'nick_name': request.POST.get('nick_name'),
'tag_ids': tag_ids,
......
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