From 0d1d4e567940366c5754f4dcdb83213f8fe87d7d Mon Sep 17 00:00:00 2001 From: Elysia Date: Sat, 31 Jan 2026 20:19:52 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A3=80=E6=9F=A5=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E4=B8=8B=E8=BD=BD=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modeuls/processInstall.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/modeuls/processInstall.ts b/src/modeuls/processInstall.ts index 145b8e3d..f2e3a16e 100644 --- a/src/modeuls/processInstall.ts +++ b/src/modeuls/processInstall.ts @@ -1,6 +1,7 @@ // window.ipcRenderer.on('main-process-message', (_event, ...args) => { // console.log('[Receive Main-process message]:', ...args) // }) +import pino from 'pino'; import { currentApp, currentAppIsInstalled } from "../global/storeConfig"; import { APM_STORE_BASE_URL } from "../global/storeConfig"; @@ -9,10 +10,16 @@ import { downloads } from "../global/downloadStatus"; import { InstallLog, DownloadItem, DownloadResult, App } from '../global/typedefinition'; let downloadIdCounter = 0; +const logger = pino({ name: 'processInstall.ts' }); export const handleInstall = () => { if (!currentApp.value?.pkgname) return; + if (downloads.value.find(d => d.pkgname === currentApp.value?.pkgname)) { + logger.info(`任务已存在,忽略重复添加: ${currentApp.value.pkgname}`); + return; + } + downloadIdCounter += 1; // 创建下载任务 const download: DownloadItem = { @@ -56,6 +63,11 @@ export const handleRetry = (download_: DownloadItem) => { export const handleUpgrade = (app: App) => { if (!app.pkgname) return; + if (downloads.value.find(d => d.pkgname === app.pkgname)) { + logger.info(`任务已存在,忽略重复添加: ${app.pkgname}`); + return; + } + downloadIdCounter += 1; const download: DownloadItem = { id: downloadIdCounter,