v0.3.23: 去重 — 删除重复模块,统一为单一实现+调用

修复的重复:
- 删除 src/utils/qr-login.service.ts(与 src/cloud/ 完全一致)
- qr-login.service.ts 本地 formatBytes → import { formatBytes } from quark-api
- daily-report.service.ts 本地 CLOUD_LABELS → import from cloud-constants
- 新增 cloudLabel() 本地映射(短标签 vs cloud-constants 全名)

确认无其他重复: 文件级(utils vs cloud)、函数级(export function)、字节解析
This commit is contained in:
2026-05-17 17:59:23 +08:00
parent f9338e5906
commit 1fd64e0788
5 changed files with 7 additions and 423 deletions

View File

@@ -6,6 +6,7 @@ import { getDb } from '../database/database';
import { getSystemConfig } from '../admin/system-config.service';
import { getCloudConfigs } from '../cloud/credential.service';
import { notify } from '../cloud/notification.service';
import { CLOUD_LABELS } from '../config/cloud-constants';
// ═══════════════════════════════════════════════
// Types
@@ -193,14 +194,11 @@ function formatStorage(used: string, total: string): string {
}
}
const CLOUD_LABELS: Record<string, string> = {
quark: '夸克', baidu: '百度', aliyun: '阿里云盘', '115': '115网盘',
tianyi: '天翼云', '123pan': '123云盘', uc: 'UC网盘', xunlei: '迅雷云盘',
pikpak: 'PikPak', magnet: '磁力链接', ed2k: '电驴链接', others: '其他',
};
function cloudLabel(type: string): string {
return CLOUD_LABELS[type] || type;
const short: Record<string, string> = { quark: "夸克", baidu: "百度", aliyun: "阿里云盘", "115": "115网盘", tianyi: "天翼云", "123pan": "123云盘", uc: "UC网盘", xunlei: "迅雷云盘", pikpak: "PikPak", magnet: "磁力链接", ed2k: "电驴链接", others: "其他" };
return short[type] || (CLOUD_LABELS as Record<string,string>)[type] || type;
}
export function formatDailyReport(report: DailyReport, includeSearch = true, includeSaves = true, includeStorage = true, includeUsers = true): string {