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
49f4db76
Commit
49f4db76
authored
6 years ago
by
许俊鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'xujunpeng/feature/alpha1_7' into 'test'
Xujunpeng/feature/alpha1 7 See merge request
alpha/sun!174
parents
6ca59e6f
aee08ad7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
0 deletions
+41
-0
pictorial.py
api/pictorial.py
+2
-0
tools.py
api/tools.py
+38
-0
urls.py
api/urls.py
+1
-0
No files found.
api/pictorial.py
View file @
49f4db76
...
...
@@ -60,6 +60,8 @@ class PictorialUpdateOrCreate(APIView):
'icon'
:
request
.
POST
.
get
(
'icon'
,
''
),
'collection_tag_ids'
:
collection_tag_ids
,
'is_home_recommend'
:
int
(
request
.
POST
.
get
(
'is_home_recommend'
,
0
)),
'add_score'
:
int
(
request
.
POST
.
get
(
'add_score'
,
0
)),
}
try
:
data
=
self
.
rpc
[
'venus/sun/pictorial/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
...
...
This diff is collapsed.
Click to expand it.
api/tools.py
View file @
49f4db76
...
...
@@ -35,3 +35,41 @@ class VirtualVote(APIView):
self
.
rpc
[
'venus/sun/tools/virtual_vote'
](
user_ids
=
user_ids
)
.
unwrap
()
return
{
'message'
:
u'上传成功'
,
'code'
:
200
}
class
BatchUpdateTopicTag
(
APIView
):
def
post
(
self
,
request
):
xls_file
=
request
.
FILES
.
get
(
'file'
)
if
not
xls_file
:
return
{
'message'
:
u'上传失败,请重新上传'
,
'code'
:
500
}
wb
=
load_workbook
(
xls_file
)
data
=
wb
.
get_sheet_by_name
(
wb
.
get_sheet_names
()[
0
])
rows_data
=
[
item
.
value
for
row
in
data
.
rows
for
item
in
row
if
item
.
value
]
topic_infos
=
[]
topic_tag_info
=
{}
for
index
,
item
in
enumerate
(
rows_data
):
if
index
==
len
(
rows_data
)
-
1
:
topic_infos
.
append
(
topic_tag_info
)
if
item
.
startswith
(
'http:'
):
print
(
item
)
if
topic_tag_info
.
get
(
'url'
):
topic_infos
.
append
(
topic_tag_info
)
print
(
topic_tag_info
)
topic_tag_info
=
{}
topic_tag_info
[
'url'
]
=
item
.
split
(
'-'
)[
0
]
.
replace
(
'http://alpha.iyanzhi.com/'
,
''
)
continue
if
item
.
split
(
':'
)[
-
1
]
and
topic_tag_info
.
get
(
'url'
):
if
not
topic_tag_info
.
get
(
'tags'
):
topic_tag_info
[
'tags'
]
=
[
item
.
split
(
':'
)[
-
1
]]
else
:
topic_tag_info
[
'tags'
]
.
append
(
item
.
split
(
':'
)[
-
1
])
self
.
rpc
[
'venus/sun/tools/batch_update_topic_tags'
](
topic_infos
=
topic_infos
)
.
unwrap
()
return
{
'message'
:
u'上传成功'
,
'code'
:
200
}
This diff is collapsed.
Click to expand it.
api/urls.py
View file @
49f4db76
...
...
@@ -136,6 +136,7 @@ urlpatterns = [
# 工具
url
(
r'^tools/virtual_vote$'
,
VirtualVote
.
as_view
()),
url
(
r'^tools/batch_update_topic_tag$'
,
BatchUpdateTopicTag
.
as_view
()),
#运营位
url
(
r'^topic/home_recommend/list'
,
TopicHomeRecommendList
.
as_view
()),
...
...
This diff is collapsed.
Click to expand it.
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