人脸比对

This commit is contained in:
2023-09-26 19:29:11 +08:00
parent a4dda571ab
commit 0b51d7c0b7
11 changed files with 1066 additions and 940 deletions

View File

@@ -0,0 +1,17 @@
2023-09-26 09:28:26 -Starting AppServiceApplication on luojie with PID 35820 (E:\workplace\huashi_project\im-system\hs-im-app-server\target\classes started by coolp in E:\workplace\huashi_project\im-system\hs-im-app-server)
2023-09-26 09:28:26 -The following profiles are active: dev
2023-09-26 09:28:26 -Tomcat initialized with port(s): 8989 (http)
2023-09-26 09:28:26 -Initializing ProtocolHandler ["http-nio-8989"]
2023-09-26 09:28:26 -Starting service [Tomcat]
2023-09-26 09:28:26 -Starting Servlet engine: [Apache Tomcat/9.0.37]
2023-09-26 09:28:26 -Initializing Spring embedded WebApplicationContext
2023-09-26 09:28:26 -Root WebApplicationContext: initialization completed in 683 ms
2023-09-26 09:28:28 -Initializing ExecutorService 'applicationTaskExecutor'
2023-09-26 09:28:28 -Starting ProtocolHandler ["http-nio-8989"]
2023-09-26 09:28:28 -Tomcat started on port(s): 8989 (http) with context path ''
2023-09-26 09:28:28 -Started AppServiceApplication in 3.161 seconds (JVM running for 4.084)
2023-09-26 09:28:49 -Initializing Spring DispatcherServlet 'dispatcherServlet'
2023-09-26 09:28:49 -Initializing Servlet 'dispatcherServlet'
2023-09-26 09:28:49 -Completed initialization in 2 ms
2023-09-26 09:28:49 -HikariPool-1 - Starting...
2023-09-26 09:28:50 -HikariPool-1 - Start completed.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,33 +1,116 @@
import fc from '@/common/publicFc.js'
let timer=null
let retimer=null
import config from "@/common/config.js"
let timer = null
let retimer = null
import * as sdk from "@/common/imSdk/lim-sdk.js";
import lim from "@/common/imSdk/sdk-bridge.js";
export default {
socketTask:null,
socketTask: null,
// 连接WebSocket
connectSocket() {
this.socketTask=uni.connectSocket({
const ListenerMap = {
onSocketConnectEvent: (option, status, data) => {
console.log("已建立连接:" + JSON.stringify(status));
},
onSocketErrorEvent: (error) => {
console.log("连接出现错误:" + userId);
},
onSocketReConnectEvent: () => {
console.log("正在重连:");
},
onSocketCloseEvent: () => {
console.log("连接关闭:");
},
onSocketReConnectSuccessEvent: () => {
console.log("重连成功");
},
onTestMessage: (e) => {
console.log("onTestMessage " + e);
},
onP2PMessage: (e) => {
console.log("onP2PMessage " + e);
e = JSON.parse(e)
e.pushType="TEXT"
uni.$emit('onP2PMessage', e.data);
},
onLogin: (uid) => {
console.log("用户" + uid + "登陆sdk成功");
}
};
const userId = uni.getStorageSync("userId")
const imUserSign = uni.getStorageSync("imUserSign")
var listeners = {};
for (const v in ListenerMap) {
listeners[v] = ListenerMap[v];
}
console.log(lim)
if (this.socketTask != null) {
return false
}
lim.lim.im.init(config.getImApiUrl(), config.getImAppId(), userId, imUserSign, listeners, (
sdk) => {
if (sdk) {
console.warn("====================")
this.socketTask = sdk;
console.log(this.socketTask)
console.log('sdk 成功连接的回调, 可以使用 sdk 请求数据了.');
sdk.getAllFriend().then(res => {
console.warn(res)
})
sdk.getUserSequence().then(res => {
console.warn(res)
})
sdk.getUserConversationList(0).then(res => {
console.warn(res)
})
return uni.switchTab({
url: "/pages/tabbar/index/index"
})
} else {
console.log('sdk 初始化失败.');
}
})
/*
this.socketTask = uni.connectSocket({
url: 'wss://im-api.q3z3.com/ws?Authorization=' + uni.getStorageSync('Authorization'),
complete: () => {}
});
this.socketTask.onOpen(res => {
console.log('WebSocket连接已打开');
// 设置心跳
timer=setInterval(()=>{
timer = setInterval(() => {
uni.sendSocketMessage({
data:'isConnact',
success:res=>{
if(res.errMsg=='sendSocketMessage:ok'){
data: 'isConnact',
success: res => {
if (res.errMsg == 'sendSocketMessage:ok') {
console.log('WebSocket已连接')
}else{
} else {
this.connectSocket()
}
}
})
},5000)
}, 5000)
})
// 监听接收
this.socketTask.onMessage(res => {
if(res.data=='ok'){
if (res.data == 'ok') {
return
}
var data = JSON.parse(res.data);
@@ -37,30 +120,31 @@ export default {
// 监听关闭
this.socketTask.onClose(res => {
console.log('WebSocket连接已关闭');
let token= uni.getStorageSync('Authorization');
if(this.socketTask&&token){
let token = uni.getStorageSync('Authorization');
if (this.socketTask && token) {
this.socketTaskClose()
retimer=setTimeout(()=>{
retimer = setTimeout(() => {
this.connectSocket()
},5000)
}, 5000)
}
})
// 监听异常
this.socketTask.onError(res => {
console.log('WebSocket连接打开失败正在尝试重新打开');
if(this.socketTask){
if (this.socketTask) {
this.socketTaskClose()
retimer=setTimeout(()=>{
retimer = setTimeout(() => {
this.connectSocket()
},5000)
}, 5000)
}
});
*/
},
// 关闭WebSocket
socketTaskClose() {
if(this.socketTask){
if (this.socketTask) {
this.socketTask.close()
clearInterval(timer)
clearTimeout(retimer)

View File

@@ -2,9 +2,6 @@ import http from '@/common/request'
import store from './store'
import md5 from "@/common/md5.js";
import * as sdk from "@/common/imSdk/lim-sdk.js";
import lim from "@/common/imSdk/sdk-bridge.js";
import publicFc from "@/common/publicFc.js";
@@ -21,6 +18,9 @@ import App from './App'
Vue.config.productionTip = false
Vue.prototype.$socketTask = socketTask;
Vue.prototype.$http = http
Vue.prototype.$store = store
Vue.prototype.$fc = publicFc;
@@ -28,7 +28,7 @@ Vue.prototype.$md5 = md5
Vue.prototype.$zmmFormCheck = zmmFormCheck;
Vue.prototype.$pinyin = pinyin;
// #ifdef H5
Vue.prototype.$socketTask = socketTask;
// uni.lim = lim;
@@ -50,15 +50,15 @@ import { createSSRApp } from 'vue'
import App from './App.vue'
export function createApp() {
const app = createSSRApp(App)
app.config.globalProperties.$socketTask = socketTask
app.config.globalProperties.$http = http
app.config.globalProperties.$fc = publicFc
app.config.globalProperties.$md5 = md5
app.config.globalProperties.$zmmFormCheck = zmmFormCheck
app.config.globalProperties.$pinyin = pinyin
// #ifdef H5
app.config.globalProperties.$socketTask = socketTask
app.config.globalProperties.imsdk = lim
// #endif
app.use(store);

View File

@@ -132,11 +132,12 @@ import { createStore } from 'vuex'
uni.setStorageSync(context.state.userInfo.userId+'_'+'chatlistData', JSON.stringify(data2));
// 初始化聊天数据
var data1=publicFc.getKeyObjectStorage(context.state.userInfo.userId+'_'+'chatData')
return new Promise(function(resolve, reject) {
return new Promise((resolve, reject)=>{
if(!data1[userId]){
console.log('初始化聊天')
switch (windowType){
case 'SINGLE':
http.request({
url: '/friend/info/'+userId,
complete:(res)=>{

File diff suppressed because it is too large Load Diff

View File

@@ -45,9 +45,7 @@
</template>
<script>
// #ifdef APP-PLUS
const TUICalling = uni.requireNativePlugin("TUICallingUniPlugin-TUICallingModule");
// #endif
export default {
data() {
return {
@@ -223,7 +221,9 @@
uni.setStorageSync('appId', data.appId);
uni.setStorageSync('userId', data.userId);
uni.setStorageSync('imUserSign', data.imUserSign);
uni.setStorageSync('userSign', data.userSign);
uni.setStorageSync('userCSign', data.userSign);
this.$socketTask.connectSocket()
uni.reLaunch({
url: '../tabbar1/index'

View File

@@ -21,41 +21,9 @@
</template>
<script>
import config from "@/common/config.js"
const ListenerMap = {
onSocketConnectEvent: (option, status, data) => {
console.log("已建立连接:" + JSON.stringify(status));
},
onSocketErrorEvent: (error) => {
console.log("连接出现错误:" + userId);
},
onSocketReConnectEvent: () => {
console.log("正在重连:");
},
onSocketCloseEvent: () => {
console.log("连接关闭:");
},
onSocketReConnectSuccessEvent: () => {
console.log("重连成功");
},
onTestMessage: (e) => {
console.log("onTestMessage " + e);
},
onP2PMessage: (e) => {
console.log("onP2PMessage " + e);
e = JSON.parse(e)
uni.$emit('P2PMessage', e.data);
},
onLogin: (uid) => {
console.log("用户" + uid + "登陆sdk成功");
}
};
export default {
data() {
return {
@@ -191,42 +159,9 @@
},
mounted() {
console.log(this.imsdk)
this.$socketTask.connectSocket()
var listeners = {};
for (const v in ListenerMap) {
listeners[v] = ListenerMap[v];
}
const userId=uni.getStorageSync("userId")
const imUserSign=uni.getStorageSync("imUserSign")
console.log(this.imsdk)
this.imsdk.lim.im.init(config.getImApiUrl(),config.getImAppId(),userId,imUserSign, listeners, function(
sdk) {
if (sdk) {
console.log('sdk 成功连接的回调, 可以使用 sdk 请求数据了.');
sdk.getAllFriend().then(res=>{
console.warn(res)
})
sdk.getUserSequence().then(res=>{
console.warn(res)
})
sdk.getUserConversationList(0).then(res=>{
console.warn(res)
})
return uni.switchTab({
url: "/pages/tabbar/index/index"
})
} else {
console.log('sdk 初始化失败.');
}
})
},

View File

@@ -27,7 +27,7 @@
})
*/
uni.navigateTo({
url: '../chatWindow/index?userId=' + e.item.data.userId + '&windowType=' + e.windowType
url: '../chatWindow/index?userId=' + e.item.data.userId + '&windowType=' + "SINGLE"
});
},
getflist(){

View File

@@ -296,7 +296,6 @@ export class ImClient {
})
}
// 2、心跳
private heartbeatLoop(conn) {
let start = Date.now()
@@ -306,7 +305,7 @@ export class ImClient {
return
}
if (Date.now() - start >= heartbeatInterval) {
log.info(`>>> send ping ;`)
// log.info(`>>> send ping ;`)
start = Date.now()
let pingPack = imClient.buildMessagePack(SystemCommand.PING, {});
conn.send(pingPack.pack(false));