Compare commits

..

10 Commits

Author SHA1 Message Date
9650f4c0ac Merge branch 'master' of https://gitee.com/rowger_217/im-system 2026-02-23 16:29:24 +08:00
5c500438f5 备份 2026-02-23 16:27:44 +08:00
c2e9f24a0d 内网部署 2024-01-26 12:56:13 +08:00
7dc111e89d 聊天室 2023-12-10 23:59:03 +08:00
e1e98de4b2 history 2023-12-10 14:33:58 +08:00
chen zida
2cc4c82cbd feat json序列化时区 2023-12-07 14:32:03 +08:00
0760d28d36 bak 2023-12-07 14:23:26 +08:00
228943fc02 聊天记录 2023-12-05 20:24:36 +08:00
chen zida
8aa642ecb4 feat 修复会话列表 2023-12-05 17:30:38 +08:00
chen zida
3af5cc5f6e feat 会话顺序 2023-12-05 16:39:04 +08:00
51 changed files with 812 additions and 384 deletions

View File

@@ -0,0 +1,7 @@
VUE_APP_MAP_URL='https://192.168.2.181/geoserver'
VUE_APP_MAP_AUTHKEY='30efbafe-d218-4d77-8200-0207246924be'
VUE_APP_API="https://192.168.2.181/znzq"
VUE_APP_STATIC_FILE_Prefix='//192.168.2.181/static_file'
VUE_APP_SRS_URL='webrtc://192.168.2.181/'
VUE_APP_IM_API_URL='https://192.168.2.181/im_api/v1'
VUE_APP_MAP_ROUTE='https://192.168.2.181/route'

View File

@@ -1,7 +1,8 @@
VUE_APP_MAP_URL='http://82.157.23.170:8600/geoserver' VUE_APP_MAP_URL='http://82.157.23.170:8600/geoserver'
VUE_APP_MAP_AUTHKEY='9b488ac6-5309-4ef4-ab99-2180d2da161d' VUE_APP_MAP_AUTHKEY='9b488ac6-5309-4ef4-ab99-2180d2da161d'
VUE_APP_API="http://work.ii999.live:19002/znzq" VUE_APP_API="http://work.ii999.live:19002/znzq"
VUE_APP_STATIC_FILE_Prefix='//119.45.242.222/static_file' VUE_APP_STATIC_FILE_Prefix='//192.168.2.181/static_file'
VUE_APP_SRS_URL='webrtc://119.45.242.222/' VUE_APP_SRS_URL='webrtc://192.168.2.181/'
VUE_APP_IM_API_URL='https://dev.shudong.xyz/im_api/v1' VUE_APP_IM_API_URL='https://192.168.2.181/im_api/v1'
VUE_APP_MAP_ROUTE='https://172.16.3.18/geoserver'

View File

@@ -1,6 +1,8 @@
VUE_APP_MAP_URL='https://172.16.3.18/geoserver' VUE_APP_MAP_URL='https://172.16.3.18/geoserver'
VUE_APP_MAP_AUTHKEY='30efbafe-d218-4d77-8200-0207246924be' VUE_APP_MAP_AUTHKEY='30efbafe-d218-4d77-8200-0207246924be'
VUE_APP_API="https://172.16.3.18/znzq" VUE_APP_API="https://172.16.3.18/znzq"
VUE_APP_STATIC_FILE_Prefix='//172.16.3.18/static_file' VUE_APP_STATIC_FILE_Prefix='//172.16.3.18/static_file'
VUE_APP_SRS_URL='webrtc://172.16.3.18/' VUE_APP_SRS_URL='webrtc://172.16.3.18/'
VUE_APP_IM_API_URL='https://172.16.3.18/im_api/v1' VUE_APP_IM_API_URL='https://172.16.3.18/im_api/v1'
VUE_APP_MAP_ROUTE='https://172.16.3.18/route'

View File

@@ -8,6 +8,7 @@
"serve": "vue-cli-service serve --mode dev", "serve": "vue-cli-service serve --mode dev",
"prod-serve": "vue-cli-service serve --mode hd", "prod-serve": "vue-cli-service serve --mode hd",
"build:hd": "vue-cli-service build --mode hd && node deployHD.js", "build:hd": "vue-cli-service build --mode hd && node deployHD.js",
"build:company": "vue-cli-service build --mode company",
"build:online": "vue-cli-service build --mode dev", "build:online": "vue-cli-service build --mode dev",
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },

View File

@@ -1,9 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang=""> <html lang="">
<head> <head>
<script type="text/javascript" src="https://172.16.3.18/static_file/vconsole.min.js"></script> <!-- <script type="text/javascript" src="https://192.168.2.181/static_file/vconsole.min.js"></script>-->
<script> <script>
var vConsole = new VConsole(); // var vConsole = new VConsole();
console.log('Hello world'); console.log('Hello world');
</script> </script>
<meta charset="utf-8"> <meta charset="utf-8">

View File

@@ -36,7 +36,7 @@ function SrsRtcPublisherAsync() {
self.turn = { self.turn = {
iceServers: [{ iceServers: [{
urls: 'turns:172.16.3.18:3478', 'credential': 'huashiai', urls: 'turn:120.79.18.123:3478', 'credential': 'mars23600800',
'username': 'huashiai' 'username': 'huashiai'
}] }]
}; };
@@ -371,6 +371,11 @@ function SrsRtcPlayerAsync() {
await self.pc.setLocalDescription(offer); await self.pc.setLocalDescription(offer);
var session = await new Promise(function (resolve, reject) { var session = await new Promise(function (resolve, reject) {
// @see https://github.com/rtcdn/rtcdn-draft // @see https://github.com/rtcdn/rtcdn-draft
conf.apiUrl = conf.apiUrl.replace('172.16.3.17', '172.16.3.18');
conf.streamUrl = conf.streamUrl.replace('172.16.3.17', '172.16.3.18');
var data = { var data = {
api: conf.apiUrl, tid: conf.tid, streamurl: conf.streamUrl, api: conf.apiUrl, tid: conf.tid, streamurl: conf.streamUrl,
clientip: null, sdp: offer.sdp clientip: null, sdp: offer.sdp

View File

@@ -1,6 +1,6 @@
import Vue from 'vue' import Vue from 'vue'
import App from './App.vue' import App from './App.vue'
import utils from './utils/publicFun'; // import utils from './utils/publicFun';
import router from './router' import router from './router'
import axios from 'axios' import axios from 'axios'
@@ -15,7 +15,7 @@ import 'amfe-flexible';
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$utils = utils; // Vue.prototype.$utils = utils;
new Vue({ new Vue({
render: h => h(App), render: h => h(App),

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="videoRoomContainer"> <div class="videoRoomContainer">
<div class="wrapper"> <div class="wrapper">
<video ref="videoStreamtopVideo" width="100%" autoplay></video> <video @click="videoClick" ref="videoStreamtopVideo" width="100%" autoplay></video>
<div class="swiper-container"> <div class="swiper-container">
<div class="swiper-wrapper"> <div class="swiper-wrapper">
<template v-for="(item,index) in videoRoomSteamList"> <template v-for="(item,index) in videoRoomSteamList">
@@ -92,11 +92,14 @@ export default {
isForce: "0", isForce: "0",
hasVideo: "1", hasVideo: "1",
callSessionId: "", callSessionId: "",
callStatus: "watting",//房间状态 callStatus: "0",//房间状态 1 未开始等待 2已开始 3已关闭
callRoomInfoRequetTimes:0,//房间拉取次数 callRoomInfoRequetTimes:0,//房间拉取次数
client:"",
uuid:""
}; };
}, },
mounted() { mounted() {
this.uuid=uuidv4,
console.log(location.href) console.log(location.href)
console.log(location.href) console.log(location.href)
console.log(location.href) console.log(location.href)
@@ -114,8 +117,14 @@ export default {
this.showInviteConfirmDialog = getUrlParam("showInviteConfirmDialog"); this.showInviteConfirmDialog = getUrlParam("showInviteConfirmDialog");
this.hasVideo = getUrlParam("hasVideo"); this.hasVideo = getUrlParam("hasVideo");
this.isForce = getUrlParam("isForce"); this.isForce = getUrlParam("isForce");
this.client = getUrlParam("client");
let hd_gps_location = localStorage.getItem("hd_gps_location")
if (hd_gps_location) {
this.client="app"
}
this.voiceImg = getStatisFileUrl("/media/voice_open.png") this.voiceImg = getStatisFileUrl("/media/voice_open.png")
this.cameraImg = getStatisFileUrl("/media/camera_open.png") this.cameraImg = getStatisFileUrl("/media/camera_open.png")
this.switchCameraImg = getStatisFileUrl("/media/switch.png") this.switchCameraImg = getStatisFileUrl("/media/switch.png")
@@ -130,9 +139,12 @@ export default {
} }
this.token = this.$route.query.token || ""; this.token = getUrlParam("token");
if (this.token > 10) { console.log("token" + this.token)
if (this.token!=null) {
localStorage.setItem("hd_token", this.token) localStorage.setItem("hd_token", this.token)
}else {
console.warn("url中未获取到token")
} }
if (this.showConfirmDialog == 1) { if (this.showConfirmDialog == 1) {
@@ -141,8 +153,8 @@ export default {
message: `${this.inviteName}邀请你加入${this.videoTitle}聊天`, message: `${this.inviteName}邀请你加入${this.videoTitle}聊天`,
}) })
.then(() => { .then(() => {
this.callBegin();
this.init(); this.init();
this.callStatus=1
// on confirm // on confirm
}) })
.catch(() => { .catch(() => {
@@ -160,6 +172,7 @@ export default {
this.callSessionId = uuidv4(); this.callSessionId = uuidv4();
this.sendInvite(); this.sendInvite();
this.init(); this.init();
this.callStatus=1
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} }
@@ -225,9 +238,11 @@ export default {
} }
if (this.isPlayer == 1) { if (this.isPlayer == 1) {
this.getRoomVideoList(); this.getRoomVideoList();
this.roomTimer = setInterval(() => { this.roomTimer = setInterval(() => {
this.getRoomVideoList(); this.getRoomVideoList();
}, 2000) }, 2000)
} }
this.swiperInstance = new Swiper('.swiper-container', { this.swiperInstance = new Swiper('.swiper-container', {
slidesPerView: 4, slidesPerView: 4,
@@ -274,6 +289,13 @@ export default {
this.beginPublish() this.beginPublish()
}, },
switchCamera() { switchCamera() {
/* if(this.client="app"){
location.href = "uniwebview://action?function=callRoomFuns&params1=switchCamara"
console.log("发送切换摄像头通知")
return false;
}
*/
let self = this; let self = this;
self.cameraIndex = self.cameraIndex + 1 == self.cameraDevices.length ? 0 : self.cameraIndex + 1 self.cameraIndex = self.cameraIndex + 1 == self.cameraDevices.length ? 0 : self.cameraIndex + 1
let deviceId = { let deviceId = {
@@ -307,6 +329,8 @@ export default {
console.log('navigator.getUserMedia error: ', error); console.log('navigator.getUserMedia error: ', error);
}, },
beginPublish() { beginPublish() {
let _this = this; let _this = this;
//http://localhost:8080/hd-glasses-app/#/call_room?isPublish=1&isPlayer=1&uid=123&room=call_room //http://localhost:8080/hd-glasses-app/#/call_room?isPublish=1&isPlayer=1&uid=123&room=call_room
@@ -318,7 +342,25 @@ export default {
navigator.mediaDevices.enumerateDevices().then(this.gotDevices).catch(this.handleError); navigator.mediaDevices.enumerateDevices().then(this.gotDevices).catch(this.handleError);
/* if(this.client=="app"){
if(this.constraints.video==false){
console.log("发送关闭摄像头通知")
location.href = "uniwebview://action?function=callRoomFuns&params1=closeCamara"
}else {
console.log("发送打开摄像头通知")
location.href = "uniwebview://action?function=callRoomFuns&params1=openCamara"
}
if(this.constraints.audio==false){
console.log("发送关闭麦克风通知")
location.href = "uniwebview://action?function=callRoomFuns&params1=closeVoice"
}else {
console.log("发送打开麦克风通知")
location.href = "uniwebview://action?function=callRoomFuns&params1=openVoice"
}
return false;
}
*/
if (_this.publishSdk) { if (_this.publishSdk) {
_this.publishSdk.close(); _this.publishSdk.close();
} }
@@ -435,7 +477,30 @@ export default {
}, },
}).then(res => { }).then(res => {
if (res.status == 200) { if (res.status == 200) {
if(this.isPublish==1){
if(res.data.data.length==2){
if(this.callStatus==1){
this.callBegin();
}
this.callStatus=2
}
}else {
if(res.data.data.length==1){
if(this.callStatus==1){
this.callBegin();
}
this.callStatus=2
}
}
this.generateVideoRoomStream(res.data.data) this.generateVideoRoomStream(res.data.data)
if(this.client=="app"){
try {
location.href = "uniwebview://action?function=domMockClick&params1=300&params2=300";
}catch (e) {
}
}
}else { }else {
this.generateVideoRoomStream([]) this.generateVideoRoomStream([])
} }
@@ -459,12 +524,13 @@ export default {
}) })
}, },
callBegin() { callBegin() {
let passiveId=this.roomId==this.uid?this.tuid:this.tuid
let roomInfo = { let roomInfo = {
id:uuidv4(), id:uuidv4(),
inviteId: this.roomId,//后面改成发起人的手机号或者id inviteId: this.roomId,//后面改成发起人的手机号或者id
roomId: this.roomId, roomId: this.roomId,
passiveId: this.uid, passiveId: passiveId,
isForce: this.isForce, isForce: this.isForce,
type: this.hasVideo == 1 ? "video" : "voice", type: this.hasVideo == 1 ? "video" : "voice",
} }
@@ -482,10 +548,14 @@ export default {
}) })
}, },
callHangUp() { callHangUp() {
if(this.callStatus==3){
return false;
}
let roomInfo = { let roomInfo = {
sessionId: this.roomId, sessionId: this.roomId,
roomId:this.roomId roomId:this.roomId,
_uuid:this.uuid,
} }
axios({ axios({
@@ -504,13 +574,15 @@ export default {
cmd: "hangUp", cmd: "hangUp",
msgTxt: this.uname || "" msgTxt: this.uname || ""
}).then((res) => { }).then((res) => {
if (res.status == 200) { try {
this.publishSdk.close();
}catch (e) {
} }
this.callStatus=3;
clearInterval(this.roomTimer)
}) })
console.log(res)
}) })
}, },
joinRoom() { joinRoom() {
@@ -533,12 +605,80 @@ export default {
}, },
generateVideoRoomStream(videoList) { generateVideoRoomStream(videoList) {
this.callRoomInfoRequetTimes=this.callRoomInfoRequetTimes+1; this.callRoomInfoRequetTimes=this.callRoomInfoRequetTimes+1;
if(this.callRoomInfoRequetTimes>5){ //如果电话一直未拨通
if(this.callStatus==1){
if(this.callRoomInfoRequetTimes>12){
if(videoList.length==0){ if(videoList.length==0){
// 拉取5次房间列表之后如果房间里面视频流的数量为0则关掉房间 // 拉取5次房间列表之后如果房间里面视频流的数量为0则关掉房间
Notify({
message: '通讯异常,即将挂断',
duration: 2,
type: 'primary'
});
setTimeout(()=>{
this.videoDownAction() this.videoDownAction()
},1500)
}
if(videoList.length==1){
// 拉取5次房间列表之后如果房间里面视频流的数量为1,并且是自己的流,则关闭房间
if(videoList[0].publishId==this.uid){
Notify({
message: '通讯异常,即将挂断',
duration: 2,
type: 'primary'
});
setTimeout(()=>{
this.videoDownAction()
},1500)
}
//如果房间里面只有一路流,并且是查岗模式,则表示正常
if(this.isPublish==0){
this.callRoomInfoRequetTimes=0;
} }
} }
if(videoList.length==2){
this.callRoomInfoRequetTimes=0;
}
}
}
//如果电话打通过一次
if(this.callStatus==2){
if(this.callRoomInfoRequetTimes>2){
if(videoList.length==0){
// 拉取5次房间列表之后如果房间里面视频流的数量为0则关掉房间
Notify({
message: '通讯异常,即将挂断',
duration: 2,
type: 'primary'
});
setTimeout(()=>{
this.videoDownAction()
},1500)
}
if(videoList.length==1){
// 拉取5次房间列表之后如果房间里面视频流的数量为1,并且是自己的流,则关闭房间
if(videoList[0].publishId==this.uid){
Notify({
message: '通讯异常,即将挂断',
duration: 2,
type: 'primary'
});
setTimeout(()=>{
this.videoDownAction()
},1500)
}
//如果房间里面只有一路流,并且是查岗模式,则表示正常
if(this.isPublish==0){
this.callRoomInfoRequetTimes=0;
}
}
if(videoList.length==2){
this.callRoomInfoRequetTimes=0;
}
}
}
let hasUpdate = false; let hasUpdate = false;
if (this.oldVideoStreamList == null) { if (this.oldVideoStreamList == null) {
@@ -566,6 +706,12 @@ export default {
}, 1000) }, 1000)
//videoSteamList //videoSteamList
}, },
videoClick(){
this.videoRoomSteamList.map(item=>{
var video = eval('this.$refs.videoStream' + item.publishId)[0]
video.play();
})
},
videoClickAction(publishId) { videoClickAction(publishId) {
this.topVideo = publishId; this.topVideo = publishId;
var video = eval('this.$refs.videoStream' + publishId)[0] var video = eval('this.$refs.videoStream' + publishId)[0]

View File

@@ -145,6 +145,7 @@ export default {
isCanDraw: true, isCanDraw: true,
from: "", from: "",
routeType: "car", routeType: "car",
longpress: false
}; };
}, },
mounted() { mounted() {
@@ -180,7 +181,6 @@ export default {
case "pcPlanningPath": case "pcPlanningPath":
this.pcDrawType = "LineString"; this.pcDrawType = "LineString";
window.addEventListener('message', (event) => { window.addEventListener('message', (event) => {
this.isCanDraw = false this.isCanDraw = false
console.log(event.data) console.log(event.data)
if (this.parentPostMessageData.length == 0) { if (this.parentPostMessageData.length == 0) {
@@ -205,7 +205,7 @@ export default {
if (event.data instanceof Array) { if (event.data instanceof Array) {
this.map.removeLayer(this.drawPlanningPathLayer); this.map.removeLayer(this.drawPlanningPathLayer);
this.parentPostMessageData = event.data; this.parentPostMessageData = event.data;
this.drawPcPostMessageDataLayer() this.drawPcPostMessageDataLayer();
} else { } else {
this.isCanDraw = true; this.isCanDraw = true;
} }
@@ -360,6 +360,51 @@ export default {
zoom: 16, zoom: 16,
}), }),
}); });
if (this.pageType == "mini") {
var _this = this;
this.map.on("click", function (e) {
(_this.longpress) ? console.log("Long Press") : console.log("Short Press")
if (_this.longpress) {
console.log(e)
console.log(e.coordinate)
const startPoint = ol.proj.transform(e.coordinate, 'EPSG:3857', 'EPSG:4326');
location.href = "uniwebview://action?function=homeAddAlarmPoint&params1=" + JSON.stringify(startPoint);
} else {
_this.map.forEachFeatureAtPixel(
e.pixel,
(feature) => {
console.log("Feature被点击了")
console.log(feature)
if (feature.values_.type == 'alarm') {
_this.alarmDetailsData = feature.values_.data;
_this.alarmDetailsOverlay = true;
}
},
{
hitTolerance: 30
}
);
}
});
var startTime, endTime;
this.map.on('pointerdown', function () {
startTime = new Date().getTime();
});
this.map.on('pointerup', function () {
endTime = new Date().getTime();
console.log(endTime - startTime);
_this.longpress = (endTime - startTime < 500) ? false : true;
});
} else {
this.map.on('singleclick', e => { this.map.on('singleclick', e => {
this.map.forEachFeatureAtPixel( this.map.forEachFeatureAtPixel(
e.pixel, e.pixel,
@@ -376,6 +421,7 @@ export default {
} }
); );
}); });
}
}, },
/** /**
@@ -388,11 +434,99 @@ export default {
this.addPoints(e.coordinate); this.addPoints(e.coordinate);
} }
}); });
},
planningPathCar() {
const startPoint = ol.proj.transform(this.navigationStartPoint, 'EPSG:4326', 'EPSG:3857');
const endPoint = ol.proj.transform(this.navigationEndPoint, 'EPSG:4326', 'EPSG:3857');
let _url = process.env.VUE_APP_MAP_ROUTE +"/v0/driving/"
_url = _url + this.navigationStartPoint[0] + ","
_url = _url + this.navigationStartPoint[1] + ";"
_url = _url + this.navigationEndPoint[0] + ","
_url = _url + this.navigationEndPoint[1]
_url = _url + "?" + "alternatives=true&steps=true&geometries=geojson";
axios({
method: "get",
url: _url,
headers: {
'Content-Type': 'application/json;charset=utf-8'
},
}).then(res => {
console.log("================================获取到了导航结果")
res = res.data;
/*
console.log(res)
if (res.code != "OK") {
return false;
}else {
console.log("================================获取到了导航结果,开始步行导航")
}
*/
let pathList = [startPoint];
const coordinates = res.routes[0].geometry.coordinates
coordinates.map(item1 => {
const _point = ol.proj.transform(item1, 'EPSG:4326', 'EPSG:3857');
pathList.push(_point)
})
// let _list=res.route[0].legs[0].steps[0].intersections
//
// _list.map((item, index) => {
//
// })
pathList.push(endPoint)
console.log("==============================pathList")
console.log(pathList)
const route = new LineString(pathList)
const geometryMove = new Point(route.getFirstCoordinate());
const featureMove = new Feature({
type: "featureMove",
geometry: geometryMove,
});
// this.planningVectorLayer.set('id', 'planningVectorLayer');
//先清空 再清除
this.map.removeLayer(this.planningVectorLayer)
this.planningVectorLayer = new VectorLayer({
source: new VectorSource({
features: [
new Feature({
type: "route",
geometry: route,
}),
featureMove,
new Feature({
type: "icon",
geometry: new Point(route.getFirstCoordinate()),
}),
new Feature({
type: "icon",
geometry: new Point(route.getLastCoordinate()),
}),
],
}),
style: (feature) => {
return this.styles[feature.get("type")];
},
});
this.map.addLayer(this.planningVectorLayer)
})
}, },
planningPathFoot() { planningPathFoot() {
const startPoint = ol.proj.transform(this.navigationStartPoint, 'EPSG:4326', 'EPSG:3857'); const startPoint = ol.proj.transform(this.navigationStartPoint, 'EPSG:4326', 'EPSG:3857');
const endPoint = ol.proj.transform(this.navigationEndPoint, 'EPSG:4326', 'EPSG:3857'); const endPoint = ol.proj.transform(this.navigationEndPoint, 'EPSG:4326', 'EPSG:3857');
let _url = "https://172.16.3.18/route/v1/driving/" // let _url = "https://192.168.2.181/route/v1/driving/"
let _url = process.env.VUE_APP_MAP_ROUTE +"/v1/driving/"
_url = _url + this.navigationStartPoint[0] + "," _url = _url + this.navigationStartPoint[0] + ","
_url = _url + this.navigationStartPoint[1] + ";" _url = _url + this.navigationStartPoint[1] + ";"
_url = _url + this.navigationEndPoint[0] + "," _url = _url + this.navigationEndPoint[0] + ","
@@ -841,10 +975,12 @@ export default {
// 图层添加到地图上 // 图层添加到地图上
this.map.addLayer(this.alarmLayer); this.map.addLayer(this.alarmLayer);
var flag = true var flag = true
/*
this.alarmAnimation = setInterval(() => { this.alarmAnimation = setInterval(() => {
flag = !flag flag = !flag
this.alarmLayer.setVisible(flag) this.alarmLayer.setVisible(flag)
}, 1500); }, 1500);
*/
} }
@@ -857,6 +993,7 @@ export default {
//临时智慧所,小红旗 //临时智慧所,小红旗
if (record.alarmCategory == "1706273001850601474") { if (record.alarmCategory == "1706273001850601474") {
// 设置要素的图标 // 设置要素的图标
feature.setStyle( feature.setStyle(
new Style({ new Style({
// 设置图片效果 // 设置图片效果
@@ -998,12 +1135,22 @@ export default {
}, },
alarmClickAction(index) { alarmClickAction(index) {
try {
if (index == 1) { if (index == 1) {
location.href = "uniwebview://action?function=alarmConfirmAction&params1=" + this.alarmDetailsData.id; location.href = "uniwebview://action?function=alarmConfirmAction&params1=" + this.alarmDetailsData.id;
} }
if (index == 2) { if (index == 2) {
location.href = "uniwebview://action?function=alarmPlanningAction&params1=" + this.alarmDetailsData.id + "&params2=" + this.alarmDetailsData.location; location.href = "uniwebview://action?function=alarmPlanningAction&params1=" + this.alarmDetailsData.id + "&params2=" + this.alarmDetailsData.location;
} }
} catch (e) {
console.log(e)
}
setTimeout(() => {
this.alarmDetailsOverlay = false
}, 1000)
}, },
getAlarmDetails(id) { getAlarmDetails(id) {
service.get(`/api/alarm/queryById`, { service.get(`/api/alarm/queryById`, {
@@ -1017,7 +1164,7 @@ export default {
this.addPointWidthCoordinate(res.data.result.location, "alarm", res.data.result) this.addPointWidthCoordinate(res.data.result.location, "alarm", res.data.result)
setInterval(() => { setInterval(() => {
if (this.routeType == "car") { if (this.routeType == "car") {
this.planningPath() this.planningPathCar()
} }
if (this.routeType == "foot") { if (this.routeType == "foot") {
this.planningPathFoot() this.planningPathFoot()

View File

@@ -541,7 +541,6 @@ export default {
vectorSource.addFeature(polygonFeature); vectorSource.addFeature(polygonFeature);
} }
// 矢量地图 // 矢量地图
this.drawPlanningPathLayer = new VectorLayer({ this.drawPlanningPathLayer = new VectorLayer({
source: vectorSource, source: vectorSource,

View File

@@ -1151,7 +1151,7 @@ export default {
this.getPatrolInstanceRealyPath(res.data.result.actualStartTime,res.data.result.actualEndTime); this.getPatrolInstanceRealyPath(res.data.result.actualStartTime,res.data.result.actualEndTime);
setInterval(()=>{ setInterval(()=>{
this.getPatrolInstanceRealyPath(res.data.result.actualStartTime,res.data.result.actualEndTime); this.getPatrolInstanceRealyPath(res.data.result.actualStartTime,res.data.result.actualEndTime);
},50000) },2000)
} }
}) })
@@ -1175,6 +1175,7 @@ export default {
service.get(`/sys/equipment/trajectory`, { service.get(`/sys/equipment/trajectory`, {
params: { params: {
pageSize:1000,
uerId: this.moveUserId, uerId: this.moveUserId,
startTime:dayjs().startOf('day').format('YYYY-MM-DD HH:mm'), startTime:dayjs().startOf('day').format('YYYY-MM-DD HH:mm'),
endTime:dayjs().endOf('day').format('YYYY-MM-DD HH:mm'), endTime:dayjs().endOf('day').format('YYYY-MM-DD HH:mm'),

View File

@@ -3,5 +3,4 @@
/im-service/target /im-service/target
/im-common/target /im-common/target
/build/** /build/**
/dev
/hd /hd

Binary file not shown.

View File

@@ -0,0 +1,77 @@
version: '3'
services:
app-web:
image: nginx:1.25
restart: always
privileged: true
container_name: app-web
# ports:
# - 80:80
# - 443:443
network_mode: host
volumes:
- ./:/usr/share/nginx/html/
- ./nginx.conf:/etc/nginx/nginx.conf
im-tcp:
image: 172.16.2.1:8083/java:8_server-jre_unlimited
restart: always
privileged: true
environment:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
TZ: Asia/Shanghai
IM_HOST: 172.16.3.18
container_name: im-tcp
volumes:
- ./:/hd-znzq/config
- ./:/hd-znzq/system
network_mode: host
# ports:
# - 29001:29001
# - 29000:29000
command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/im-tcp-1.0.0-SNAPSHOT.jar /hd-znzq/config/hd_1.yml
im-message-store:
image: 172.16.2.1:8083/java:8_server-jre_unlimited
restart: always
privileged: true
environment:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
TZ: Asia/Shanghai
container_name: im-message-store
volumes:
- ./:/hd-znzq/system
# ports:
# - 8990:8990
network_mode: host
command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/im-message-store-1.0.0-SNAPSHOT.jar
im-service:
image: 172.16.2.1:8083/java:8_server-jre_unlimited
restart: always
privileged: true
environment:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
TZ: Asia/Shanghai
SRS_HOST: 172.16.3.18
container_name: im-service
volumes:
- ./:/hd-znzq/system
ports:
- 28000:28000
# network_mode: host
command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/im-service-1.0.0-SNAPSHOT.jar
app-service:
image: 172.16.2.1:8083/java:8_server-jre_unlimited
restart: always
privileged: true
ports:
- 8989:8989
environment:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
TZ: Asia/Shanghai
container_name: app-service
volumes:
- ./:/hd-znzq/system
command: java -Dfile.encoding=UTF-8 -jar /hd-znzq/system/app-service-1.0-SNAPSHOT.jar

34
hs-im-server/dev/hd_1.yml Normal file
View File

@@ -0,0 +1,34 @@
lim:
tcpPort: 29000
webSocketPort: 29001
bossThreadSize: 1
workThreadSize: 8
heartBeatTime: 20000 #心跳超时时间 单位毫秒
brokerId: 1000
loginModel: 3
logicUrl: http://172.16.3.18:28000/v1
# * 多端同步模式1 只允许一端在线,手机/电脑/web 踢掉除了本client+imel的设备
# * 2 允许手机/电脑的一台设备 + web在线 踢掉除了本client+imel的非web端设备
# * 3 允许手机和电脑单设备 + web 同时在线 踢掉非本client+imel的同端设备
# * 4 允许所有端多设备登录 不踢任何设备
redis:
mode: single # 单机模式single 哨兵模式sentinel 集群模式cluster
database: 8
password: Mars@23600800
timeout: 3000 # 超时时间
poolMinIdle: 8 #最小空闲数
poolConnTimeout: 3000 # 连接超时时间(毫秒)
poolSize: 10 # 连接池大小
single: #redis单机配置
address: 172.16.2.3:6379
rabbitmq:
host: 172.16.2.1
port: 5672
virtualHost: /
userName: guest
password: guest
zkConfig:
zkAddr: 172.16.2.1:2181
zkConnectTimeOut: 5000

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,75 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <module version="4">
<component name="FacetManager"> <component name="FacetManager">
<facet type="Spring" name="Spring"> <facet type="Spring" name="Spring">
<configuration /> <configuration />
</facet> </facet>
</component> </component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: io.netty:netty-all:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.51" level="project" />
<orderEntry type="library" name="Maven: com.lld:im-common:1.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.13" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.14" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-access:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.12" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.27" level="project" />
<orderEntry type="library" name="Maven: org.redisson:redisson:3.15.6" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver-dns:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec-dns:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: javax.cache:cache-api:1.1.1" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
<orderEntry type="library" name="Maven: io.reactivex.rxjava3:rxjava:3.0.12" level="project" />
<orderEntry type="library" name="Maven: org.jboss.marshalling:jboss-marshalling-river:2.0.11.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.marshalling:jboss-marshalling:2.0.11.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.1" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.13" level="project" />
<orderEntry type="library" name="Maven: org.jodd:jodd-bean:5.1.6" level="project" />
<orderEntry type="library" name="Maven: org.jodd:jodd-core:5.1.6" level="project" />
<orderEntry type="library" name="Maven: com.rabbitmq:amqp-client:5.6.0" level="project" />
<orderEntry type="library" name="Maven: com.github.sgroschupf:zkclient:0.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.3.3" level="project" />
<orderEntry type="library" name="Maven: jline:jline:0.9.94" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:2.2" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
<orderEntry type="library" name="Maven: log4j:log4j:1.2.14" level="project" />
<orderEntry type="library" name="Maven: com.netflix.feign:feign-core:8.18.0" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jvnet:animal-sniffer-annotation:1.0" level="project" />
<orderEntry type="library" name="Maven: com.netflix.feign:feign-jackson:8.18.0" level="project" />
</component>
</module> </module>

View File

@@ -1,101 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <module version="4">
<component name="FacetManager"> <component name="FacetManager">
<facet type="Spring" name="Spring"> <facet type="Spring" name="Spring">
<configuration /> <configuration />
</facet> </facet>
</component> </component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="common" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-amqp:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
<orderEntry type="library" name="Maven: jakarta.annotation:jakarta.annotation-api:1.3.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.amqp:spring-rabbit:2.2.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.amqp:spring-amqp:2.2.9.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.2.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.4.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.2.8.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.21" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-boot-starter:3.4.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus:3.4.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-extension:3.4.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-core:3.4.2" level="project" />
<orderEntry type="library" name="Maven: com.baomidou:mybatis-plus-annotation:3.4.2" level="project" />
<orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:4.0" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.6" level="project" />
<orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.5" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.3.2.RELEASE" level="project" />
<orderEntry type="library" name="Maven: com.github.jeffreyning:mybatisplus-plus:1.5.1-RELEASE" level="project" />
<orderEntry type="library" name="Maven: cn.hutool:hutool-all:5.0.6" level="project" />
<orderEntry type="library" name="Maven: com.lld:im-common:1.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.13" level="project" />
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.2" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.14" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.12.0" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-access:1.2.3" level="project" />
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.51" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.12" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-all:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.27" level="project" />
<orderEntry type="library" name="Maven: org.redisson:redisson:3.15.6" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-common:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-resolver-dns:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-codec-dns:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.35.Final" level="project" />
<orderEntry type="library" name="Maven: javax.cache:cache-api:1.1.1" level="project" />
<orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.3.8.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
<orderEntry type="library" name="Maven: io.reactivex.rxjava3:rxjava:3.0.12" level="project" />
<orderEntry type="library" name="Maven: org.jboss.marshalling:jboss-marshalling-river:2.0.11.Final" level="project" />
<orderEntry type="library" name="Maven: org.jboss.marshalling:jboss-marshalling:2.0.11.Final" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.11.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.11.1" level="project" />
<orderEntry type="library" name="Maven: net.bytebuddy:byte-buddy:1.10.13" level="project" />
<orderEntry type="library" name="Maven: org.jodd:jodd-bean:5.1.6" level="project" />
<orderEntry type="library" name="Maven: org.jodd:jodd-core:5.1.6" level="project" />
<orderEntry type="library" name="Maven: com.rabbitmq:amqp-client:5.6.0" level="project" />
<orderEntry type="library" name="Maven: com.github.sgroschupf:zkclient:0.1" level="project" />
<orderEntry type="library" name="Maven: org.apache.zookeeper:zookeeper:3.3.3" level="project" />
<orderEntry type="library" name="Maven: jline:jline:0.9.94" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:2.2" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest:2.2" level="project" />
<orderEntry type="library" name="Maven: log4j:log4j:1.2.14" level="project" />
<orderEntry type="library" name="Maven: com.netflix.feign:feign-core:8.18.0" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.jvnet:animal-sniffer-annotation:1.0" level="project" />
<orderEntry type="library" name="Maven: com.netflix.feign:feign-jackson:8.18.0" level="project" />
</component>
</module> </module>

View File

@@ -4,11 +4,11 @@ spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
password: beAs0LHX2GyTxMw4 password: beAs0LHX2GyTxMw4
url: jdbc:mysql://43.139.191.204:3306:3306/im-core?serverTimezone=UTC&useSSL=false&characterEncoding=UTF8 url: jdbc:mysql://43.139.208.48:3306/im-core?serverTimezone=UTC&useSSL=false&characterEncoding=UTF8
username: root username: root
redis: redis:
host: 43.139.191.204 host: 43.139.208.48
port: 6379 port: 6379
database: 8 database: 8
jedis: jedis:
@@ -19,9 +19,9 @@ spring:
min-idle: 10 min-idle: 10
password: dSMIXBQrCBXiHHjk123 password: dSMIXBQrCBXiHHjk123
rabbitmq: rabbitmq:
host: 119.45.242.222 host: 43.139.208.48
port: 5672 port: 5672
addresses: 119.45.242.222 addresses: 43.139.208.48
username: guest username: guest
password: guest password: guest
# virtual-host: # virtual-host:

View File

@@ -1,3 +1,3 @@
spring: spring:
profiles: profiles:
active: prod active: local

View File

@@ -1,7 +1,9 @@
package com.lld.im.service.call.controller; package com.lld.im.service.call.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lld.im.common.ResponseVO; import com.lld.im.common.ResponseVO;
@@ -20,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Date; import java.util.Date;
import java.util.List;
@Slf4j @Slf4j
@RestController @RestController
@@ -61,9 +64,26 @@ public class ImCallHistoryController {
@PostMapping("/callBegin") @PostMapping("/callBegin")
public ResponseVO callBegin(@RequestBody ImCallHistoryEntity imCallHistoryEntity) { public ResponseVO callBegin(@RequestBody ImCallHistoryEntity imCallHistoryEntity) {
log.info("===========callBegin ");
log.info(JSONObject.toJSONString(imCallHistoryEntity));
//判断当前房间是否有通话
QueryWrapper<ImCallHistoryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("session_id",imCallHistoryEntity.getSessionId());
queryWrapper.eq("status",1);
List<ImCallHistoryEntity> imCallHistoryEntityList = callHistoryMapper.selectList(queryWrapper);
//如果存在则直接返回旧的记录
if(imCallHistoryEntityList.size()>0){
return ResponseVO.successResponse(imCallHistoryEntityList.get(0));
}
// 如果不存在则插入新的记录
imCallHistoryEntity.setCreateTime(new Date()); imCallHistoryEntity.setCreateTime(new Date());
imCallHistoryEntity.setStatus("1"); imCallHistoryEntity.setStatus("1");
ResponseVO<ImUserDataEntity> inviteUserInfo = imUserService.getSingleUserInfo(imCallHistoryEntity.getRoomId(), 10000); ResponseVO<ImUserDataEntity> inviteUserInfo = imUserService.getSingleUserInfo(imCallHistoryEntity.getRoomId(), 10000);
ResponseVO<ImUserDataEntity> passiveUserInfo = imUserService.getSingleUserInfo(imCallHistoryEntity.getPassiveId(), 10000); ResponseVO<ImUserDataEntity> passiveUserInfo = imUserService.getSingleUserInfo(imCallHistoryEntity.getPassiveId(), 10000);
@@ -82,6 +102,8 @@ public class ImCallHistoryController {
@PostMapping("/callHangUp") @PostMapping("/callHangUp")
public ResponseVO callHangUp(@RequestBody ImCallHistoryEntity imCallHistoryEntity) { public ResponseVO callHangUp(@RequestBody ImCallHistoryEntity imCallHistoryEntity) {
log.info("===========callHangUp ");
log.info(JSONObject.toJSONString(imCallHistoryEntity));
imCallHistoryEntity.setStatus("1"); imCallHistoryEntity.setStatus("1");
callHistoryService.updateBySessionId(imCallHistoryEntity); callHistoryService.updateBySessionId(imCallHistoryEntity);

View File

@@ -28,5 +28,6 @@ public class ImCallHistoryEntity {
// 持续时间(秒) // 持续时间(秒)
private Integer continueSecond; private Integer continueSecond;
private Integer checkTimes;
} }

View File

@@ -39,14 +39,17 @@ public class ImCallHistoryService {
List<ImCallHistoryEntity> imCallHistoryEntityList = callHistoryMapper.selectList(queryWrapper); List<ImCallHistoryEntity> imCallHistoryEntityList = callHistoryMapper.selectList(queryWrapper);
if(imCallHistoryEntityList.size()>0){
for(ImCallHistoryEntity imCallHistory: imCallHistoryEntityList){ for(ImCallHistoryEntity imCallHistory: imCallHistoryEntityList){
imCallHistory.setStatus("2"); imCallHistory.setStatus("1");
callHistoryMapper.updateById(imCallHistory); callHistoryMapper.updateById(imCallHistory);
} }
}else {
callHistoryMapper.insert(callHistory); callHistoryMapper.insert(callHistory);
} }
}
public List<ImCallHistoryEntity> queryListByStatus(String status){ public List<ImCallHistoryEntity> queryListByStatus(String status){
QueryWrapper<ImCallHistoryEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ImCallHistoryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("status",status); queryWrapper.eq("status",status);
@@ -55,6 +58,64 @@ public class ImCallHistoryService {
} }
public void updateCallHistory(ImCallHistoryEntity callHistory){
callHistoryMapper.updateById(callHistory);
}
public void closeCallRoomWithError(ImCallHistoryEntity callHistory){
log.info("closeCallRoomWithError");
log.info(JSONObject.toJSONString(callHistory));
Date _now=new Date();
QueryWrapper<ImCallHistoryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("session_id",callHistory.getSessionId());
queryWrapper.eq("status",1);
// end_time
ImCallHistoryEntity imCallHistory = callHistoryMapper.selectOne(queryWrapper);
if(!ObjectUtils.isEmpty(imCallHistory)){
imCallHistory.setEndTime(_now);
imCallHistory.setStatus("3");
Duration duration = Duration.between(imCallHistory.getCreateTime().toInstant(),_now.toInstant());
long seconds = TimeUnit.MILLISECONDS.toSeconds(duration.toMillis());
Integer i = Long.valueOf(seconds).intValue();
imCallHistory.setContinueSecond(i);
//TODO 结束之后通知客户端
SendMessageReq req= new SendMessageReq();
req.setAppId(10000);
req.setFromId(imCallHistory.getInviteId());
req.setToId(imCallHistory.getPassiveId());
req.setMessageTime(System.currentTimeMillis());
// req.setMessageRandom();
req.setMessageId(UUID.randomUUID().toString().replace("-", ""));
req.setImei("uniapp");
req.setClientType(1);
Map<String, Object> data = new HashMap<String, Object>();
data.put("userId", imCallHistory.getInviteId());
data.put("msgType", "CALL_"+imCallHistory.getType());
data.put("content", JSONObject.toJSONString(imCallHistory));
req.setMessageBody(JSONObject.toJSONString(data));
p2PMessageService.send(req);
callHistoryMapper.updateById(imCallHistory);
}
}
public void updateBySessionId(ImCallHistoryEntity callHistory){ public void updateBySessionId(ImCallHistoryEntity callHistory){
Date _now=new Date(); Date _now=new Date();
QueryWrapper<ImCallHistoryEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ImCallHistoryEntity> queryWrapper = new QueryWrapper<>();

View File

@@ -26,6 +26,7 @@ public class WebConfig implements WebMvcConfigurer {
.excludePathPatterns("/v1/file/**") .excludePathPatterns("/v1/file/**")
.excludePathPatterns("/v1/room/**") .excludePathPatterns("/v1/room/**")
.excludePathPatterns("/v1/im_call_history/**") .excludePathPatterns("/v1/im_call_history/**")
.excludePathPatterns("/v1/message/listMessage")
.excludePathPatterns("/v1/message/checkSend"); .excludePathPatterns("/v1/message/checkSend");
} }

View File

@@ -221,9 +221,9 @@ public class MessageSyncService {
.collect(Collectors.toMap(ImMessageHistoryEntity::getToId, x -> x)); .collect(Collectors.toMap(ImMessageHistoryEntity::getToId, x -> x));
// 合并map到toId // 合并map到toId
fromIdMap.forEach((key,value) -> { fromIdMap.forEach((key,value) -> {
toIdMap.merge(key,value,(x,y) -> { toIdMap.merge(key,value,(v1,v2) -> {
if (value.getMessageKey() > y.getMessageKey()) return value; if (v1.getMessageKey() > v2.getMessageKey()) return v1;
return y; return v2;
}); });
}); });
@@ -268,7 +268,7 @@ public class MessageSyncService {
sessionVos.sort(new Comparator<ImMessageHistoryVo>() { sessionVos.sort(new Comparator<ImMessageHistoryVo>() {
@Override @Override
public int compare(ImMessageHistoryVo o1, ImMessageHistoryVo o2) { public int compare(ImMessageHistoryVo o1, ImMessageHistoryVo o2) {
return o1.getCreateTime().compareTo(o2.getCreateTime()); return o2.getCreateTime().compareTo(o1.getCreateTime());
} }
}); });
return sessionVos; return sessionVos;

View File

@@ -1,6 +1,7 @@
package com.lld.im.service.room.controller; package com.lld.im.service.room.controller;
import com.alibaba.fastjson.JSONObject;
import com.lld.im.common.ResponseVO; import com.lld.im.common.ResponseVO;
import com.lld.im.service.message.model.req.SendMessageReq; import com.lld.im.service.message.model.req.SendMessageReq;
import com.lld.im.service.message.service.P2PMessageService; import com.lld.im.service.message.service.P2PMessageService;
@@ -29,11 +30,15 @@ public class RoomController {
@PostMapping("/createRoom") @PostMapping("/createRoom")
public ResponseVO createRoom(@RequestBody ImRoomEntity roomEntity, Integer appId) { public ResponseVO createRoom(@RequestBody ImRoomEntity roomEntity, Integer appId) {
log.info("===========createRoom ");
log.info(JSONObject.toJSONString(roomEntity));
return ResponseVO.successResponse(roomService.createRoom(roomEntity)); return ResponseVO.successResponse(roomService.createRoom(roomEntity));
} }
@PostMapping("/joinRoom") @PostMapping("/joinRoom")
public ResponseVO joinRoom(@RequestBody ImRoomEntity roomEntity, Integer appId) { public ResponseVO joinRoom(@RequestBody ImRoomEntity roomEntity, Integer appId) {
log.info("===========joinRoom");
log.info(roomEntity.toString());
return ResponseVO.successResponse(roomService.joinRoom(roomEntity)); return ResponseVO.successResponse(roomService.joinRoom(roomEntity));
} }
@@ -44,14 +49,15 @@ public class RoomController {
@PostMapping("/leaveRoom") @PostMapping("/leaveRoom")
public ResponseVO leaveRoom(@RequestBody ImRoomEntity roomEntity, Integer appId) { public ResponseVO leaveRoom(@RequestBody ImRoomEntity roomEntity, Integer appId) {
log.info("===========leaveRoom");
roomService.leaveRoom(roomEntity); roomService.leaveRoom(roomEntity);
return ResponseVO.successResponse(roomEntity.getPublishName()+"离开视频房间"); return ResponseVO.successResponse(roomEntity.getPublishName()+"离开视频房间");
} }
@PostMapping("/unpublish") @PostMapping("/unpublish")
public ResponseVO unpublish(@RequestBody SRSCallBackReq callBackReq) { public ResponseVO unpublish(@RequestBody SRSCallBackReq callBackReq) {
log.info(callBackReq.toString()); log.info("===========srs 回调");
log.info(JSONObject.toJSONString(callBackReq));
try { try {
ImRoomEntity roomEntity = new ImRoomEntity(); ImRoomEntity roomEntity = new ImRoomEntity();
roomEntity.setRoomId(callBackReq.getApp()); roomEntity.setRoomId(callBackReq.getApp());

View File

@@ -1,18 +1,23 @@
package com.lld.im.service.room.service; package com.lld.im.service.room.service;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lld.im.common.enums.DelFlagEnum; import com.lld.im.common.enums.DelFlagEnum;
import com.lld.im.service.message.dao.mapper.ImMessageBodyMapper; import com.lld.im.service.message.dao.mapper.ImMessageBodyMapper;
import com.lld.im.service.room.dao.ImRoomEntity; import com.lld.im.service.room.dao.ImRoomEntity;
import com.lld.im.service.room.dao.mapper.ImRoomMapper; import com.lld.im.service.room.dao.mapper.ImRoomMapper;
import com.lld.im.service.user.dao.ImUserDataEntity; import com.lld.im.service.user.dao.ImUserDataEntity;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
@Slf4j
@Service @Service
public class ImRoomService { public class ImRoomService {
@Autowired @Autowired
@@ -20,12 +25,17 @@ public class ImRoomService {
@Transactional @Transactional
public ImRoomEntity createRoom(ImRoomEntity entity) { public ImRoomEntity createRoom(ImRoomEntity entity) {
log.info("createRoom");
log.info(JSONObject.toJSONString(entity));
QueryWrapper<ImRoomEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ImRoomEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("room_id",entity.getRoomId()); queryWrapper.eq("room_id",entity.getRoomId());
queryWrapper.eq("publish_id",entity.getPublishId()); queryWrapper.eq("publish_id",entity.getPublishId());
List<ImRoomEntity> roomEntityList = imRoomMapper.selectList(queryWrapper); List<ImRoomEntity> roomEntityList = imRoomMapper.selectList(queryWrapper);
if(roomEntityList.size()>0){ if(roomEntityList.size()>0){
imRoomMapper.delete(queryWrapper); ImRoomEntity roomEntity = roomEntityList.get(0);
roomEntity.setWebrtcUrl(entity.getWebrtcUrl());
imRoomMapper.updateById(roomEntity);
return roomEntity;
} }
imRoomMapper.insert(entity); imRoomMapper.insert(entity);
return entity; return entity;
@@ -33,15 +43,26 @@ public class ImRoomService {
@Transactional @Transactional
public ImRoomEntity joinRoom(ImRoomEntity entity) { public ImRoomEntity joinRoom(ImRoomEntity entity) {
log.info("joinRoom");
log.info(JSONObject.toJSONString(entity));
QueryWrapper<ImRoomEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ImRoomEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("room_id",entity.getRoomId()); queryWrapper.eq("room_id",entity.getRoomId());
queryWrapper.eq("publish_id",entity.getPublishId()); queryWrapper.eq("publish_id",entity.getPublishId());
List<ImRoomEntity> roomEntityList = imRoomMapper.selectList(queryWrapper); List<ImRoomEntity> roomEntityList = imRoomMapper.selectList(queryWrapper);
if(roomEntityList.size()>0){ if(roomEntityList.size()>0){
log.info("=============joinRoom:{}",entity.getWebrtcUrl());
if(StringUtils.isBlank(entity.getWebrtcUrl())){
return roomEntityList.get(0);
}else {
roomEntityList.get(0).setIsOver(0); roomEntityList.get(0).setIsOver(0);
roomEntityList.get(0).setOffline(0); roomEntityList.get(0).setOffline(0);
roomEntityList.get(0).setWebrtcUrl(entity.getWebrtcUrl()); roomEntityList.get(0).setWebrtcUrl(entity.getWebrtcUrl());
imRoomMapper.updateById(roomEntityList.get(0)); imRoomMapper.updateById(roomEntityList.get(0));
return roomEntityList.get(0);
}
}else { }else {
entity.setOffline(0); entity.setOffline(0);
entity.setIsOver(0); entity.setIsOver(0);
@@ -52,6 +73,9 @@ public class ImRoomService {
public void deleteUserFromRoom(ImRoomEntity entity){ public void deleteUserFromRoom(ImRoomEntity entity){
log.info("deleteUserFromRoom");
log.info(JSONObject.toJSONString(entity));
QueryWrapper<ImRoomEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ImRoomEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("room_id",entity.getRoomId()); queryWrapper.eq("room_id",entity.getRoomId());
queryWrapper.eq("publish_id",entity.getPublishId()); queryWrapper.eq("publish_id",entity.getPublishId());
@@ -62,12 +86,18 @@ public class ImRoomService {
} }
public void deleteRoomById(Integer id){ public void deleteRoomById(Integer id){
log.info("deleteRoomById");
log.info(id.toString());
QueryWrapper<ImRoomEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ImRoomEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id",id); queryWrapper.eq("id",id);
imRoomMapper.delete(queryWrapper); imRoomMapper.delete(queryWrapper);
} }
public void deleteAllUserFromRoom(String roomId){ public void deleteAllUserFromRoom(String roomId){
log.info("deleteAllUserFromRoom");
log.info(roomId);
QueryWrapper<ImRoomEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ImRoomEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("room_id",roomId); queryWrapper.eq("room_id",roomId);
imRoomMapper.delete(queryWrapper); imRoomMapper.delete(queryWrapper);
@@ -98,6 +128,9 @@ public class ImRoomService {
return roomEntityList; return roomEntityList;
} }
public void leaveRoom (ImRoomEntity entity){ public void leaveRoom (ImRoomEntity entity){
log.info("leaveRoom");
log.info(JSONObject.toJSONString(entity));
QueryWrapper<ImRoomEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<ImRoomEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("room_id",entity.getRoomId()); queryWrapper.eq("room_id",entity.getRoomId());
queryWrapper.eq("publish_id",entity.getPublishId()); queryWrapper.eq("publish_id",entity.getPublishId());

View File

@@ -30,29 +30,29 @@ public class CallHistoryTask {
ImRoomService roomService; ImRoomService roomService;
@Scheduled(cron="0/10 * * * * ? ") @Scheduled(cron="0/2 * * * * ? ")
public void executeTask(){ public void executeTask(){
List<ImCallHistoryEntity> callHistoryEntities = callHistoryService.queryListByStatus("1"); List<ImCallHistoryEntity> callHistoryEntities = callHistoryService.queryListByStatus("1");
for(ImCallHistoryEntity callHistoryEntity: callHistoryEntities){ for(ImCallHistoryEntity callHistoryEntity: callHistoryEntities){
if(callHistoryEntity.getCheckTimes()>2){
ImRoomEntity imRoomEntity = new ImRoomEntity(); ImRoomEntity imRoomEntity = new ImRoomEntity();
imRoomEntity.setRoomId(callHistoryEntity.getRoomId()); imRoomEntity.setRoomId(callHistoryEntity.getRoomId());
List<ImRoomEntity> serviceRoomInfo = roomService.getRoomInfo(imRoomEntity); List<ImRoomEntity> serviceRoomInfo = roomService.getRoomInfo(imRoomEntity);
if(serviceRoomInfo.size()<2){ if(serviceRoomInfo.size()==0){
log.info("{}房间里面的流少于2路,关掉全部视频流并且判断异常中断",callHistoryEntity.getSessionId()); log.info("{}房间里面没有流,关掉全部视频流并且设置状态为异常中断",callHistoryEntity.getSessionId());
//房间里面的流少于2路,关掉全部视频流并且判断异常中断 //房间里面没有流,关掉全部视频流并且判断异常中断
closeAll(callHistoryEntity,serviceRoomInfo); closeAll(callHistoryEntity,serviceRoomInfo);
} }
}else {
callHistoryEntity.setCheckTimes(callHistoryEntity.getCheckTimes()+1);
}
} }
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void closeAll(ImCallHistoryEntity callHistoryEntity,List<ImRoomEntity> roomList){ public void closeAll(ImCallHistoryEntity callHistoryEntity,List<ImRoomEntity> roomList){
callHistoryEntity.setStatus("3"); callHistoryService.closeCallRoomWithError(callHistoryEntity);
callHistoryService.updateBySessionId(callHistoryEntity);
if(roomList.size()>0){
roomService.deleteAllUserFromRoom(roomList.get(0).getRoomId());
}
} }

View File

@@ -35,7 +35,7 @@ public class SRSStreamTask {
ImRoomService roomService; ImRoomService roomService;
@Scheduled(cron="0/2 * * * * ? ") @Scheduled(cron="0/200 * * * * ? ")
public void executeTask() throws Exception { public void executeTask() throws Exception {
log.info("====================== 执行定时任务 SRSStreamTask"); log.info("====================== 执行定时任务 SRSStreamTask");
String _url = "http://"+host+":1985/api/v1/streams"; String _url = "http://"+host+":1985/api/v1/streams";
@@ -53,12 +53,14 @@ public class SRSStreamTask {
List<ImRoomEntity> roomList = roomService.getAllRoomList(); List<ImRoomEntity> roomList = roomService.getAllRoomList();
for (ImRoomEntity roomEntity:roomList){ for (ImRoomEntity roomEntity:roomList){
if(StringUtils.isBlank(roomEntity.getWebrtcUrl())){ if(StringUtils.isBlank(roomEntity.getWebrtcUrl())){
log.info("webRTC地址为空移除房间{}",roomEntity.getRoomId());
roomService.deleteRoomById(roomEntity.getId()); roomService.deleteRoomById(roomEntity.getId());
}else { }else {
Boolean hasStream=false; Boolean hasStream=false;
List<StreamEntity> streamEntityList = response.getStreams(); List<StreamEntity> streamEntityList = response.getStreams();
for (StreamEntity streamEntity:streamEntityList){ for (StreamEntity streamEntity:streamEntityList){
String webRTCUrl=streamEntity.getTcUrl()+"/"+streamEntity.getName(); String webRTCUrl=streamEntity.getTcUrl()+"/"+streamEntity.getName();
//如果流存在,则
if(StringUtils.equals(roomEntity.getWebrtcUrl(),webRTCUrl)){ if(StringUtils.equals(roomEntity.getWebrtcUrl(),webRTCUrl)){
hasStream=true; hasStream=true;
break; break;

View File

@@ -8,11 +8,11 @@ spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
password: beAs0LHX2GyTxMw4 password: beAs0LHX2GyTxMw4
url: jdbc:mysql://43.139.191.204:3306/im-core?serverTimezone=Asia/Shanghai&useSSL=false&characterEncoding=UTF8 url: jdbc:mysql://43.139.208.48:3306/im-core?serverTimezone=Asia/Shanghai&useSSL=false&characterEncoding=UTF8
username: root username: root
redis: redis:
host: 43.139.191.204 host: 43.139.208.48
port: 6379 port: 6379
database: 8 database: 8
jedis: jedis:
@@ -23,9 +23,9 @@ spring:
min-idle: 10 min-idle: 10
password: dSMIXBQrCBXiHHjk123 password: dSMIXBQrCBXiHHjk123
rabbitmq: rabbitmq:
host: 119.45.242.222 host: 43.139.208.48
port: 5672 port: 5672
addresses: 119.45.242.222 addresses: 192.168.2.181
username: guest username: guest
password: guest password: guest
# virtual-host: # virtual-host:
@@ -59,7 +59,7 @@ server:
appConfig: appConfig:
appId: 10000 appId: 10000
privateKey: 123456 privateKey: 123456
zkAddr: 119.45.242.222:2181 # zk连接地址 zkAddr: 43.139.208.48:2181 # zk连接地址
zkConnectTimeOut: 50000 #zk超时时间 zkConnectTimeOut: 50000 #zk超时时间
imRouteWay: 3 # 路由策略1轮训 2随机 3hash imRouteWay: 3 # 路由策略1轮训 2随机 3hash
consistentHashWay: 1 # 如果选用一致性hash的话具体hash算法 1 TreeMap 2 自定义Map consistentHashWay: 1 # 如果选用一致性hash的话具体hash算法 1 TreeMap 2 自定义Map
@@ -75,7 +75,7 @@ appConfig:
groupMaxMemberCount: 500 groupMaxMemberCount: 500
sendMessageCheckFriend: false # 发送消息是否校验关系链 sendMessageCheckFriend: false # 发送消息是否校验关系链
sendMessageCheckBlack: false # 发送消息是否校验黑名单 sendMessageCheckBlack: false # 发送消息是否校验黑名单
callbackUrl: http://127.0.0.1:8000/callback callbackUrl: http://43.139.208.48:8000/callback
modifyUserAfterCallback: false # 用户资料变更之后回调开关 modifyUserAfterCallback: false # 用户资料变更之后回调开关
addFriendAfterCallback: false # 添加好友之后回调开关 addFriendAfterCallback: false # 添加好友之后回调开关
addFriendBeforeCallback: false # 添加好友之前回调开关 addFriendBeforeCallback: false # 添加好友之前回调开关
@@ -130,4 +130,4 @@ minio:
bucketName: hd-im bucketName: hd-im
custom: custom:
host: 119.45.242.222 host: 43.139.208.48

View File

@@ -101,8 +101,8 @@ mqQueueName: 123
mybatis-plus: mybatis-plus:
configuration: configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 会正常输出日志 #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 会正常输出日志
# log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
mapper-locations: classpath*:mapper/*.xml mapper-locations: classpath*:mapper/*.xml
global-config: global-config:
db-config: db-config:

View File

@@ -1,3 +1,6 @@
spring: spring:
jackson:
time-zone: GMT+8
profiles: profiles:
active: prod active: local

View File

@@ -6,7 +6,7 @@ lim:
heartBeatTime: 20000 #心跳超时时间 单位毫秒 heartBeatTime: 20000 #心跳超时时间 单位毫秒
brokerId: 1000 brokerId: 1000
loginModel: 3 loginModel: 3
logicUrl: http://172.16.2.3:28000/v1 logicUrl: http://192.168.2.181:28000/v1
# * 多端同步模式1 只允许一端在线,手机/电脑/web 踢掉除了本client+imel的设备 # * 多端同步模式1 只允许一端在线,手机/电脑/web 踢掉除了本client+imel的设备
# * 2 允许手机/电脑的一台设备 + web在线 踢掉除了本client+imel的非web端设备 # * 2 允许手机/电脑的一台设备 + web在线 踢掉除了本client+imel的非web端设备
# * 3 允许手机和电脑单设备 + web 同时在线 踢掉非本client+imel的同端设备 # * 3 允许手机和电脑单设备 + web 同时在线 踢掉非本client+imel的同端设备
@@ -15,20 +15,20 @@ lim:
redis: redis:
mode: single # 单机模式single 哨兵模式sentinel 集群模式cluster mode: single # 单机模式single 哨兵模式sentinel 集群模式cluster
database: 8 database: 8
password: Mars@23600800 password: dSMIXBQrCBXiHHjk123
timeout: 3000 # 超时时间 timeout: 3000 # 超时时间
poolMinIdle: 8 #最小空闲数 poolMinIdle: 8 #最小空闲数
poolConnTimeout: 3000 # 连接超时时间(毫秒) poolConnTimeout: 3000 # 连接超时时间(毫秒)
poolSize: 10 # 连接池大小 poolSize: 10 # 连接池大小
single: #redis单机配置 single: #redis单机配置
address: 172.16.2.3:6379 address: 43.139.208.48
rabbitmq: rabbitmq:
host: 172.16.2.1 host: 192.168.2.181
port: 5672 port: 5672
virtualHost: / virtualHost: /
userName: guest userName: guest
password: guest password: guest
zkConfig: zkConfig:
zkAddr: 172.16.2.1:2181 zkAddr: 192.168.2.181:2181
zkConnectTimeOut: 5000 zkConnectTimeOut: 5000

View File

@@ -96,6 +96,16 @@
<groupId>com.netflix.feign</groupId> <groupId>com.netflix.feign</groupId>
<artifactId>feign-jackson</artifactId> <artifactId>feign-jackson</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-core</artifactId>
<version>3.4.2</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>

View File

@@ -34,6 +34,7 @@
console.log('App Show') console.log('App Show')
appInit(500).then((res) => { appInit(500).then((res) => {
// getAddressList
console.log("获取到token创建长链接") console.log("获取到token创建长链接")
this.$store.dispatch('getAddressList'); this.$store.dispatch('getAddressList');
setTimeout(() => { setTimeout(() => {

View File

@@ -1,11 +1,11 @@
export default class config{ export default class config{
static prod="online_not" static prod="online"
static getZnzqApiUrl(){ static getZnzqApiUrl(){
if(process.env.NODE_ENV === 'development' ){ if(process.env.NODE_ENV === 'development' ){
return 'http://work.ii999.live:19002/znzq' return 'http://work.ii999.live:19002/znzq'
}else{ }else{
if(this.prod=="online"){ if(this.prod=="online"){
return 'http://work.ii999.live:19002/znzq' return '/znzq'
}else{ }else{
return '/znzq' return '/znzq'
} }
@@ -28,7 +28,7 @@ export default class config{
return `http://localhost:8080/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isForce=0&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}&hasVideo=${hasVideo}&uname=${uname}&tuid=${tuid}` return `http://localhost:8080/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isForce=0&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}&hasVideo=${hasVideo}&uname=${uname}&tuid=${tuid}`
}else{ }else{
if(this.prod=="online"){ if(this.prod=="online"){
return `https://119.45.242.222/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isForce=0&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}&hasVideo=${hasVideo}&uname=${uname}&tuid=${tuid}` return `https://43.139.208.48/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isForce=0&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}&hasVideo=${hasVideo}&uname=${uname}&tuid=${tuid}`
}else{ }else{
return `https://172.16.3.18/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isForce=0&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}&hasVideo=${hasVideo}&uname=${uname}&tuid=${tuid}` return `https://172.16.3.18/hd-glasses-app/#/call_room?showInviteConfirmDialog=1&isForce=0&isPublish=${isPublish}&isPlayer=${isPlayer}&uid=${userid}&room=${room}&hasVideo=${hasVideo}&uname=${uname}&tuid=${tuid}`
} }
@@ -39,7 +39,7 @@ export default class config{
return 'webrtc://119.45.242.222/' return 'webrtc://119.45.242.222/'
}else{ }else{
if(this.prod=="online"){ if(this.prod=="online"){
return 'webrtc://119.45.242.222/' return 'webrtc://43.139.208.48/'
}else{ }else{
return 'webrtc://172.16.3.18/' return 'webrtc://172.16.3.18/'
} }

File diff suppressed because one or more lines are too long

View File

@@ -540,6 +540,7 @@ export default {
} }
} }
//TODO 需要请求接口获取真实的消息时间 //TODO 需要请求接口获取真实的消息时间
/*
chatWindowData.push(msgOffline) chatWindowData.push(msgOffline)
store.dispatch('updateChatById', { store.dispatch('updateChatById', {
userId: userId, userId: userId,
@@ -549,6 +550,11 @@ export default {
userId: userId, userId: userId,
data: msgList data: msgList
}) })
*/
store.dispatch('tabBarpull') store.dispatch('tabBarpull')
store.dispatch('updateChatDataState', userId); store.dispatch('updateChatDataState', userId);
}); });

View File

@@ -139,9 +139,7 @@ export default {
// console.warn(res) // console.warn(res)
// }) // })
sdk.getUserConversationList(0).then(res => { store.dispatch('queryConversationList')
console.warn(res)
})
} else { } else {

View File

@@ -16,7 +16,6 @@ import App from './App'
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$socketTask = socketTask; Vue.prototype.$socketTask = socketTask;

View File

@@ -138,6 +138,70 @@ const store = new Vuex.Store({
}) })
}) })
}, },
queryConversationList(context){
const userId = uni.getStorageSync("userId")
console.log("==================开始 获取会话列表")
_im.queryConversationList().then((res) => {
console.log("==================已经获取到会话列表")
console.log(res)
if(res.code==200){
var retdata = publicFc.getKeyObjectStorage(userId + '_' +
'chatlistData')
var _newConversationList=[]
res.data.map((item)=>{
console.log(item)
var _userId=item.ownerId==item.fromId?item.toId:item.fromId
console.log("会话对方id",_userId)
_im.getSingleUserInfo(_userId).then((userInfo) => {
var detail = userInfo.data
console.log("会话对方nickName",detail.nickName)
item.messageBody = JSON.parse(item.messageBody)
try {
if (item.messageBody.msgType == "CALL_video") {
item.messageBody.content = "【视频通话】"
}
if (item.messageBody.msgType == "CALL_voice") {
item.messageBody.content = "【语音通话】"
}
} catch (e) {
console.log(e)
}
context.dispatch('updateChatListInfoById', {
userId: _userId,
data: {
content: item.messageBody.content,
userId: _userId,
personId: _userId,
nickName: detail.nickName,
portrait: detail.photo,
time: dayjs(item.createTime).format(
"YYYY/MM/DD HH:mm:ss"),
num: item.num,
windowType: 'SINGLE',
disturb: 'N', //是否静默消息
top: 'N', //是否置顶
userType: 'SINGLE'
}
})
context.dispatch('tabBarpull')
})
})
}
})
},
updateChartHistoryFromServerLimit5(context, data) { updateChartHistoryFromServerLimit5(context, data) {
const _userId = uni.getStorageSync("userId") const _userId = uni.getStorageSync("userId")
const _userInfo = uni.getStorageSync("userInfo") const _userInfo = uni.getStorageSync("userInfo")
@@ -160,7 +224,7 @@ const store = new Vuex.Store({
list: [] list: []
} }
var _serverMsgList = [] var _serverMsgList = []
_im.getChatMessageHistoryList(data.userId, 1, 5).then((res) => { _im.getChatMessageHistoryList(data.userId, 1, 3).then((res) => {
res.data.map((item) => { res.data.map((item) => {
item.messageBody = JSON.parse(item.messageBody) item.messageBody = JSON.parse(item.messageBody)
var obj = { var obj = {
@@ -212,44 +276,6 @@ const store = new Vuex.Store({
}) })
} }
const _obj = newCurrentUserMsgList[newCurrentUserMsgList
.length - 1]
try {
var _content = JSON.parse(_obj.content)
if (_obj.msgType == "CALL_video") {
_obj.content = "【视频通话】"
}
if (_obj.msgType == "CALL_voice") {
_obj.content = "【语音通话】"
}
//判断头像是谁的
context.dispatch('updateChatListInfoById', {
userId: data.userId,
data: {
content: _obj.content,
userId: data.userId,
personId: _userId,
nickName: detail.nickName,
portrait: _userId == _obj.fromId ? _userInfo
.photo : detail.photo,
time: dayjs(_obj.time).format(
"YYYY/MM/DD HH:mm:ss"),
num: 0,
windowType: 'SINGLE',
disturb: 'N', //是否静默消息
top: 'N', //是否置顶
userType: 'SINGLE'
}
})
} catch (e) {
console.log(e)
//TODO handle the exception
}
}) })
}) })
}, },
@@ -307,38 +333,6 @@ const store = new Vuex.Store({
context.dispatch('getchatDatalist'); context.dispatch('getchatDatalist');
const _obj = _serverMsgList[_serverMsgList.length - 1]
var _content = JSON.parse(_obj.content)
if (_obj.msgType == "CALL_video") {
_obj.content = "【视频通话】"
}
if (_obj.msgType == "CALL_voice") {
_obj.content = "【语音通话】"
}
//判断头像是谁的
context.dispatch('updateChatListInfoById', {
userId: data.userId,
data: {
content: _obj.content,
userId: data.userId,
personId: _userId,
nickName: detail.nickName,
portrait: _userId == _obj.fromId ? _userInfo
.photo : detail.photo,
time: dayjs(_obj.time).format(
"YYYY/MM/DD HH:mm:ss"),
num: 0,
windowType: 'SINGLE',
disturb: 'N', //是否静默消息
top: 'N', //是否置顶
userType: 'SINGLE'
}
})
}) })
}) })
@@ -561,7 +555,9 @@ const store = new Vuex.Store({
getAddressList(context) { getAddressList(context) {
//获取通讯录,存储通讯录数据到本地 //获取通讯录,存储通讯录数据到本地
customHttp.customHttp.get('/api/im/app/addressList', { customHttp.customHttp.get('/api/im/app/addressList', {
params: {}, params: {
},
/* 会加在url上 */ /* 会加在url上 */
header: {}, header: {},
/* 会与全局header合并如有同名属性局部覆盖全局 */ /* 会与全局header合并如有同名属性局部覆盖全局 */
@@ -577,6 +573,8 @@ const store = new Vuex.Store({
if (res.data.code == 200) { if (res.data.code == 200) {
var records = res.data.result.records var records = res.data.result.records
context.state.addressList = records context.state.addressList = records
localForage.setItem("addressList", records)
} }
} }
}).catch(err => { }).catch(err => {

View File

@@ -28,10 +28,10 @@
<view v-if="showtool || showEmojitool" :style="'height:558rpx'"></view> <view v-if="showtool || showEmojitool" :style="'height:558rpx'"></view>
<view class="zfb-tk-send-tool" :style="'transform: translateY(-' + keyboardHeight + 'px)'"> <view class="zfb-tk-send-tool" :style="'transform: translateY(-' + keyboardHeight + 'px)'">
<view class="zfb-tk-send-tool-c"> <view class="zfb-tk-send-tool-c">
<view class="zfb-tk-send-tool-icon wxfont" @click="changeShowVice" <!-- <view class="zfb-tk-send-tool-icon wxfont" @click="changeShowVice"
:class="showVice ? 'jianpan' : 'yuyin2'"></view> :class="showVice ? 'jianpan' : 'yuyin2'"></view> -->
<view class="zfb-tk-send-tool-vioce" v-if="showVice"> <view class="zfb-tk-send-tool-vioce" v-if="showVice">
<view class="zfb-tk-send-tool-vioce-item" @longpress="startRecord" @touchend="endRecord">按住说话</view> <!-- <view class="zfb-tk-send-tool-vioce-item" @longpress="startRecord" @touchend="endRecord">按住说话</view> -->
</view> </view>
<view v-else class="zfb-tk-send-tool-input-box" @click="msgFocus = true"><textarea <view v-else class="zfb-tk-send-tool-input-box" @click="msgFocus = true"><textarea
@focus="showtool = false" :focus="msgFocus" class="zfb-tk-send-tool-input" @focus="showtool = false" :focus="msgFocus" class="zfb-tk-send-tool-input"
@@ -49,7 +49,7 @@
发送</view> 发送</view>
</template> </template>
<view v-else @click="changeTool" class="zfb-tk-send-tool-more wxfont gengduo"></view> <view @click="changeTool" class="zfb-tk-send-tool-more wxfont gengduo"></view>
</view> </view>
<view v-if="showtool" class="zfb-tk-send-tools"> <view v-if="showtool" class="zfb-tk-send-tools">
<template v-for="(v, i) in toolist"> <template v-for="(v, i) in toolist">
@@ -280,12 +280,12 @@
// updateChartHistoryFromServer // updateChartHistoryFromServer
}, },
onShow() { onShow() {
const hd_gps_location = localStorage.getItem("hd_gps_location") const client = localStorage.getItem("client")
if (hd_gps_location != null) { if (client == "app") {
this.isMobile = true this.isMobile = true
} }
// TODO PC开发 // TODO PC开发
this.isMobile = true // this.isMobile = true
if (this.chatListInfo && this.chatListInfo.nickName) { if (this.chatListInfo && this.chatListInfo.nickName) {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
@@ -363,6 +363,19 @@
console.log("########### 此时需要发送已读回执 ###########") console.log("########### 此时需要发送已读回执 ###########")
this.$store.dispatch('sendP2PMessageReciveAck', message) this.$store.dispatch('sendP2PMessageReciveAck', message)
setTimeout(() => {
this.$store.dispatch('updateChartHistoryFromServerLimit5', {
userId: this.talkTo.userId,
data: ""
})
setTimeout(() => {
this.$store.dispatch('updateChartHistoryFromServerLimit5', {
userId: this.talkTo.userId,
data: ""
})
}, 1000)
}, 1500)
}, },
addMsg(e) { addMsg(e) {
this.msg += e; this.msg += e;
@@ -999,7 +1012,7 @@
} }
.zfb-tk-main { .zfb-tk-main {
padding: 55rpx 12px; padding: 80rpx 12px;
padding-bottom: 112rpx; padding-bottom: 112rpx;
} }

View File

@@ -61,6 +61,16 @@
console.log("首页获取到url参数") console.log("首页获取到url参数")
console.log(options) console.log(options)
console.log(location.href) console.log(location.href)
// // 监听接收聊天信息
uni.$on('onP2PMessage', this.onMessage)
//
if (options.client) {
uni.setStorageSync("client", options.client)
}
if (options.imUserSign) { if (options.imUserSign) {
uni.showLoading({ uni.showLoading({
title: "数据加载中...", title: "数据加载中...",
@@ -185,6 +195,7 @@
}, },
onShow() { onShow() {
var i=0 var i=0
this.$store.dispatch('queryConversationList');
this.$store.dispatch('tabBarpull'); this.$store.dispatch('tabBarpull');
this.timer = setInterval(() => { this.timer = setInterval(() => {
i=i+1; i=i+1;
@@ -204,6 +215,11 @@
console.log('beforeUnmount'); console.log('beforeUnmount');
}, },
methods: { methods: {
onMessage(){
setTimeout(() => {
this.$store.dispatch('queryConversationList')
}, 1000)
},
longpressItem(e, i, v) { longpressItem(e, i, v) {
// console.log(e,i,v) // console.log(e,i,v)
this.longTapItemKey = i; this.longTapItemKey = i;

View File

@@ -72,7 +72,9 @@
// 局部修改配置,局部配置优先级高于全局配置 // 局部修改配置,局部配置优先级高于全局配置
customHttp.customHttp.get('/api/im/app/addressList', { customHttp.customHttp.get('/api/im/app/addressList', {
params: {}, /* 会加在url上 */ params: {
pageSize:1000
}, /* 会加在url上 */
header: {}, /* 会与全局header合并如有同名属性局部覆盖全局 */ header: {}, /* 会与全局header合并如有同名属性局部覆盖全局 */
dataType: 'json', dataType: 'json',
// 注如果局部custom与全局custom有同名属性则后面的属性会覆盖前面的属性相当于Object.assign(全局,局部) // 注如果局部custom与全局custom有同名属性则后面的属性会覆盖前面的属性相当于Object.assign(全局,局部)

View File

@@ -1,3 +1,6 @@
依赖安装
yarn install
核心SDK使用Typescript开发, 使用js-conditional-compile-loader插件条件编译出微信小程序端, Web网页端使用的js sdk 核心SDK使用Typescript开发, 使用js-conditional-compile-loader插件条件编译出微信小程序端, Web网页端使用的js sdk

View File

@@ -4,6 +4,7 @@
"description": "", "description": "",
"main": "src/lim.ts", "main": "src/lim.ts",
"scripts": { "scripts": {
"preview": "yarn install",
"build:weblib": "cross-env NODE_ENV=production platform=web webpack --mode=production --config ./build/webpack.lib.config.js", "build:weblib": "cross-env NODE_ENV=production platform=web webpack --mode=production --config ./build/webpack.lib.config.js",
"build:unilib": "cross-env NODE_ENV=production platform=uniapp webpack --mode=production --config ./build/webpack.lib.config.js", "build:unilib": "cross-env NODE_ENV=production platform=uniapp webpack --mode=production --config ./build/webpack.lib.config.js",
"build:wxlib": "cross-env NODE_ENV=production platform=wx webpack --mode=production --config ./build/webpack.lib.config.js", "build:wxlib": "cross-env NODE_ENV=production platform=wx webpack --mode=production --config ./build/webpack.lib.config.js",

View File

@@ -325,24 +325,8 @@ export class ImClient {
} }
public getUserConversationList(lastSequence:Long): Promise<any> {
return new Promise((resolve, _) => {
let api = new HttpApi(this.httpUrl);
let resp = api.call("/conversation/syncConversationList", this.getRequestParams(), { userId: this.userId,appId:this.appId,maxLimit:100, lastSequence:lastSequence,operater:this.userId })
resolve(resp);
})
}
public queryMsgDetailsByMessageKey(messageKey:Long): Promise<any> { public getChatMessageHistoryList(uid:String,offset:any,limit:any): Promise<any> {
return new Promise((resolve, _) => {
let api = new HttpApi(this.httpUrl);
let resp = api.call("/message/queryMsgDetailsByMessageKey", this.getRequestParams(), { appId:this.appId, messageKey:messageKey,operater:this.userId })
resolve(resp);
})
}
public getChatMessageHistoryList(uid:String,offset:Long,limit:Long): Promise<any> {
return new Promise((resolve, _) => { return new Promise((resolve, _) => {
let api = new HttpApi(this.httpUrl); let api = new HttpApi(this.httpUrl);
let resp = api.call("/message/chatHistory", this.getRequestParams(), { userId: uid,appId:this.appId,offset:offset, limit:limit,operater:this.userId }) let resp = api.call("/message/chatHistory", this.getRequestParams(), { userId: uid,appId:this.appId,offset:offset, limit:limit,operater:this.userId })
@@ -350,6 +334,13 @@ export class ImClient {
}) })
} }
public queryConversationList():Promise<any>{
return new Promise((resolve, _) => {
let api = new HttpApi(this.httpUrl);
let resp = api.call("/message/listMessage", this.getRequestParams(), { userId: this.userId,appId:this.appId,maxLimit:100, lastSequence:0,operater:this.userId })
resolve(resp);
})
}
public createRoom(room:any): Promise<any> { public createRoom(room:any): Promise<any> {
return new Promise((resolve,_)=>{ return new Promise((resolve,_)=>{
@@ -358,6 +349,7 @@ export class ImClient {
return resp; return resp;
}) })
} }
public joinRoom(room:any): Promise<any> { public joinRoom(room:any): Promise<any> {
return new Promise((resolve,_)=>{ return new Promise((resolve,_)=>{
let api = new HttpApi(this.httpUrl); let api = new HttpApi(this.httpUrl);
@@ -477,6 +469,7 @@ export class ImClient {
} }
} }
} }
export let limLogin = async (url: string, req: LoginPack, imClient: ImClient): Promise<{ success: boolean, err?: Error, conn: w3cwebsocket }> => { export let limLogin = async (url: string, req: LoginPack, imClient: ImClient): Promise<{ success: boolean, err?: Error, conn: w3cwebsocket }> => {