更新若干功能
This commit is contained in:
306
model/models.go
306
model/models.go
@@ -96,23 +96,34 @@ type Contributor struct {
|
||||
Deleted int64 `json:"deleted"`
|
||||
}
|
||||
type HeatDay struct {
|
||||
Date string `json:"date"`
|
||||
Count int64 `json:"count"`
|
||||
Date string `json:"date"`
|
||||
Count int64 `json:"count"`
|
||||
Added int64 `json:"added"`
|
||||
Deleted int64 `json:"deleted"`
|
||||
}
|
||||
|
||||
// GitFileHotspot 记录变更最频繁的文件,用于识别高风险热点。
|
||||
type GitFileHotspot struct {
|
||||
Path string `json:"path"`
|
||||
Changes int64 `json:"changes"`
|
||||
Added int64 `json:"added"`
|
||||
Deleted int64 `json:"deleted"`
|
||||
}
|
||||
type GitStats struct {
|
||||
Available bool `json:"available"`
|
||||
Error string `json:"error,omitempty"`
|
||||
CurrentBranch string `json:"currentBranch"`
|
||||
WorkspaceBranch string `json:"workspaceBranch"`
|
||||
ViewRef string `json:"viewRef"`
|
||||
CommitCount int64 `json:"commitCount"`
|
||||
Added int64 `json:"added"`
|
||||
Deleted int64 `json:"deleted"`
|
||||
ContributorCount int64 `json:"contributorCount"`
|
||||
Commits []GitCommit `json:"commits"`
|
||||
Refs []GitRef `json:"refs"`
|
||||
Contributors []Contributor `json:"contributors"`
|
||||
Heatmap []HeatDay `json:"heatmap"`
|
||||
Available bool `json:"available"`
|
||||
Error string `json:"error,omitempty"`
|
||||
CurrentBranch string `json:"currentBranch"`
|
||||
WorkspaceBranch string `json:"workspaceBranch"`
|
||||
ViewRef string `json:"viewRef"`
|
||||
CommitCount int64 `json:"commitCount"`
|
||||
Added int64 `json:"added"`
|
||||
Deleted int64 `json:"deleted"`
|
||||
ContributorCount int64 `json:"contributorCount"`
|
||||
Commits []GitCommit `json:"commits"`
|
||||
Refs []GitRef `json:"refs"`
|
||||
Contributors []Contributor `json:"contributors"`
|
||||
Heatmap []HeatDay `json:"heatmap"`
|
||||
Hotspots []GitFileHotspot `json:"hotspots"`
|
||||
}
|
||||
type GitDiagnostics struct {
|
||||
Available bool `json:"available"`
|
||||
@@ -179,6 +190,54 @@ type LogEntry struct {
|
||||
Detail string `json:"detail"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
type Todo struct {
|
||||
ID int64 `json:"id"`
|
||||
UUID string `json:"uuid"`
|
||||
Title string `json:"title"`
|
||||
Content string `json:"content"`
|
||||
ProjectID int64 `json:"projectId"`
|
||||
ProjectName string `json:"projectName"`
|
||||
DueAt string `json:"dueAt"`
|
||||
Priority string `json:"priority"` // low | medium | high
|
||||
Status string `json:"status"` // open | doing | done
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
History string `json:"history"` // JSON 数组:[{"status","at"}],记录每次进入某状态的时间
|
||||
TeamID int64 `json:"teamId"` // >0 表示已共享给该团队
|
||||
}
|
||||
type Ticket struct {
|
||||
ID int64 `json:"id"`
|
||||
UUID string `json:"uuid"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Type string `json:"type"` // feature | bug | task | improvement
|
||||
ProjectID int64 `json:"projectId"`
|
||||
ProjectName string `json:"projectName"`
|
||||
StartAt string `json:"startAt"`
|
||||
DueAt string `json:"dueAt"`
|
||||
Status string `json:"status"` // open | in_progress | resolved | closed
|
||||
Priority string `json:"priority"` // low | medium | high
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
History string `json:"history"` // JSON 数组:[{"status","at"}],记录每次进入某状态的时间
|
||||
TeamID int64 `json:"teamId"` // >0 表示已共享给该团队
|
||||
}
|
||||
type Note struct {
|
||||
ID int64 `json:"id"`
|
||||
UUID string `json:"uuid"`
|
||||
Content string `json:"content"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
type Message struct {
|
||||
ID int64 `json:"id"`
|
||||
Kind string `json:"kind"` // todo_due | ticket_due | analysis | sync | system
|
||||
Title string `json:"title"`
|
||||
Body string `json:"body"`
|
||||
SourceType string `json:"sourceType"` // todo | ticket | project | ""
|
||||
SourceID int64 `json:"sourceId"`
|
||||
Read bool `json:"read"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
type AppSettings struct {
|
||||
Theme string `json:"theme"`
|
||||
Locale string `json:"locale"`
|
||||
@@ -187,11 +246,174 @@ type AppSettings struct {
|
||||
AutoRefresh bool `json:"autoRefresh"`
|
||||
GlassOpacity int `json:"glassOpacity"`
|
||||
LoadingStyle string `json:"loadingStyle"`
|
||||
// 托盘与定时更新(Phase 2)
|
||||
MinimizeToTray bool `json:"minimizeToTray"`
|
||||
AutoUpdateEnabled bool `json:"autoUpdateEnabled"`
|
||||
AutoUpdateMode string `json:"autoUpdateMode"` // daily | everyNDays | everyNHours
|
||||
AutoUpdateInterval int `json:"autoUpdateInterval"` // everyNDays/everyNHours 的 N
|
||||
AutoUpdateTime string `json:"autoUpdateTime"` // daily/everyNDays 的触发时刻 HH:MM
|
||||
// AI 分析(Phase 5)
|
||||
AIProvider string `json:"aiProvider"` // spark | deepseek
|
||||
SparkKey string `json:"sparkKey"`
|
||||
DeepSeekKey string `json:"deepSeekKey"`
|
||||
// SyncAPIKeys 开启后 API Key 会加密同步到 MySQL(密钥由登录密码派生,服务器不可解密)。
|
||||
SyncAPIKeys bool `json:"syncApiKeys"`
|
||||
// 用户头像:AvatarMode 为 ""(未设置) | base64 | url | path,AvatarValue 依模式存 dataURL / 图片 URL / 本地文件路径。
|
||||
AvatarMode string `json:"avatarMode"`
|
||||
AvatarValue string `json:"avatarValue"`
|
||||
// 内容图片存储:待办/工单 Markdown 里粘贴或插入的图片如何保存。
|
||||
// base64(内嵌 dataURL,随内容同步到云端)| path(写入数据目录,仅本机可见)。
|
||||
ImageMode string `json:"imageMode"`
|
||||
}
|
||||
|
||||
// AvatarPick 是选择头像图片的结果:Value 为要保存的值,Preview 为可直接显示的图片源。
|
||||
// SearchHit 全局搜索(Ctrl+K 命令面板)的一条结果。
|
||||
type SearchHit struct {
|
||||
Kind string `json:"kind"` // project | todo | ticket | conversation
|
||||
ID int64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Sub string `json:"sub"` // 路径 / 状态 / 供应商等辅助信息
|
||||
Extra string `json:"extra"` // 次级状态(如优先级)
|
||||
}
|
||||
|
||||
type AvatarPick struct {
|
||||
// Mode 是选图后实际采用的存储模式(base64 | url),auto 选图时由全局配置决定。
|
||||
Mode string `json:"mode"`
|
||||
Value string `json:"value"`
|
||||
Preview string `json:"preview"`
|
||||
}
|
||||
|
||||
// AIConversation 是一次 AI 分析会话(可绑定项目)。
|
||||
type AIConversation struct {
|
||||
ID int64 `json:"id"`
|
||||
ProjectID int64 `json:"projectId"`
|
||||
ProjectName string `json:"projectName"`
|
||||
Provider string `json:"provider"`
|
||||
Title string `json:"title"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// AIMessage 是会话中的一条消息。
|
||||
type AIMessage struct {
|
||||
ID int64 `json:"id"`
|
||||
ConversationID int64 `json:"conversationId"`
|
||||
Role string `json:"role"` // user | assistant
|
||||
Content string `json:"content"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
|
||||
// AISummary 是分析完成后 AI 生成的模块介绍(按项目+模块各存最新一份)。
|
||||
type AISummary struct {
|
||||
ProjectID int64 `json:"projectId"`
|
||||
Kind string `json:"kind"` // project | git
|
||||
Content string `json:"content"`
|
||||
Provider string `json:"provider"`
|
||||
GeneratedAt string `json:"generatedAt"`
|
||||
}
|
||||
type Dashboard struct {
|
||||
Projects int64 `json:"projects"`
|
||||
TotalLines int64 `json:"totalLines"`
|
||||
Commits int64 `json:"commits"`
|
||||
Projects int64 `json:"projects"`
|
||||
TotalLines int64 `json:"totalLines"`
|
||||
CodeLines int64 `json:"codeLines"`
|
||||
CommentLines int64 `json:"commentLines"`
|
||||
BlankLines int64 `json:"blankLines"`
|
||||
FileCount int64 `json:"fileCount"`
|
||||
Commits int64 `json:"commits"`
|
||||
Contributors int64 `json:"contributors"`
|
||||
Languages []LanguageStat `json:"languages"`
|
||||
}
|
||||
|
||||
// FileStorageConfig 是全局「文件存储方式」配置:由管理员(云端账号 id=1)设置,
|
||||
// 云端存 sync_settings 的 file_storage 行(挂在 id=1 名下),随同步分发给所有账号。
|
||||
// mode=local 时图片维持本地行为;mode=server 时内容图(imageMode=server)与
|
||||
// 头像选图上传到 nl-pms-api 换取 http URL,远程/跨设备场景直接引用。
|
||||
type FileStorageConfig struct {
|
||||
Mode string `json:"mode"` // local | server
|
||||
BaseURL string `json:"baseUrl"` // nl-pms-api 地址,如 http://192.168.1.10:8788
|
||||
APIKey string `json:"apiKey"` // 上传密钥(Authorization: Bearer <apiKey>)
|
||||
}
|
||||
|
||||
// ServerFile 是 nl-pms-api 素材库中的一条文件记录(含上传者用户名与公开访问 URL)。
|
||||
type ServerFile struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
URL string `json:"url"`
|
||||
Mime string `json:"mime"`
|
||||
Size int64 `json:"size"`
|
||||
UserID int64 `json:"userId"`
|
||||
TeamID int64 `json:"teamId"`
|
||||
Kind string `json:"kind"` // avatar | content
|
||||
Username string `json:"username"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
}
|
||||
|
||||
// ServerFileList 是素材库的一页结果。
|
||||
type ServerFileList struct {
|
||||
Total int64 `json:"total"`
|
||||
Items []ServerFile `json:"items"`
|
||||
}
|
||||
|
||||
// SyncConfig 是 MySQL 同步服务器的连接配置(保存在本地 SQLite)。
|
||||
type SyncConfig struct {
|
||||
Host string `json:"host"`
|
||||
Port int `json:"port"`
|
||||
User string `json:"user"`
|
||||
Password string `json:"password"`
|
||||
Database string `json:"database"`
|
||||
}
|
||||
|
||||
// SyncStatus 描述当前登录与同步状态,供设置页展示。
|
||||
type SyncStatus struct {
|
||||
Configured bool `json:"configured"`
|
||||
LoggedIn bool `json:"loggedIn"`
|
||||
// UserID 为云端账号 id;id=1 视为管理员(可配置节日背景图等全局资源)。
|
||||
UserID int64 `json:"userId"`
|
||||
Username string `json:"username"`
|
||||
LastSyncAt string `json:"lastSyncAt"`
|
||||
Syncing bool `json:"syncing"`
|
||||
Online bool `json:"online"`
|
||||
LastError string `json:"lastError"`
|
||||
Pushed int `json:"pushed"`
|
||||
Pulled int `json:"pulled"`
|
||||
// Pending 为本地待推送(dirty)行数,用于界面徽标。
|
||||
Pending int `json:"pending"`
|
||||
}
|
||||
|
||||
// FestivalImage 是一个节日的背景配置:mode 决定日历格显示自定义照片还是动态插画。
|
||||
// image 在 mode=art 时仍保留,方便管理员切回图片模式无需重新上传。
|
||||
type FestivalImage struct {
|
||||
Mode string `json:"mode"` // photo | art
|
||||
Image string `json:"image"`
|
||||
}
|
||||
|
||||
// LogPage 是日志分页搜索的结果,counts 基于当前搜索条件(忽略级别筛选)。
|
||||
type LogPage struct {
|
||||
Items []LogEntry `json:"items"`
|
||||
Total int64 `json:"total"`
|
||||
Info int64 `json:"info"`
|
||||
Warning int64 `json:"warning"`
|
||||
Error int64 `json:"error"`
|
||||
}
|
||||
|
||||
// BatchSummary 是批量统计完成后的汇总事件载荷。
|
||||
type BatchSummary struct {
|
||||
Total int `json:"total"`
|
||||
Completed int `json:"completed"`
|
||||
Failed int `json:"failed"`
|
||||
Cancelled int `json:"cancelled"`
|
||||
Failures []string `json:"failures"`
|
||||
}
|
||||
|
||||
// FilePreview 是文件预览接口的返回载荷。
|
||||
type FilePreview struct {
|
||||
Path string `json:"path"`
|
||||
Name string `json:"name"`
|
||||
Extension string `json:"extension"`
|
||||
Size int64 `json:"size"`
|
||||
Content string `json:"content"`
|
||||
Lines int `json:"lines"`
|
||||
Truncated bool `json:"truncated"`
|
||||
Binary bool `json:"binary"`
|
||||
}
|
||||
|
||||
// TaskEvent 只传递稳定消息键,具体中文或英文由前端根据当前语言即时翻译。
|
||||
@@ -203,3 +425,51 @@ type TaskEvent struct {
|
||||
MessageKey string `json:"messageKey"`
|
||||
Params map[string]any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
// CloneInput 是「从 Git 克隆并添加项目」的入参。
|
||||
type CloneInput struct {
|
||||
URL string `json:"url"`
|
||||
ParentDir string `json:"parentDir"`
|
||||
Name string `json:"name"`
|
||||
GroupID int64 `json:"groupId"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// LaunchApp 是启动台保存的应用(含启停命令)。
|
||||
type LaunchApp struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Kind string `json:"kind"`
|
||||
Port int `json:"port"`
|
||||
Dir string `json:"dir"`
|
||||
StartCmd string `json:"startCmd"`
|
||||
StopCmd string `json:"stopCmd"`
|
||||
LastPID int64 `json:"lastPid"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
}
|
||||
|
||||
// LaunchEntry 是启动台卡片条目:保存的应用与实时扫描到的监听进程合并后的视图。
|
||||
type LaunchEntry struct {
|
||||
ID int64 `json:"id"` // launch_apps id;0 表示未保存的扫描条目
|
||||
Name string `json:"name"`
|
||||
Kind string `json:"kind"`
|
||||
Port int `json:"port"`
|
||||
Dir string `json:"dir"`
|
||||
StartCmd string `json:"startCmd"`
|
||||
StopCmd string `json:"stopCmd"`
|
||||
Running bool `json:"running"`
|
||||
PID int32 `json:"pid"`
|
||||
Exe string `json:"exe"`
|
||||
Cmdline string `json:"cmdline"`
|
||||
Ports []int `json:"ports"`
|
||||
CPU float64 `json:"cpu"` // 占全机 CPU 百分比
|
||||
MemMB float64 `json:"memMB"` // 常驻内存
|
||||
IOKBs float64 `json:"ioKBs"` // 磁盘读写吞吐
|
||||
}
|
||||
|
||||
// LaunchSuggest 是按项目种类推荐的启停命令。
|
||||
type LaunchSuggest struct {
|
||||
Start []string `json:"start"`
|
||||
Stop []string `json:"stop"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user