Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦境迷离
Sim
提交
65e10627
S
Sim
项目概览
梦境迷离
/
Sim
10 个月 前同步成功
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Sim
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
65e10627
编写于
5月 30, 2020
作者:
梦境迷离
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复建群后不刷新看不到群,修复多个加群消息被覆盖
上级
fd3e8c2e
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
17 addition
and
12 deletion
+17
-12
README.md
README.md
+2
-0
deploy.sh
deploy.sh
+1
-1
src/main/resources/schema.sql
src/main/resources/schema.sql
+1
-1
src/main/scala/cn/edu/layim/websocket/WebSocketProvider.scala
...main/scala/cn/edu/layim/websocket/WebSocketProvider.scala
+2
-0
src/main/scala/cn/edu/layim/websocket/WebSocketServer.scala
src/main/scala/cn/edu/layim/websocket/WebSocketServer.scala
+8
-7
src/main/webapp/index.html
src/main/webapp/index.html
+2
-2
src/main/webapp/static/js/group.js
src/main/webapp/static/js/group.js
+1
-1
未找到文件。
README.md
浏览文件 @
65e10627
...
...
@@ -64,6 +64,8 @@
*
增加scalafmt格式化
*
打包并发布
*
修复建群后不刷新看不到群
*
修复同一个人的多个加群的消息被覆盖
### v1.2 版本
...
...
deploy.sh
浏览文件 @
65e10627
...
...
@@ -2,7 +2,7 @@
git pull origin master
gradle
clean
build
gradle build
gradle bootRepackage
...
...
src/main/resources/schema.sql
浏览文件 @
65e10627
...
...
@@ -14,7 +14,7 @@ CREATE TABLE `t_add_message` (
`type`
tinyint
(
2
)
NOT
NULL
DEFAULT
'0'
COMMENT
'类型,可能是添加好友或群组'
,
`time`
datetime
NOT
NULL
COMMENT
'申请时间'
,
PRIMARY
KEY
(
`id`
),
UNIQUE
KEY
`add_friend_unique`
(
`from_uid`
,
`to_uid`
,
`type`
)
USING
BTREE
UNIQUE
KEY
`add_friend_unique`
(
`from_uid`
,
`to_uid`
,
`
group_id`
,
`
type`
)
USING
BTREE
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
25
DEFAULT
CHARSET
=
utf8mb4
;
-- ----------------------------
...
...
src/main/scala/cn/edu/layim/websocket/WebSocketProvider.scala
浏览文件 @
65e10627
...
...
@@ -24,6 +24,7 @@ import org.reactivestreams.Publisher
import
org.slf4j.Logger
import
org.slf4j.LoggerFactory
import
org.springframework.beans.factory.annotation.Autowired
import
org.springframework.context.annotation.DependsOn
import
org.springframework.stereotype.Component
import
scala.collection.JavaConverters._
...
...
@@ -38,6 +39,7 @@ import scala.language.postfixOps
* @version 1.2
*/
@Component
@DependsOn
(
Array
(
"redisService"
))
class
WebSocketProvider
@Autowired
()
(
redisService
:
RedisService
)
{
implicit
val
system
:
ActorSystem
=
ActorSystem
()
implicit
val
mat
:
Materializer
=
ActorMaterializer
()
...
...
src/main/scala/cn/edu/layim/websocket/WebSocketServer.scala
浏览文件 @
65e10627
...
...
@@ -39,7 +39,7 @@ class WebSocketServer @Autowired() (redisService: RedisService, akkaService: Web
private
val
host
=
ConfigFactory
.
load
(
"application.conf"
).
getString
(
"akka-http-server.host"
)
private
val
port
=
ConfigFactory
.
load
(
"application.conf"
).
getInt
(
"akka-http-server.port"
)
val
IM
ServerSettings
=
{
private
val
im
ServerSettings
=
{
//自定义保持活动数据有效负载
val
defaultSettings
=
ServerSettings
(
system
)
val
pingCounter
=
new
AtomicInteger
()
...
...
@@ -49,7 +49,7 @@ class WebSocketServer @Autowired() (redisService: RedisService, akkaService: Web
defaultSettings
.
withWebsocketSettings
(
IMWebsocketSettings
)
}
val
IM
Route
=
{
private
val
im
Route
=
{
path
(
"websocket"
)
{
get
{
parameters
(
"uid"
.
as
[
Int
])
{
uid
=>
...
...
@@ -62,7 +62,11 @@ class WebSocketServer @Autowired() (redisService: RedisService, akkaService: Web
}
def
startUp
()
{
println
(
val
bindingFuture
=
Http
().
bindAndHandle
(
imRoute
,
host
,
port
,
settings
=
imServerSettings
)
bindingFuture
.
failed
.
foreach
{
ex
=>
LOGGER
.
error
(
s
"Failed to bind to $host:$port!"
)
}
LOGGER
.
info
(
"""
| __ __ ___. _________ __ __ _________
|/ \ / \ ____\_ |__ / _____/ ____ ____ | | __ _____/ |_ / _____/ ______________ __ ___________
...
...
@@ -72,10 +76,7 @@ class WebSocketServer @Autowired() (redisService: RedisService, akkaService: Web
| \/ \/ \/ \/ \/ \/ \/ \/ \/ \/
|"""
.
stripMargin
)
val
bindingFuture
=
Http
().
bindAndHandle
(
IMRoute
,
host
,
port
,
settings
=
IMServerSettings
)
bindingFuture
.
failed
.
foreach
{
ex
=>
LOGGER
.
error
(
s
"Failed to bind to $host:$port!"
)
}
LOGGER
.
info
(
s
"websocket listener on [$host:$port]"
)
StdIn
.
readLine
()
bindingFuture
.
flatMap
(
_
.
unbind
()).
onComplete
(
_
=>
system
.
terminate
())
}
...
...
src/main/webapp/index.html
浏览文件 @
65e10627
...
...
@@ -115,8 +115,8 @@
var
mima
=
$
.
base64
.
decode
(
mima
+
"
=
"
)
$
(
"
#password
"
).
val
(
mima
);
$
(
"
#loginkeeping
"
).
attr
(
"
checked
"
,
true
);
console
.
log
(
email
)
console
.
log
(
mima
)
//
console.log(email)
//
console.log(mima)
}
}
...
...
src/main/webapp/static/js/group.js
浏览文件 @
65e10627
...
...
@@ -58,7 +58,7 @@ layui.use(['jquery', 'layer', 'form', 'upload'], function () {
});
}
else
if
(
data
.
code
==
0
)
{
layer
.
msg
(
data
.
msg
,
{
time
:
2000
},
function
()
{
window
.
parent
.
location
.
reload
();
//刷新父
页面
window
.
parent
.
parent
.
location
.
reload
();
//刷新主
页面
});
}
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录