Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
searchhotcrawler
Overview
Overview
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
zhiwei
searchhotcrawler
Commits
5dbdbf3f
Commit
5dbdbf3f
authored
Aug 06, 2020
by
马黎滨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微博采集广告位标志
parent
3cda663a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
2 deletions
+20
-2
src/main/java/com/zhiwei/searchhotcrawler/bean/HotSearchCache.java
+11
-1
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
+9
-1
No files found.
src/main/java/com/zhiwei/searchhotcrawler/bean/HotSearchCache.java
View file @
5dbdbf3f
...
...
@@ -75,6 +75,11 @@ public class HotSearchCache {
*/
private
Integer
duration
;
/**
* 是否广告位
*/
private
Boolean
recommend
;
public
HotSearchCache
(
String
url
,
String
name
,
String
topicLead
,
Integer
highestCount
,
Integer
lastCount
,
Boolean
hot
,
...
...
@@ -95,6 +100,11 @@ public class HotSearchCache {
this
.
duration
=
duration
;
}
public
Boolean
getRecommend
()
{
return
recommend
;
}
public
void
setRecommend
(
Boolean
recommend
)
{
this
.
recommend
=
recommend
;
}
}
src/main/java/com/zhiwei/searchhotcrawler/dao/HotSearchCacheDAO.java
View file @
5dbdbf3f
...
...
@@ -67,6 +67,13 @@ public class HotSearchCacheDAO {
boolean
hot
=
document
.
getBoolean
(
"hot"
)!=
null
?
document
.
getBoolean
(
"hot"
):
true
;
String
url
=
document
.
getString
(
"url"
)!=
null
?
document
.
getString
(
"url"
):
null
;
String
id
=
name
+
"_"
+
type
;
boolean
recommend
=
false
;
if
(
"微博热搜"
.
equals
(
type
)){
String
icon
=
document
.
getString
(
"icon"
);
if
(
"recom"
.
equals
(
icon
)){
recommend
=
true
;
}
}
Document
query
=
new
Document
(
"_id"
,
id
);
//判断是否为微博推荐位,推荐位微博无排名,所以不纳入总的缓存表
...
...
@@ -102,6 +109,7 @@ public class HotSearchCacheDAO {
nowDoc
.
put
(
"preRank"
,
preRank
);
nowDoc
.
put
(
"preCount"
,
preCount
);
nowDoc
.
put
(
"duration"
,
durationNow
);
nowDoc
.
put
(
"recommend"
,
recommend
);
collection
.
replaceOne
(
query
,
nowDoc
);
}
else
{
nowDoc
=
new
Document
();
...
...
@@ -121,7 +129,7 @@ public class HotSearchCacheDAO {
nowDoc
.
put
(
"duration"
,
durationNow
);
nowDoc
.
put
(
"preRank"
,
null
);
nowDoc
.
put
(
"preCount"
,
null
);
nowDoc
.
put
(
"recommend"
,
recommend
);
collection
.
insertOne
(
nowDoc
);
}
}
...
...
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