集成websocket

This commit is contained in:
wangxulei
2025-01-10 16:06:30 +08:00
parent f2348ef1f5
commit 1b92d4371d
6 changed files with 15 additions and 30 deletions

View File

@@ -161,6 +161,7 @@
ORDER BY ORDER BY
create_time DESC create_time DESC
) wb ON wa.author_id = wb.authorId ) wb ON wa.author_id = wb.authorId
where wa.AUTHOR_ID != #{authorId}
GROUP BY GROUP BY
wa.author_id wa.author_id
ORDER BY ORDER BY

View File

@@ -1 +1 @@
package com.dd.admin.business.webSocket.handler; package com.dd.admin.business.webSocket.handler;

View File

@@ -47,6 +47,7 @@ class WebSocketManager {
console.log('WebSocket连接关闭'); console.log('WebSocket连接关闭');
this.isConnected = false; this.isConnected = false;
this.onCloseCallback && this.onCloseCallback(event); this.onCloseCallback && this.onCloseCallback(event);
this.reconnect(url);
}; };
this.webSocketInstance.onopen = () => { this.webSocketInstance.onopen = () => {
console.log("WebSocket连接成功"); console.log("WebSocket连接成功");

View File

@@ -32,6 +32,7 @@ service.interceptors.request.use(
error => { error => {
// do something with request error // do something with request error
console.log(error) // for debug console.log(error) // for debug
return Promise.reject(error) return Promise.reject(error)
} }
) )

View File

@@ -42,39 +42,20 @@
} }
}, },
mounted(){ mounted(){
webSocketManager.connect('ws://192.168.10.98:9326/?authorId=8') webSocketManager.connect('ws://192.168.1.136:9326/?authorId=8')
// 设置收到消息回调函数 // 设置收到消息回调函数
webSocketManager.onMessage((data) => { webSocketManager.onMessage((data) => {
if(data.handlerType == '6'){ if(data.handlerType == '6'){
console.log('mounted') console.log('mounted')
console.log(JSON.stringify(data.body)) console.log(JSON.stringify(data.body))
const {IMUI} = this.$refs; const {IMUI} = this.$refs;
IMUI.appendMessage({ IMUI.appendMessage(data.body);
"content": "1",
"fromUser": {
"avatar": "http://8.146.211.120:8080/upload/avatar/avatar (3).jpg",
"displayName": "复古喵星人15",
"id": "8"
},
"handlerType": 0,
"id": "c4d344c83fe0e86e23b7508b73e0b5ef",
"sendTime": 1736439914000,
"status": "succeed",
"toContactId": "8",
"type": "text"
});
} }
}); });
}, },
methods: { methods: {
handleMessage(e) {
console.log('在Vue组件中接收到消息并处理消息内容:');
// 这里可以根据组件的业务逻辑,比如将消息展示在页面上,更新组件状态等操作
},
open() { open() {
this.dialogVisible = true this.dialogVisible = true
this.getAuthorList() this.getAuthorList()

View File

@@ -38,8 +38,8 @@
z-0 z-0
"></div> "></div>
<div class="w-full max-w-md z-10"> <div class="w-full max-w-md z-10">
<div class="sm:text-4xl xl:text-4xl font-bold leading-tight mb-6">门店会员收银系统(开源版)</div> <div class="sm:text-4xl xl:text-4xl font-bold leading-tight mb-6"></div>
<div class="sm:text-sm xl:text-md text-gray-200 font-normal">你的门店小助手</div> <div class="sm:text-sm xl:text-md text-gray-200 font-normal"></div>
</div> </div>
<ul class="circles"> <ul class="circles">
<li></li> <li></li>
@@ -207,11 +207,12 @@
</div> </div>
<div style="font-weight: 500;font-size: 13px;letter-spacing: 1px;"> <div style="font-weight: 500;font-size: 13px;letter-spacing: 1px;">
<span>门店账号用户名:demo 密码111111</span><br/><br/> <!-- <span>门店账号用户名:demo 密码111111</span><br/><br/>-->
<span>管理端账号用户名:admin 密码111111</span><br/><br/> <!-- <span>管理端账号用户名:admin 密码111111</span><br/><br/>-->
<span>商业合作qq: 7827869402 vx: MAMBA_4EVER24</span><br/><br/> <!-- <span>商业合作qq: 7827869402 vx: MAMBA_4EVER24</span><br/><br/>-->
<span> <a target="_blank" style="text-decoration: underline;" href="http://8.146.211.120:8086/"> 完整版演示 http://8.146.211.120:8086/</a></span><br/><br/> <!-- <span> <a target="_blank" style="text-decoration: underline;" href="http://8.146.211.120:8086/"> 完整版演示 http://8.146.211.120:8086/</a></span><br/><br/>-->
<span> <a target="_blank" style="text-decoration: underline;" href="http://8.146.211.120:8087/"> 移动端登陆 http://8.146.211.120:8087/</a></span> <!-- <span> <a target="_blank" style="text-decoration: underline;" href="http://8.146.211.120:8087/"> 移动端登陆 http://8.146.211.120:8087/</a></span>-->
</div> </div>
<!-- <p class="--> <!-- <p class="-->
<!-- items-center--> <!-- items-center-->