Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢林臻
sun
Commits
fee2da8a
Commit
fee2da8a
authored
Sep 26, 2019
by
杨成林
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ycl/user_filter' into 'test'
add user_filter See merge request
alpha/sun!361
parents
ea417569
a484036a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
2 deletions
+41
-2
reply.py
api/reply.py
+27
-2
topic.py
api/topic.py
+14
-0
No files found.
api/reply.py
View file @
fee2da8a
...
...
@@ -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
i
n
[
USER_EXTRA_TYPE
.
REAL
,
USER_EXTRA_TYPE
.
SHADOW
,
USER_EXTRA_TYPE
.
KOL
]
:
if
reply_user_type
i
s
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
i
n
[
USER_EXTRA_TYPE
.
REAL
,
USER_EXTRA_TYPE
.
SHADOW
,
USER_EXTRA_TYPE
.
KOL
]
:
if
replied_user_type
i
s
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
:
...
...
api/topic.py
View file @
fee2da8a
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment