🚀 主要功能: - 完善后端API服务层,实现完整的CRUD操作 - 开发管理后台所有核心页面 (仪表板、照片、分类、标签、用户、设置) - 完成前后端完全集成,所有API接口正常对接 - 配置完整的CI/CD流水线,支持自动化部署 🎯 后端完善: - 实现PhotoService, CategoryService, TagService, UserService - 添加完整的API处理器和路由配置 - 支持Docker容器化部署 - 添加数据库迁移和健康检查 🎨 管理后台完成: - 仪表板: 实时统计数据展示 - 照片管理: 完整的CRUD操作,支持批量处理 - 分类管理: 树形结构展示和管理 - 标签管理: 颜色标签和统计信息 - 用户管理: 角色权限控制 - 系统设置: 多标签配置界面 - 添加pre-commit代码质量检查 🔧 部署配置: - Docker Compose完整配置 - 后端CI/CD流水线 (Docker部署) - 管理后台CI/CD流水线 (静态文件部署) - 前端CI/CD流水线优化 - 自动化脚本: 部署、备份、监控 - 完整的部署文档和运维指南 ✅ 集成完成: - 所有API接口正常连接 - 认证系统完整集成 - 数据获取和状态管理 - 错误处理和用户反馈 - 响应式设计优化
240 lines
5.9 KiB
TypeScript
240 lines
5.9 KiB
TypeScript
import api from './api'
|
|
|
|
interface SystemSettings {
|
|
site: {
|
|
title: string
|
|
description: string
|
|
keywords: string
|
|
favicon?: string
|
|
logo?: string
|
|
copyright: string
|
|
contactEmail: string
|
|
}
|
|
upload: {
|
|
maxFileSize: number
|
|
allowedTypes: string[]
|
|
compressionQuality: number
|
|
watermarkEnabled: boolean
|
|
watermarkText: string
|
|
watermarkPosition: string
|
|
}
|
|
security: {
|
|
jwtSecret: string
|
|
jwtExpiration: number
|
|
enableTwoFactor: boolean
|
|
enableAuditLog: boolean
|
|
maxLoginAttempts: number
|
|
lockoutDuration: number
|
|
}
|
|
performance: {
|
|
cacheEnabled: boolean
|
|
cacheExpiration: number
|
|
imageCacheSize: number
|
|
enableCompression: boolean
|
|
maxConcurrentUploads: number
|
|
}
|
|
notifications: {
|
|
emailEnabled: boolean
|
|
emailHost: string
|
|
emailPort: number
|
|
emailUser: string
|
|
emailPassword: string
|
|
enableUserNotifications: boolean
|
|
enableSystemAlerts: boolean
|
|
}
|
|
backup: {
|
|
autoBackupEnabled: boolean
|
|
backupInterval: number
|
|
maxBackupFiles: number
|
|
backupLocation: string
|
|
}
|
|
}
|
|
|
|
interface SystemStatus {
|
|
server: {
|
|
status: 'online' | 'offline'
|
|
uptime: string
|
|
version: string
|
|
lastRestart: string
|
|
}
|
|
database: {
|
|
status: 'connected' | 'disconnected' | 'error'
|
|
version: string
|
|
size: string
|
|
lastBackup: string
|
|
}
|
|
storage: {
|
|
total: string
|
|
used: string
|
|
free: string
|
|
usage: number
|
|
}
|
|
performance: {
|
|
cpu: number
|
|
memory: number
|
|
activeConnections: number
|
|
responseTime: number
|
|
}
|
|
}
|
|
|
|
interface SystemOperation {
|
|
operation: string
|
|
}
|
|
|
|
export const settingsService = {
|
|
// 获取系统设置
|
|
getSettings: async (): Promise<SystemSettings> => {
|
|
const response = await api.get('/settings')
|
|
return response.data
|
|
},
|
|
|
|
// 更新系统设置
|
|
updateSettings: async (settings: Partial<SystemSettings>): Promise<SystemSettings> => {
|
|
const response = await api.put('/settings', settings)
|
|
return response.data
|
|
},
|
|
|
|
// 获取系统状态
|
|
getSystemStatus: async (): Promise<SystemStatus> => {
|
|
const response = await api.get('/system/status')
|
|
return response.data
|
|
},
|
|
|
|
// 执行系统操作
|
|
performSystemOperation: async (operation: SystemOperation): Promise<any> => {
|
|
const response = await api.post('/system/operation', operation)
|
|
return response.data
|
|
},
|
|
|
|
// 获取配置项
|
|
getConfig: async (key: string): Promise<any> => {
|
|
const response = await api.get(`/settings/config/${key}`)
|
|
return response.data
|
|
},
|
|
|
|
// 更新配置项
|
|
updateConfig: async (key: string, value: any): Promise<void> => {
|
|
await api.put(`/settings/config/${key}`, { value })
|
|
},
|
|
|
|
// 重置配置
|
|
resetConfig: async (section?: string): Promise<void> => {
|
|
await api.post('/settings/reset', { section })
|
|
},
|
|
|
|
// 导出配置
|
|
exportConfig: async (): Promise<Blob> => {
|
|
const response = await api.get('/settings/export', { responseType: 'blob' })
|
|
return response.data
|
|
},
|
|
|
|
// 导入配置
|
|
importConfig: async (file: File): Promise<void> => {
|
|
const formData = new FormData()
|
|
formData.append('config', file)
|
|
await api.post('/settings/import', formData, {
|
|
headers: { 'Content-Type': 'multipart/form-data' }
|
|
})
|
|
},
|
|
|
|
// 获取系统日志
|
|
getSystemLogs: async (params: { level?: string; limit?: number; offset?: number }): Promise<any[]> => {
|
|
const response = await api.get('/system/logs', { params })
|
|
return response.data
|
|
},
|
|
|
|
// 清理系统日志
|
|
clearSystemLogs: async (): Promise<void> => {
|
|
await api.delete('/system/logs')
|
|
},
|
|
|
|
// 获取系统健康检查
|
|
getHealthCheck: async (): Promise<any> => {
|
|
const response = await api.get('/system/health')
|
|
return response.data
|
|
},
|
|
|
|
// 获取系统信息
|
|
getSystemInfo: async (): Promise<any> => {
|
|
const response = await api.get('/system/info')
|
|
return response.data
|
|
},
|
|
|
|
// 获取备份列表
|
|
getBackups: async (): Promise<any[]> => {
|
|
const response = await api.get('/system/backups')
|
|
return response.data
|
|
},
|
|
|
|
// 创建备份
|
|
createBackup: async (): Promise<any> => {
|
|
const response = await api.post('/system/backups')
|
|
return response.data
|
|
},
|
|
|
|
// 删除备份
|
|
deleteBackup: async (id: string): Promise<void> => {
|
|
await api.delete(`/system/backups/${id}`)
|
|
},
|
|
|
|
// 恢复备份
|
|
restoreBackup: async (id: string): Promise<void> => {
|
|
await api.post(`/system/backups/${id}/restore`)
|
|
},
|
|
|
|
// 下载备份
|
|
downloadBackup: async (id: string): Promise<Blob> => {
|
|
const response = await api.get(`/system/backups/${id}/download`, { responseType: 'blob' })
|
|
return response.data
|
|
},
|
|
|
|
// 获取缓存统计
|
|
getCacheStats: async (): Promise<any> => {
|
|
const response = await api.get('/system/cache/stats')
|
|
return response.data
|
|
},
|
|
|
|
// 清理缓存
|
|
clearCache: async (type?: string): Promise<void> => {
|
|
await api.delete('/system/cache', { params: { type } })
|
|
},
|
|
|
|
// 获取存储统计
|
|
getStorageStats: async (): Promise<any> => {
|
|
const response = await api.get('/system/storage/stats')
|
|
return response.data
|
|
},
|
|
|
|
// 清理存储
|
|
cleanStorage: async (type?: string): Promise<void> => {
|
|
await api.delete('/system/storage/cleanup', { params: { type } })
|
|
},
|
|
|
|
// 获取任务列表
|
|
getTasks: async (): Promise<any[]> => {
|
|
const response = await api.get('/system/tasks')
|
|
return response.data
|
|
},
|
|
|
|
// 创建任务
|
|
createTask: async (task: any): Promise<any> => {
|
|
const response = await api.post('/system/tasks', task)
|
|
return response.data
|
|
},
|
|
|
|
// 删除任务
|
|
deleteTask: async (id: string): Promise<void> => {
|
|
await api.delete(`/system/tasks/${id}`)
|
|
},
|
|
|
|
// 执行任务
|
|
executeTask: async (id: string): Promise<void> => {
|
|
await api.post(`/system/tasks/${id}/execute`)
|
|
},
|
|
|
|
// 获取任务日志
|
|
getTaskLogs: async (id: string): Promise<any[]> => {
|
|
const response = await api.get(`/system/tasks/${id}/logs`)
|
|
return response.data
|
|
}
|
|
} |