feat(device): 实现设备与账号绑定管理机制
- 引入 ClientAccountDevice 表管理设备与账号绑定关系 - 重构设备注册逻辑,支持多账号绑定同一设备 - 新增设备配额检查,基于账号维度限制设备数量 -优化设备移除逻辑,仅解除绑定而非物理删除- 改进设备列表查询,通过账号ID关联获取设备信息 - 更新心跳任务,支持向设备绑定的所有账号发送心跳 - 调整设备API参数,增加username字段用于权限校验 -修复HTTP请求编码问题,统一使用UTF-8字符集 - 增强错误处理,携带错误码信息便于前端识别 - 移除设备表中的username字段,解耦设备与用户名关联
This commit is contained in:
@@ -213,7 +213,7 @@ function startSpringBoot() {
|
||||
}
|
||||
}
|
||||
|
||||
// startSpringBoot();
|
||||
startSpringBoot();
|
||||
|
||||
function stopSpringBoot() {
|
||||
if (!springProcess) return;
|
||||
@@ -253,12 +253,23 @@ function createWindow() {
|
||||
Menu.setApplicationMenu(null);
|
||||
mainWindow.setMenuBarVisibility(false);
|
||||
|
||||
// 阻止默认的文件拖拽导航行为,让渲染进程的 JavaScript 处理拖拽上传
|
||||
mainWindow.webContents.on('will-navigate', (event, url) => {
|
||||
// 允许开发模式下的热重载导航
|
||||
if (isDev && url.startsWith('http://localhost')) return;
|
||||
// 阻止所有其他导航(包括拖拽文件)
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
// 同样阻止新窗口的文件拖拽
|
||||
mainWindow.webContents.setWindowOpenHandler(() => ({ action: 'deny' }));
|
||||
|
||||
// 拦截关闭事件
|
||||
mainWindow.on('close', (event) => {
|
||||
if (isQuitting) return;
|
||||
|
||||
const config = loadConfig();
|
||||
const closeAction = config.closeAction || 'tray';
|
||||
const closeAction = config.closeAction || 'quit';
|
||||
|
||||
if (closeAction === 'quit') {
|
||||
isQuitting = true;
|
||||
@@ -280,6 +291,21 @@ function createWindow() {
|
||||
|
||||
}
|
||||
|
||||
// 单实例锁定
|
||||
const gotTheLock = app.requestSingleInstanceLock();
|
||||
|
||||
if (!gotTheLock) {
|
||||
app.quit();
|
||||
} else {
|
||||
app.on('second-instance', () => {
|
||||
if (mainWindow) {
|
||||
if (mainWindow.isMinimized()) mainWindow.restore();
|
||||
mainWindow.show();
|
||||
mainWindow.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
// 应用开机自启动配置
|
||||
const config = loadConfig();
|
||||
@@ -324,9 +350,9 @@ app.whenReady().then(() => {
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
openAppIfNotOpened();
|
||||
}, 2000);
|
||||
// setTimeout(() => {
|
||||
// openAppIfNotOpened();
|
||||
// }, 2000);
|
||||
|
||||
app.on('activate', () => {
|
||||
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||
@@ -727,7 +753,7 @@ ipcMain.handle('read-log-file', async (event, logDate: string) => {
|
||||
// 获取关闭行为配置
|
||||
ipcMain.handle('get-close-action', () => {
|
||||
const config = loadConfig();
|
||||
return config.closeAction || 'tray';
|
||||
return config.closeAction;
|
||||
});
|
||||
|
||||
// 保存关闭行为配置
|
||||
|
||||
Reference in New Issue
Block a user