This commit is contained in:
dzc committed 2026-01-07 14:37:21 +08:00
1 parent a2bf33874d
commit 8bd9cbbf70
12 files changed
+29560 -43

No files matched your search

@@ -1,5 +1,6 @@
package com.bx.implatform.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -11,6 +12,7 @@ import com.bx.imcommon.enums.IMTerminalType;
import com.bx.imcommon.model.IMPrivateMessage;
import com.bx.imcommon.model.IMUserInfo;
import com.bx.implatform.annotation.RedisLock;
import com.bx.implatform.contant.Constant;
import com.bx.implatform.contant.RedisKey;
import com.bx.implatform.dto.FriendDndDTO;
import com.bx.implatform.entity.Friend;
@@ -66,7 +68,7 @@ public class FriendServiceImpl extends ServiceImpl<FriendMapper, Friend> impleme
LambdaQueryWrapper<Friend> wrapper = Wrappers.lambdaQuery();
wrapper.eq(Friend::getUserId, userId);
wrapper.in(Friend::getFriendId, friendIds);
wrapper.eq(Friend::getDeleted,false);
wrapper.eq(Friend::getDeleted, false);
return this.list(wrapper);
}
@@ -84,7 +86,7 @@ public class FriendServiceImpl extends ServiceImpl<FriendMapper, Friend> impleme
throw new GlobalException("不允许添加自己为好友");
}
// 互相绑定好友关系
FriendServiceImpl proxy = (FriendServiceImpl)AopContext.currentProxy();
FriendServiceImpl proxy = (FriendServiceImpl) AopContext.currentProxy();
proxy.bindFriend(userId, friendId);
proxy.bindFriend(friendId, userId);
// 推送添加好友提示
@@ -97,7 +99,7 @@ public class FriendServiceImpl extends ServiceImpl<FriendMapper, Friend> impleme
public void delFriend(Long friendId) {
Long userId = SessionContext.getSession().getUserId();
// 互相解除好友关系,走代理清理缓存
FriendServiceImpl proxy = (FriendServiceImpl)AopContext.currentProxy();
FriendServiceImpl proxy = (FriendServiceImpl) AopContext.currentProxy();
proxy.unbindFriend(userId, friendId);
proxy.unbindFriend(friendId, userId);
// 推送解除好友提示
@@ -111,7 +113,7 @@ public class FriendServiceImpl extends ServiceImpl<FriendMapper, Friend> impleme
LambdaQueryWrapper<Friend> wrapper = Wrappers.lambdaQuery();
wrapper.eq(Friend::getUserId, userId1);
wrapper.eq(Friend::getFriendId, userId2);
wrapper.eq(Friend::getDeleted,false);
wrapper.eq(Friend::getDeleted, false);
return this.exists(wrapper);
}
@@ -164,7 +166,7 @@ public class FriendServiceImpl extends ServiceImpl<FriendMapper, Friend> impleme
LambdaUpdateWrapper<Friend> wrapper = Wrappers.lambdaUpdate();
wrapper.eq(Friend::getUserId, userId);
wrapper.eq(Friend::getFriendId, friendId);
wrapper.set(Friend::getDeleted,true);
wrapper.set(Friend::getDeleted, true);
this.update(wrapper);
// 推送好友变化信息
sendDelFriendMessage(userId, friendId);
@@ -250,7 +252,7 @@ public class FriendServiceImpl extends ServiceImpl<FriendMapper, Friend> impleme
imClient.sendPrivateMessage(sendMessage);
}
void sendDelTipMessage(Long friendId){
void sendDelTipMessage(Long friendId) {
UserSession session = SessionContext.getSession();
// 推送好友状态信息
PrivateMessage msg = new PrivateMessage();
+2 -1
View File
@@ -5,4 +5,5 @@ VUE_APP_NAME = "盒子IM"
# 接口请求地址
VUE_APP_BASE_API = '/api'
# ws地址
VUE_APP_WS_URL = 'ws://localhost:8878/im'
VUE_APP_WS_URL = 'ws://127.0.0.1:8876/im'
# VUE_APP_WS_URL = 'ws://chatapp.zianxin.com/im'
+18171
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -15,11 +15,11 @@
"localforage": "1.10.0",
"sass": "1.32.12",
"sass-loader": "10.1.1",
"pinyin-pro": "^3.26.0",
"pinyin-pro": "3.26.0",
"vue": "2.7.16",
"vue-axios": "3.5.2",
"vue-router": "3.6.5",
"pinia": "^2.1.7"
"pinia": "2.1.7"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.12",
+11337
View File
File diff suppressed because it is too large. Load diff
+12 -12
View File
@@ -34,25 +34,25 @@
<i class="el-icon-picture-outline"></i>
</file-upload>
</div>
<div title="发送文件">
<div v-if="false" title="发送文件">
<file-upload ref="fileUpload" :action="'/file/upload'" :maxSize="10 * 1024 * 1024"
@before="onFileBefore" @success="onFileSuccess" @fail="onFileFail">
<i class="el-icon-wallet"></i>
</file-upload>
</div>
<div title="回执消息" v-show="isGroup && memberSize <= 500"
<div v-if="false" title="回执消息" v-show="isGroup && memberSize <= 500"
class="icon iconfont icon-receipt" :class="isReceipt ? 'chat-tool-active' : ''"
@click="onSwitchReceipt">
</div>
<div title="发送语音" class="el-icon-microphone" @click="showRecordBox()">
<div v-if="false" title="发送语音" class="el-icon-microphone" @click="showRecordBox()">
</div>
<div title="语音通话" v-show="isPrivate" class="el-icon-phone-outline"
<div v-if="false" title="语音通话" v-show="isPrivate" class="el-icon-phone-outline"
@click="showPrivateVideo('voice')">
</div>
<div title="语音通话" v-show="isGroup" class="el-icon-phone-outline"
<div v-if="false" title="语音通话" v-show="isGroup" class="el-icon-phone-outline"
@click="onGroupVideo()">
</div>
<div title="视频通话" v-show="isPrivate" class="el-icon-video-camera"
<div v-if="false" title="视频通话" v-show="isPrivate" class="el-icon-video-camera"
@click="showPrivateVideo('video')">
</div>
<div title="聊天记录" class="el-icon-chat-dot-round" @click="showHistoryBox()"></div>
@@ -574,7 +574,7 @@ export default {
this.$http({
url: url,
method: 'put'
}).then(() => {})
}).then(() => { })
this.chatStore.resetUnreadCount(this.chat)
}
},
@@ -725,17 +725,17 @@ export default {
getImageSize(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = function(event) {
reader.onload = function (event) {
const img = new Image();
img.onload = function() {
img.onload = function () {
resolve({ width: img.width, height: img.height });
};
img.onerror = function() {
img.onerror = function () {
reject(new Error('无法加载图片'));
};
img.src = event.target.result;
};
reader.onerror = function() {
reader.onerror = function () {
reject(new Error('无法读取文件'));
};
reader.readAsDataURL(file);
@@ -806,7 +806,7 @@ export default {
chat: {
handler(newChat, oldChat) {
if (newChat.targetId > 0 && (!oldChat || newChat.type != oldChat.type ||
newChat.targetId != oldChat.targetId)) {
newChat.targetId != oldChat.targetId)) {
this.userInfo = {}
this.group = {};
this.groupMembers = [];
@@ -47,7 +47,7 @@ export default {
if (savedWidth) {
this.asideWidth = parseInt(savedWidth);
}
// 添加全局事件监听
document.addEventListener('mousemove', this.handleResize);
document.addEventListener('mouseup', this.stopResize);
@@ -69,22 +69,22 @@ export default {
},
handleResize(e) {
if (!this.isResizing) return;
const deltaX = e.clientX - this.startX;
let newWidth = this.startWidth + deltaX;
// 限制宽度范围
newWidth = Math.max(this.minWidth, Math.min(this.maxWidth, newWidth));
this.asideWidth = newWidth;
},
stopResize() {
if (!this.isResizing) return;
this.isResizing = false;
document.body.style.cursor = '';
document.body.style.userSelect = '';
// 保存宽度到localStorage
localStorage.setItem(this.storageKey, this.asideWidth.toString());
}
@@ -113,7 +113,7 @@ export default {
align-items: center;
justify-content: center;
transition: background-color 0.2s ease;
.resize-line {
width: 2px;
height: 100%;
+4
View File
@@ -46,6 +46,10 @@ new Vue({
render: h => h(App)
})
console.log(12313123);
console.log("useChatStore:", useChatStore());
// 挂载全局的pinia
Vue.prototype.chatStore = useChatStore();
Vue.prototype.friendStore = useFriendStore();
+4 -4
View File
@@ -294,7 +294,7 @@ export default defineStore('chatStore', {
let chat = this.findChatByFriend(friend.id);
// 更新会话中的群名和头像
if (chat && (chat.headImage != friend.headImage ||
chat.showName != friend.nickName)) {
chat.showName != friend.nickName)) {
chat.headImage = friend.headImage;
chat.showName = friend.nickName;
chat.stored = false;
@@ -305,7 +305,7 @@ export default defineStore('chatStore', {
let chat = this.findChatByFriend(user.id);
// 更新会话中的昵称和头像
if (chat && (chat.headImage != user.headImageThumb ||
chat.showName != user.nickName)) {
chat.showName != user.nickName)) {
chat.headImage = user.headImageThumb;
chat.showName = user.nickName;
chat.stored = false;
@@ -315,7 +315,7 @@ export default defineStore('chatStore', {
updateChatFromGroup(group) {
let chat = this.findChatByGroup(group.id);
if (chat && (chat.headImage != group.headImageThumb ||
chat.showName != group.showGroupName)) {
chat.showName != group.showGroupName)) {
// 更新会话中的群名称和头像
chat.headImage = group.headImageThumb;
chat.showName = group.showGroupName;
@@ -361,7 +361,7 @@ export default defineStore('chatStore', {
}
// 记录热数据索引位置
chats.forEach(chat => {
if(!chat.hotMinIdx || chat.hotMinIdx != chat.messages.length){
if (!chat.hotMinIdx || chat.hotMinIdx != chat.messages.length) {
chat.hotMinIdx = chat.messages.length;
chat.stored = false;
}
+1 -1
View File
@@ -5,7 +5,7 @@ export default defineStore('configStore', {
state: () => {
return {
appInit: false, // 应用是否完成初始化
fullScreen: true, // 当前是否全屏
fullScreen: false, // 当前是否全屏
webrtc: {}
}
},
+1 -1
View File
@@ -99,7 +99,7 @@ export default {
<style lang="scss" scoped>
.chat-page {
.header {
height: 50px;
display: flex;
+11 -9
View File
@@ -21,7 +21,7 @@
<span class="icon iconfont icon-friend"></span>
</div>
</router-link>
<router-link class="link" v-bind:to="'/home/group'">
<router-link v-if="false" class="link" v-bind:to="'/home/group'">
<div class="menu-item">
<span class="icon iconfont icon-group" style="font-size: 28px"></span>
</div>
@@ -29,7 +29,7 @@
</div>
</div>
<div class="botoom">
<div v-if="false" class="botoom">
<div class="bottom-item" @click="onSwtichFullScreen">
<i class="el-icon-full-screen"></i>
</div>
@@ -490,8 +490,8 @@ export default {
<style scoped lang="scss">
.home-page {
height: 100vh;
width: 100vw;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
@@ -500,13 +500,15 @@ export default {
background: var(--im-color-primary-light-9);
.app-container {
width: 62vw;
height: 80vh;
// width: 60%;
// height: 80%;
width: 100%;
height: 100%;
display: flex;
min-height: 600px;
min-width: 970px;
min-height: 480px;
min-width: 776px;
position: absolute;
border-radius: 4px;
// border-radius: 4px;
overflow: hidden;
box-shadow: var(--im-box-shadow-dark);
transition: 0.2s;