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
43247790
Commit
43247790
authored
Apr 16, 2019
by
王浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test' into 'master'
alpha 1.6 See merge request
alpha/saturn!40
parents
71028fb4
89891280
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
6 deletions
+43
-6
urls.py
api/urls.py
+1
-0
tag.py
api/views/tag.py
+3
-3
topic.py
api/views/topic.py
+17
-3
user.py
api/views/user.py
+22
-0
No files found.
api/urls.py
View file @
43247790
...
@@ -21,4 +21,5 @@ urlpatterns = [
...
@@ -21,4 +21,5 @@ urlpatterns = [
url
(
r'^v1/validate_3party_or_account$'
,
user
.
Validate3PartyOrAccount
.
as_view
(),
name
=
'validate_3party_or_account'
),
url
(
r'^v1/validate_3party_or_account$'
,
user
.
Validate3PartyOrAccount
.
as_view
(),
name
=
'validate_3party_or_account'
),
url
(
r'^v1/validate_3party_account$'
,
user
.
Validate3PartyAccount
.
as_view
(),
name
=
'validate_3party_account$'
),
url
(
r'^v1/validate_3party_account$'
,
user
.
Validate3PartyAccount
.
as_view
(),
name
=
'validate_3party_account$'
),
url
(
r'^v1/user/batch_create_shadow_user$'
,
user
.
BatchCreateShadowUser
.
as_view
(),
name
=
'batch_create_shadow_user$'
),
url
(
r'^v1/user/batch_create_shadow_user$'
,
user
.
BatchCreateShadowUser
.
as_view
(),
name
=
'batch_create_shadow_user$'
),
url
(
r'^v1/user/batch_update_user_level_fans$'
,
user
.
BatchUpdateUserLevelFansNum
.
as_view
(),
name
=
'batch_update_user_level_fans$'
),
]
]
api/views/tag.py
View file @
43247790
...
@@ -15,11 +15,11 @@ class CreateTagForBatch(BaseView):
...
@@ -15,11 +15,11 @@ class CreateTagForBatch(BaseView):
tags
=
[]
tags
=
[]
if
need_check
:
if
need_check
:
# 敏感词检测,获取可用的帖子
# 敏感词检测,获取可用的帖子
check_info
=
Sensitive
.
check
([
item
[
"name"
]
for
item
in
tag_list
if
item
.
get
(
"name"
)
])
check_info
=
Sensitive
.
check
([
item
for
item
in
tag_list
if
item
])
for
tag
in
tag_list
:
for
tag
in
tag_list
:
succ
=
check_info
.
get
(
tag
.
get
(
"name"
))
if
tag
.
get
(
"name"
)
else
True
succ
=
check_info
.
get
(
tag
)
if
tag
else
True
if
not
succ
:
if
not
succ
:
tags
.
append
(
tag
)
tags
.
append
(
{
"name"
:
tag
}
)
else
:
else
:
tags
=
tag_list
tags
=
tag_list
error
,
data
=
self
.
call_rpc
(
'venus/community/tag/batch_create_not_classify'
,
data
=
tags
)
error
,
data
=
self
.
call_rpc
(
'venus/community/tag/batch_create_not_classify'
,
data
=
tags
)
...
...
api/views/topic.py
View file @
43247790
...
@@ -57,6 +57,7 @@ class CreateTopicForBatch(BaseView):
...
@@ -57,6 +57,7 @@ class CreateTopicForBatch(BaseView):
if
not
topics
:
if
not
topics
:
return
self
.
ok
()
return
self
.
ok
()
location_tags
=
[]
tag_names
=
[]
tag_names
=
[]
for
item
in
topics
:
for
item
in
topics
:
tags
=
item
.
get
(
"tags"
)
or
[]
tags
=
item
.
get
(
"tags"
)
or
[]
...
@@ -65,6 +66,14 @@ class CreateTopicForBatch(BaseView):
...
@@ -65,6 +66,14 @@ class CreateTopicForBatch(BaseView):
item
[
"card_level"
]
=
card_level
item
[
"card_level"
]
=
card_level
item
[
"tag_id"
]
=
tag_id
if
tag_id
else
None
item
[
"tag_id"
]
=
tag_id
if
tag_id
else
None
item
[
"is_online"
]
=
is_online
item
[
"is_online"
]
=
is_online
if
item
.
get
(
"location"
)
and
item
.
get
(
"location"
)
.
get
(
"name"
):
_tag_error
,
_location_tag_data
=
self
.
call_rpc
(
"venus/community/tag/batch_create_tag_by_name"
,
tags
=
tags
,
is_location
=
1
,
is_own
=
1
,
)
if
_tag_error
:
return
self
.
error
(
_tag_error
)
location_tags
.
append
(
_location_tag_data
)
not_exists_ids
=
[]
not_exists_ids
=
[]
topic_list
=
[]
topic_list
=
[]
...
@@ -92,7 +101,7 @@ class CreateTopicForBatch(BaseView):
...
@@ -92,7 +101,7 @@ class CreateTopicForBatch(BaseView):
# check_info = Sensitive.check(tag_names)
# check_info = Sensitive.check(tag_names)
# tags = [tag_name for tag_name, succ in check_info.items() if not succ]
# tags = [tag_name for tag_name, succ in check_info.items() if not succ]
tags
=
tag_names
tags
=
tag_names
# 先创建标签
# 先创建标签
_tag_error
,
_tag_data
=
self
.
call_rpc
(
_tag_error
,
_tag_data
=
self
.
call_rpc
(
...
@@ -101,12 +110,17 @@ class CreateTopicForBatch(BaseView):
...
@@ -101,12 +110,17 @@ class CreateTopicForBatch(BaseView):
)
)
if
_tag_error
:
if
_tag_error
:
return
self
.
error
(
_tag_error
)
return
self
.
error
(
_tag_error
)
_tag_data
.
extend
(
location_tags
)
# 更新发帖
# 更新发帖
# 处理标签,将文本中的标签处理成现有标签
# 处理标签,将文本中的标签处理成现有标签
for
item
in
topic_list
:
for
item
in
topic_list
:
tags
=
item
.
get
(
"tags"
)
or
[]
tags
=
item
.
get
(
"tags"
)
or
[]
tags
=
[
tag
.
replace
(
"#"
,
''
)
.
strip
()
for
tag
in
tags
]
tags
=
[
tag
.
replace
(
"#"
,
''
)
.
strip
()
for
tag
in
tags
]
#添加地域标签
if
item
.
get
(
"location"
)
and
item
.
get
(
"location"
)
.
get
(
"name"
):
tags
.
append
(
item
.
get
(
"location"
)
.
get
(
"name"
))
content
=
item
[
"content"
]
content
=
item
[
"content"
]
for
tag_name
,
tag_id
in
_tag_data
.
items
():
for
tag_name
,
tag_id
in
_tag_data
.
items
():
if
tag_name
in
tags
:
if
tag_name
in
tags
:
...
@@ -181,12 +195,12 @@ class CreateTopicForBatchByOne(BaseView):
...
@@ -181,12 +195,12 @@ class CreateTopicForBatchByOne(BaseView):
# check_info = Sensitive.check(tag_names)
# check_info = Sensitive.check(tag_names)
# tags = [tag_name for tag_name, succ in check_info.items() if not succ]
# tags = [tag_name for tag_name, succ in check_info.items() if not succ]
# check_info = Sensitive.check(tag_names)
# check_info = Sensitive.check(tag_names)
tags
=
tag_names
tags
=
[{
"name"
:
item
}
for
item
in
tag_names
]
# 先创建标签
# 先创建标签
_tag_error
,
_tag_data
=
self
.
call_rpc
(
_tag_error
,
_tag_data
=
self
.
call_rpc
(
"venus/community/tag/batch_create_tag_by_name"
,
"venus/community/tag/batch_create_tag_by_name"
,
tag
_name
s
=
tags
tags
=
tags
)
)
if
_tag_error
:
if
_tag_error
:
return
self
.
error
(
_tag_error
)
return
self
.
error
(
_tag_error
)
...
...
api/views/user.py
View file @
43247790
...
@@ -113,3 +113,25 @@ class Validate3PartyOrAccount(BaseView):
...
@@ -113,3 +113,25 @@ class Validate3PartyOrAccount(BaseView):
return
self
.
ok
(
data
=
{
return
self
.
ok
(
data
=
{
"users"
:
data
,
"users"
:
data
,
})
})
class
BatchUpdateUserLevelFansNum
(
BaseView
):
"""批量更新用户星级 粉丝数"""
def
post
(
self
,
request
):
try
:
user_infos
=
json
.
loads
(
request
.
POST
.
get
(
"user_infos"
,
"[]"
))
except
:
update_data
=
[]
if
not
update_data
:
return
self
.
error
(
self
.
get_ErrorInfo
(
CODES
.
PARAMS_INCOMPLETE
))
err
,
ret
=
self
.
call_rpc
(
"venus/community/user/batch_update_user_leven_fans"
,
user_infos
=
user_infos
)
if
err
:
return
self
.
error
(
err
)
return
self
.
ok
()
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