Toggle navigation
Toggle navigation
This project
Loading...
Sign in
万朱浩
/
Venue-Ops
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
kpt
2024-07-03 20:35:59 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
afd50ff32f66879a2f329c3e2529587d727e2460
afd50ff3
1 parent
9c2740c2
【page.py】添加话题页接口
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
32 deletions
views/page/page.py
views/page/page.py
View file @
afd50ff
from
flask
import
Flask
,
session
,
render_template
,
redirect
,
Blueprint
,
request
from
flask
import
Flask
,
session
,
render_template
,
redirect
,
Blueprint
,
request
from
snownlp
import
SnowNLP
from
utils.getHomePageData
import
*
from
utils.getHotWordPageData
import
*
from
utils.getTableData
import
*
from
utils.getPublicData
import
getAllHotWords
from
utils.getPublicData
import
getAllHotWords
,
getAllTopics
from
utils.getEchartsData
import
*
pb
=
Blueprint
(
'page'
,
__name__
,
url_prefix
=
'/page'
,
template_folder
=
'templates'
)
from
utils.getTopicPageData
import
*
pb
=
Blueprint
(
'page'
,
__name__
,
url_prefix
=
'/page'
,
template_folder
=
'templates'
)
@pb.route
(
'/home'
)
def
home
():
username
=
session
.
get
(
'username'
)
articleLenMax
,
likeCountMaxAuthorName
,
cityMax
=
getHomeTagsData
()
articleLenMax
,
likeCountMaxAuthorName
,
cityMax
=
getHomeTagsData
()
commentsLikeCountTopFore
=
getHomeCommentsLikeCountTopFore
()
xData
,
yData
=
getHomeArticleCreatedAtChart
()
xData
,
yData
=
getHomeArticleCreatedAtChart
()
typeChart
=
getHomeTypeChart
()
createAtChart
=
getHomeCommentCreatedChart
()
# getUserNameWordCloud()
...
...
@@ -25,17 +31,18 @@ def home():
xData
=
xData
,
yData
=
yData
,
typeChart
=
typeChart
,
createAtChart
=
createAtChart
)
createAtChart
=
createAtChart
)
@pb.route
(
'/hotWord'
)
def
hotWord
():
username
=
session
.
get
(
'username'
)
hotWordList
=
getAllHotWords
()
defaultHotWord
=
hotWordList
[
0
][
0
]
if
request
.
args
.
get
(
'hotWord'
):
defaultHotWord
=
request
.
args
.
get
(
'hotWord'
)
if
request
.
args
.
get
(
'hotWord'
):
defaultHotWord
=
request
.
args
.
get
(
'hotWord'
)
hotWordLen
=
getHotWordLen
(
defaultHotWord
)
xData
,
yData
=
getHotWordPageCreatedAtCharData
(
defaultHotWord
)
xData
,
yData
=
getHotWordPageCreatedAtCharData
(
defaultHotWord
)
sentences
=
''
value
=
SnowNLP
(
defaultHotWord
)
.
sentiments
if
value
==
0.5
:
...
...
@@ -54,20 +61,45 @@ def hotWord():
sentences
=
sentences
,
xData
=
xData
,
yData
=
yData
,
comments
=
comments
)
comments
=
comments
)
@pb.route
(
'/hotTopic'
)
def
hotTopic
():
username
=
session
.
get
(
'username'
)
topicList
=
getAllTopics
()
defaultTopic
=
topicList
[
0
][
0
]
if
request
.
args
.
get
(
'topic'
):
defaultTopic
=
request
.
args
.
get
(
'topic'
)
topicLen
=
getTopicLen
(
defaultTopic
)
xData
,
yData
=
getTopicPageCreatedAtCharData
()
sentences
=
''
# ... 这里要嵌入 topic 相关内容(热度?)来填充 sentences
comments
=
getCommentFilterDataTopic
(
defaultTopic
)
return
render_template
(
'hotWord.html'
,
username
=
username
,
topicList
=
topicList
,
defaultTopic
=
defaultTopic
,
topicLen
=
topicLen
,
sentences
=
sentences
,
xData
=
xData
,
yData
=
yData
,
comments
=
comments
)
@pb.route
(
'/tableData'
)
def
tableData
():
username
=
session
.
get
(
'username'
)
defaultFlag
=
False
if
request
.
args
.
get
(
'flag'
):
defaultFlag
=
True
if
request
.
args
.
get
(
'flag'
):
defaultFlag
=
True
tableData
=
getTableDataList
(
defaultFlag
)
return
render_template
(
'tableData.html'
,
username
=
username
,
tableData
=
tableData
,
defaultFlag
=
defaultFlag
)
defaultFlag
=
defaultFlag
)
@pb.route
(
'/articleChar'
)
def
articleChar
():
...
...
@@ -75,9 +107,9 @@ def articleChar():
typeList
=
getTypeList
()
defaultType
=
typeList
[
0
]
if
request
.
args
.
get
(
'type'
):
defaultType
=
request
.
args
.
get
(
'type'
)
xData
,
yData
=
getArticleCharLikeCount
(
defaultType
)
x1Data
,
y1Data
=
getArticleCharCommentsLen
(
defaultType
)
x2Data
,
y2Data
=
getArticleCharRepotsLen
(
defaultType
)
xData
,
yData
=
getArticleCharLikeCount
(
defaultType
)
x1Data
,
y1Data
=
getArticleCharCommentsLen
(
defaultType
)
x2Data
,
y2Data
=
getArticleCharRepotsLen
(
defaultType
)
return
render_template
(
'articleChar.html'
,
username
=
username
,
typeList
=
typeList
,
...
...
@@ -87,8 +119,8 @@ def articleChar():
x1Data
=
x1Data
,
y1Data
=
y1Data
,
x2Data
=
x2Data
,
y2Data
=
y2Data
)
y2Data
=
y2Data
)
@pb.route
(
'/ipChar'
)
def
ipChar
():
...
...
@@ -98,27 +130,27 @@ def ipChar():
return
render_template
(
'ipChar.html'
,
username
=
username
,
articleRegionData
=
articleRegionData
,
commentRegionData
=
commentRegionData
)
commentRegionData
=
commentRegionData
)
@pb.route
(
'/commentChar'
)
def
commentChar
():
username
=
session
.
get
(
'username'
)
xData
,
yData
=
getCommentCharDataOne
()
xData
,
yData
=
getCommentCharDataOne
()
genderPieData
=
getCommentCharDataTwo
()
return
render_template
(
'commentChar.html'
,
username
=
username
,
xData
=
xData
,
yData
=
yData
,
genderPieData
=
genderPieData
)
genderPieData
=
genderPieData
)
@pb.route
(
'/yuqingChar'
)
def
yuqingChar
():
username
=
session
.
get
(
'username'
)
xData
,
yData
,
bieData
=
getYuQingCharDataOne
()
bieData1
,
bieData2
=
getYuQingCharDataTwo
()
x1Data
,
y1Data
=
getYuQingCharDataThree
()
xData
,
yData
,
bieData
=
getYuQingCharDataOne
()
bieData1
,
bieData2
=
getYuQingCharDataTwo
()
x1Data
,
y1Data
=
getYuQingCharDataThree
()
return
render_template
(
'yuqingChar.html'
,
username
=
username
,
xData
=
xData
,
...
...
@@ -127,12 +159,10 @@ def yuqingChar():
bieData1
=
bieData1
,
bieData2
=
bieData2
,
x1Data
=
x1Data
,
y1Data
=
y1Data
)
y1Data
=
y1Data
)
@pb.route
(
'/articleCloud'
)
def
articleCloud
():
username
=
session
.
get
(
'username'
)
return
render_template
(
'articleContentCloud.html'
,
username
=
username
)
return
render_template
(
'articleContentCloud.html'
,
username
=
username
)
...
...
Please
register
or
login
to post a comment