Commit 48e4f926 authored by zhanglu's avatar zhanglu

Merge branch 'feature/op_topic' into 'dev'

fix

See merge request !113
parents 93f10b5a 18126fb0
...@@ -11,15 +11,15 @@ from utils.logger import error_logger ...@@ -11,15 +11,15 @@ from utils.logger import error_logger
class TopicListView(APIView): class TopicListView(APIView):
def get(self, request): def get(self, request):
user_id = request.GET.get('user_id', '') user_id = request.GET.get('user_id', '')
offset = int(request.GET.get('page', 0)) page = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 10)) limit = int(request.GET.get('limit', 10))
filters = json.loads(request.GET.get('filter', "{}")) filters = json.loads(request.GET.get('filter', "{}"))
sorts_by = json.loads(request.GET.get('sort_params', "[3]")) sorts_by = list(map(lambda i: int(i), request.GET.getlist('sort_params[]', [3])))
if user_id: if user_id:
filters.update({'user_id': user_id}) filters.update({'user_id': user_id})
res = self.rpc['physical/search/business/topic']( res = self.rpc['physical/search/business/topic'](
offset=offset * limit, offset=(page-1) * limit,
size=limit, size=limit,
filters=filters, filters=filters,
sorts_by=sorts_by sorts_by=sorts_by
...@@ -49,7 +49,7 @@ class TopicImageListView(APIView): ...@@ -49,7 +49,7 @@ class TopicImageListView(APIView):
page = int(request.GET.get('page', 1)) page = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 50)) limit = int(request.GET.get('limit', 50))
filters = json.loads(request.GET.get('filter', "{}")) filters = json.loads(request.GET.get('filter', "{}"))
sorts_by = json.loads(request.GET.get('sort_params', "[3]")) sorts_by = list(map(lambda i: int(i), request.GET.getlist('sort_params[]', [3])))
res = self.rpc['physical/search/business/topic']( res = self.rpc['physical/search/business/topic'](
offset=(page-1) * limit, offset=(page-1) * limit,
...@@ -78,7 +78,7 @@ class TopicImageListView(APIView): ...@@ -78,7 +78,7 @@ class TopicImageListView(APIView):
result.append({ result.append({
"id": topic_id, "id": topic_id,
"img_url": imgs_info[0].get("url", "") "img_url": imgs_info[0].get("url", "") + '-w'
}) })
result = { result = {
......
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