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
戒酒的李白
2024-07-03 20:45:40 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
d67cc6c4f42522e7fd915bda0ac6aca408d6bbb6
d67cc6c4
2 parents
84214d7c
e49fc0e5
Merge branch 'main' of
https://github.com/666ghj/Weibo_PublicOpinion_AnalysisSystem
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
35 deletions
utils/getTopicPageData.py
views/page/page.py
views/user/user.py
utils/getTopicPageData.py
View file @
d67cc6c
...
...
@@ -19,7 +19,7 @@ def getTopicPageCreatedAtCharData(topic):# 统计包含特定热词的评论在
createdAt
[
i
[
1
]]
=
1
return
list
(
createdAt
.
keys
()),
list
(
createdAt
.
values
())
def
getCommentFilterData
(
topic
):
# 筛选包含特定热词的评论并返回这些评论的数据
def
getCommentFilterData
Topic
(
topic
):
# 筛选包含特定热词的评论并返回这些评论的数据
commentsList
=
getAllCommentsData
()
commentData
=
[]
for
i
in
commentsList
:
...
...
views/page/page.py
View file @
d67cc6c
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
)
...
...
views/user/user.py
View file @
d67cc6c
...
...
@@ -36,8 +36,6 @@ def register():
if
request
.
method
==
'GET'
:
return
render_template
(
'register.html'
)
else
:
if
request
.
form
[
'password'
]
!=
request
.
form
[
'checkPassword'
]:
return
errorResponse
(
'两次密码不符合'
)
def
filter_fn
(
user
):
return
request
.
form
[
'username'
]
in
user
...
...
Please
register
or
login
to post a comment