Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
nyx
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
发现
nyx
Commits
a74f12de
Commit
a74f12de
authored
Feb 21, 2021
by
jscat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nyx live:
功能: 添加redis服务
parent
5af3116b
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
120 行增加
和
6 行删除
+120
-6
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/common/ExceptionMsg.java
+1
-1
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/Rockwell_keyService.java
+4
-2
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/Rockwell_redisService.java
+19
-0
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/impl/Rockwell_keyServiceImpl.java
+30
-0
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/impl/Rockwell_redisServiceImpl.java
+49
-0
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/web/common/HttpRequest.java
+5
-2
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/web/controller/NyxApiController.java
+9
-1
app/nyx_app_key/api/src/main/resources/cn/com/fun/nyxkey/api/repository/Rockwell_keyMapper.xml
+3
-0
没有找到文件。
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/common/ExceptionMsg.java
查看文件 @
a74f12de
...
...
@@ -49,6 +49,6 @@ public enum ExceptionMsg {
return
msg
;
}
}
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/Rockwell_keyService.java
查看文件 @
a74f12de
...
...
@@ -99,11 +99,13 @@ public interface Rockwell_keyService {
jscat 20201127
*/
JSONResult
Rockwell_keyServiceGetLives
(
String
orderType
,
int
pageNum
,
int
pageCount
);
void
Rockwell_keyServiceUpdateWatcherToRedis
(
String
sid
,
String
city
,
Double
count
);
int
Rockwell_keyServiceUpdateWatcherByRedisToDB
(
Set
<
Tuple
>
set
);
JSONResult
Rockwell_keyServiceGetLivesByRedis
(
String
city
,
String
title
,
String
orderType
,
int
pageNum
,
int
pageCount
);
JSONResult
Rockwell_keyServiceAddLive
(
String
title
,
String
city
,
String
address
,
String
noteImage
,
String
liveId
);
int
Rockwell_keyServiceUpdateLive
(
String
title
,
String
liveStatus
,
String
userId
);
int
Rockwell_keyServiceAddLiveToRedis
(
String
title
,
String
city
,
String
address
,
String
noteImage
,
String
liveId
);
void
Rockwell_keyServiceUpdateWatcherToRedis
(
String
sid
,
String
city
,
Double
count
);
int
Rockwell_keyServiceUpdateWatcherByRedisToDB
(
Set
<
Tuple
>
set
);
// testing
void
Rockwell_keyServiceTest
(
List
<
Rockwell_keyT_match
>
listRockwell_keyT_match
);
...
...
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/Rockwell_redisService.java
0 → 100644
查看文件 @
a74f12de
package
cn
.
com
.
fun
.
nyxkey
.
api
.
service
;
import
cn.com.fun.nyxkey.api.common.JSONResult
;
import
cn.com.fun.nyxkey.api.domain.*
;
import
cn.com.fun.nyxkey.api.domain.*
;
import
cn.com.fun.nyxkey.api.domain.query.*
;
import
org.joda.time.DateTime
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by jscat on 2020/12/09.
*/
public
interface
Rockwell_redisService
{
}
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/impl/Rockwell_keyServiceImpl.java
查看文件 @
a74f12de
...
...
@@ -1112,6 +1112,36 @@ public class Rockwell_keyServiceImpl implements Rockwell_keyService {
return
jsonResult
;
}
public
int
Rockwell_keyServiceAddLiveToRedis
(
String
title
,
String
city
,
String
address
,
String
noteImage
,
String
liveId
)
{
List
<
Rockwell_keyV_live_info
>
listRockwell_keyV_live_info
=
new
ArrayList
<>();
Rockwell_keyT_liveQuery
rockwell_keyT_liveQuery
=
new
Rockwell_keyT_liveQuery
();
String
keyname
=
"nyx:live:num_watcher"
;
String
strKeyZset
=
keyname
+
":zset:"
+
city
;
String
strKeyHash
=
keyname
+
":hash:"
+
city
;
//step3: 查询数据
rockwell_keyT_liveQuery
.
setLiveId
(
liveId
);
listRockwell_keyV_live_info
=
rockwell_keyMapper
.
getV_live_info
(
rockwell_keyT_liveQuery
);
JSONObject
jsonObject
=
new
JSONObject
();
for
(
Rockwell_keyV_live_info
rockwell_keyV_live_info
:
listRockwell_keyV_live_info
)
{
jsonObject
.
put
(
"title"
,
rockwell_keyV_live_info
.
getTitle
());
jsonObject
.
put
(
"city"
,
rockwell_keyV_live_info
.
getCity
());
jsonObject
.
put
(
"address"
,
rockwell_keyV_live_info
.
getAddress
());
jsonObject
.
put
(
"nyxName"
,
rockwell_keyV_live_info
.
getNyxName
());
jsonObject
.
put
(
"avatarUrl"
,
rockwell_keyV_live_info
.
getAvatarUrl
());
jsonObject
.
put
(
"noteImage"
,
rockwell_keyV_live_info
.
getNoteImage
());
Double
score
=
Double
.
valueOf
(
rockwell_keyV_live_info
.
getNumWatcher
());
jedisUtil
.
zadd
(
strKeyZset
,
score
,
rockwell_keyV_live_info
.
getLiveId
());
jedisUtil
.
hset
(
strKeyHash
,
rockwell_keyV_live_info
.
getLiveId
(),
jsonObject
.
toJSONString
());
}
return
1
;
}
public
void
Rockwell_keyServiceUpdateWatcherToRedis
(
String
sid
,
String
city
,
Double
count
)
{
String
keyname
=
"nyx:live:num_watcher:zset:"
+
city
;
...
...
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/service/impl/Rockwell_redisServiceImpl.java
0 → 100644
查看文件 @
a74f12de
package
cn
.
com
.
fun
.
nyxkey
.
api
.
service
.
impl
;
import
cn.com.fun.nyxkey.api.common.ExceptionMsg
;
import
cn.com.fun.nyxkey.api.common.JSONResult
;
import
cn.com.fun.nyxkey.api.service.*
;
import
cn.com.fun.nyxkey.api.utils.JedisUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.ByteArrayEntity
;
import
org.apache.http.entity.ContentType
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClientBuilder
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.util.EntityUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.imageio.ImageIO
;
import
java.awt.image.BufferedImage
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.*
;
/**
* Created by jscat on 2020/12/09.
*/
@Service
public
class
Rockwell_redisServiceImpl
implements
Rockwell_redisService
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
Rockwell_keyServiceImpl
.
class
);
@Autowired
JedisUtil
jedisUtil
;
}
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/web/common/HttpRequest.java
查看文件 @
a74f12de
...
...
@@ -40,8 +40,11 @@ public class HttpRequest {
String
result
=
""
;
BufferedReader
in
=
null
;
try
{
String
urlNameString
=
url
+
"?"
+
param
;
URL
realUrl
=
new
URL
(
urlNameString
);
if
(!
param
.
equals
(
""
))
{
url
=
url
+
"?"
+
param
;
}
URL
realUrl
=
new
URL
(
url
);
// 打开和URL之间的连接
URLConnection
connection
=
realUrl
.
openConnection
();
// 设置通用的请求属性
...
...
app/nyx_app_key/api/src/main/java/cn/com/fun/nyxkey/api/web/controller/NyxApiController.java
查看文件 @
a74f12de
...
...
@@ -44,6 +44,9 @@ public class NyxApiController {
@Autowired
private
Rockwell_ossService
ossService
;
@Autowired
Rockwell_redisService
redisService
;
//AccessKeyId表示RAM子账号的AccessKeyId;
@Value
(
"${resubmit.interval}"
)
private
int
interval
;
...
...
@@ -728,7 +731,12 @@ public class NyxApiController {
@RequestParam
(
value
=
"liveId"
,
required
=
false
,
defaultValue
=
"0"
)
String
liveId
)
{
return
keyService
.
Rockwell_keyServiceAddLive
(
title
,
city
,
address
,
noteImage
,
liveId
);
JSONResult
json
=
keyService
.
Rockwell_keyServiceAddLive
(
title
,
city
,
address
,
noteImage
,
liveId
);
if
(
json
.
getTotalCount
()
!=
0
)
{
keyService
.
Rockwell_keyServiceAddLiveToRedis
(
title
,
city
,
address
,
noteImage
,
liveId
);
}
return
json
;
}
/*
...
...
app/nyx_app_key/api/src/main/resources/cn/com/fun/nyxkey/api/repository/Rockwell_keyMapper.xml
查看文件 @
a74f12de
...
...
@@ -707,6 +707,9 @@ limitations under the License.
<if
test=
"liveStatus != null and liveStatus != '' "
>
AND live_status=#{liveStatus}
</if>
<if
test=
"liveId != null and liveId != '' "
>
AND live_id=#{liveId}
</if>
<if
test=
"city != null and city != '' "
>
AND city=#{city}
</if>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论