Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
streamingUserPortrait
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
赵威
streamingUserPortrait
Commits
2b454c03
Commit
2b454c03
authored
Feb 05, 2021
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add reoad
parent
aef54307
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
22 deletions
+7
-22
Main.scala
src/main/scala/com.gmei.up/Main.scala
+2
-1
Redis.scala
src/main/scala/com.gmei.up/utils/Redis.scala
+5
-21
No files found.
src/main/scala/com.gmei.up/Main.scala
View file @
2b454c03
...
...
@@ -33,7 +33,8 @@ object Main {
// val query = ES.generateServiceDiaryRequest(List("光子嫩肤", "水光针"), List("丰胸", "胸部塑身"), -1)
// println("###############")
Redis
.
getRead
(
"abc"
,
"diary"
)
val
res
=
Redis
.
getRead
(
"64695DE0-B926-4188-9C62-D987DC20BEDF"
,
"diary"
)
res
.
foreach
(
println
)
// val env = StreamExecutionEnvironment.getExecutionEnvironment
...
...
src/main/scala/com.gmei.up/utils/Redis.scala
View file @
2b454c03
package
com.gmei.up.utils
import
scala.concurrent.Future
import
scala.collection.JavaConverters._
import
com.alibaba.fastjson.JSON
import
com.redis.
{
RedisClient
,
RedisClientPool
}
object
Redis
{
...
...
@@ -10,32 +12,14 @@ object Redis {
val
pRc2
=
new
RedisClient
(
"172.16.40.173"
,
6379
,
0
,
Some
(
"ReDis!GmTx*0aN9"
),
5000
)
// def get_user_portrait_tag3_read_v2(device_id: str, content_type: str) -> Tuple[List[Any], List[Any]]:
// key = get_user_portrait_tag3_read_key_v2(device_id, content_type)
// date_list_dict = await redis_client2.hgetall(key)
// read_list_v2 = []
// today_read = []
// if date_list_dict:
// before_5_days_date = get_before_5_days_date()
// today_read = json.loads(date_list_dict.get(before_5_days_date[0].encode(), '[]'))
// # 删除5天以外的已读记录
// for day in date_list_dict:
// day_decode = day.decode()
// if day_decode in before_5_days_date:
// read_list_v2.extend(json.loads(date_list_dict[day]))
// else:
// await redis_client2.hdel(key, day)
// res = (read_list_v2, today_read)
// return res
val
pRc4
=
new
RedisClientPool
(
"172.16.50.145"
,
6379
,
database
=
0
,
secret
=
Some
(
"XfkMCCdWDIU%ls$h"
),
timeout
=
500
)
def
getRead
(
deviceId
:
String
,
contentType
:
String
)
:
Unit
=
{
def
getRead
(
deviceId
:
String
,
contentType
:
String
)
:
List
[
Long
]
=
{
val
key
=
s
"doris:user_portrait:tag3:read_v2:device_id:${deviceId}:content_type:${contentType}"
val
today
=
java
.
time
.
LocalDate
.
now
.
toString
()
val
res
=
pRc2
.
hget
(
key
,
today
)
println
(
res
)
val
re
disRe
s
=
pRc2
.
hget
(
key
,
today
)
redisRes
.
map
(
s
=>
JSON
.
parseArray
(
s
,
classOf
[
Long
]).
asScala
.
toList
).
getOrElse
(
List
.
empty
[
Long
]
)
}
def
save
(
contentF
:
Future
[
IndexedSeq
[
Content
]],
deviceId
:
String
,
contentType
:
String
)
:
Unit
=
{
...
...
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