Commit fee2da8a authored by 杨成林's avatar 杨成林

Merge branch 'ycl/user_filter' into 'test'

add user_filter

See merge request alpha/sun!361
parents ea417569 a484036a
......@@ -99,17 +99,24 @@ class ReplyManageListView(APIView):
to_create_time = request.GET.get('to_create_time', None)
from_topic_create_time = request.GET.get('from_topic_create_time', None)
to_topic_create_time = request.GET.get('to_topic_create_time', None)
user_kol = request.GET.get('user_kol', None)
user_shadow = request.GET.get('user_shadow', None)
user_edit = request.GET.get('user_edit', None)
replied_user_kol = request.GET.get('replied_user_kol', None)
replied_user_shadow = request.GET.get('replied_user_shadow', None)
replied_user_edit = request.GET.get('replied_user_edit', None)
other_filters = {}
if topic_content:
other_filters['topic_content'] = topic_content.strip()
if reply_user_type:
reply_user_type = int(reply_user_type)
if reply_user_type in [USER_EXTRA_TYPE.REAL, USER_EXTRA_TYPE.SHADOW, USER_EXTRA_TYPE.KOL]:
if reply_user_type is not None:
other_filters['reply_user_type'] = reply_user_type
if replied_user_type:
replied_user_type = int(replied_user_type)
if replied_user_type in [USER_EXTRA_TYPE.REAL, USER_EXTRA_TYPE.SHADOW, USER_EXTRA_TYPE.KOL]:
if replied_user_type is not None:
other_filters['replied_user_type'] = replied_user_type
if from_topic_create_time and to_topic_create_time:
other_filters['topic_create_time__gte'] = from_topic_create_time
......@@ -137,6 +144,24 @@ class ReplyManageListView(APIView):
filters['create_time__gte'] = from_create_time
filters['create_time__lte'] = to_create_time
if user_kol is not None:
filters['user_kol'] = int(user_kol)
if user_shadow is not None:
filters['user_shadow'] = int(user_shadow)
if user_edit is not None:
filters['user_edit'] = int(user_edit)
if replied_user_edit is not None:
filters['replied_user_edit'] = int(replied_user_edit)
if replied_user_kol is not None:
filters['replied_user_kol'] = int(replied_user_kol)
if replied_user_shadow is not None:
filters['replied_user_shadow'] = int(replied_user_shadow)
try:
data = self.rpc['venus/sun/reply/manage/list'](offset=(page-1) * limit, limit=limit, filters=filters, other_filters=other_filters).unwrap()
except Exception as e:
......
......@@ -6,10 +6,12 @@
import json
from utils.base import APIView, get_offset_count
from utils.logger import error_logger
from alpha_types.venus import USER_EXTRA_TYPE
class TopicListView(APIView):
def get(self, request):
pictorial_id = request.GET.get('pictorial_id', '')
user_id = request.GET.get('user_id', '')
page = int(request.GET.get('page', 1))
......@@ -31,6 +33,18 @@ class TopicListView(APIView):
if filters.get("is_finished") is not None:
filters["is_finished"] = True if filters.get("is_finished") else False
user_type = filters.pop("user_type") if filters.get("user_type") else None
if user_type:
if int(user_type) == USER_EXTRA_TYPE.COMMON:
filters["is_shadow"] = 0
elif int(user_type) == USER_EXTRA_TYPE.SHADOW:
filters["is_shadow"] = 1
elif int(user_type) == USER_EXTRA_TYPE.KOL:
filters["is_kol"] = 1
elif int(user_type) == USER_EXTRA_TYPE.EDIT:
filters["is_edit"] = 1
res = self.rpc['physical/search/business/topic'](
offset=(page-1) * limit,
size=limit,
......
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