Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
saturn
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
钟尚武
saturn
Commits
e107801a
Commit
e107801a
authored
Jan 10, 2019
by
zhanglu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建帖子时,用户检测
parent
600da6e3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
topic.py
api/views/topic.py
+6
-0
user.py
libs/user.py
+13
-0
No files found.
api/views/topic.py
View file @
e107801a
...
...
@@ -3,6 +3,8 @@ import json
from
api.views.base_view
import
BaseView
from
api.utils.sensitive
import
Sensitive
from
libs.user
import
get_user_by_ids
from
alpha_types.venus
import
ERROR
as
CODES
class
CreateTopicForBatch
(
BaseView
):
"""
...
...
@@ -16,6 +18,10 @@ class CreateTopicForBatch(BaseView):
if
not
user_id
:
return
self
.
parameter_invalid_response
()
user_info
=
get_user_by_ids
([
user_id
])
if
not
user_info
:
return
self
.
error
(
self
.
get_ErrorInfo
(
CODES
.
USER_NOT_FOUND
))
if
not
topic_list
:
return
self
.
ok
()
...
...
libs/user.py
View file @
e107801a
...
...
@@ -7,6 +7,7 @@ from helios.rpc import RPCFaultException
from
libs.utils
import
DictWrapperUseDot
from
engine.logger
import
auth_logger
from
engine.rpc
import
get_current_rpc_invoker
def
get_user_by_request
(
request
):
...
...
@@ -33,6 +34,18 @@ def get_user_by_request(request):
return
DictWrapperUseDot
(
info
)
def
get_user_by_ids
(
user_ids
):
"""获取用户信息"""
try
:
rpc
=
get_current_rpc_invoker
()
users_info
=
rpc
[
"venus/account/user/userinfo_list"
](
user_ids
=
user_ids
)
.
unwrap
()
except
:
return
None
return
users_info
def
auth
(
request
):
user_info
=
get_user_by_request
(
request
)
if
not
user_info
:
...
...
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