Commit 2d6e2c05 authored by 赵威's avatar 赵威

get data from redis

parent 6434b7b7
......@@ -22,8 +22,22 @@ object Redis {
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 redisRes = pRc2.hget(key, today)
redisRes.map(s => JSON.parseArray(s, classOf[Long]).asScala.toList).getOrElse(List.empty[Long])
try {
val redisRes = pRc2.hget(key, today)
redisRes.map(s => JSON.parseArray(s, classOf[Long]).asScala.toList).getOrElse(List.empty[Long])
} catch {
case e: Throwable =>
DingTalk.send(
Map(
"method" -> "Redis.getRead",
"deviceId" -> deviceId,
"contentType" -> contentType,
"error" -> e.getStackTrace.mkString("\n")
),
contentType = "exception"
)
List.empty[Long]
}
}
def save(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment