重构: 活动热切换并发安全 + 代码清理优化
- 活动切换并发安全:App/Scheduler 增加 client/cfg 读写锁与快照访问, 支持运行中热替换客户端,切换活动不再静默覆盖用户自定义 timeApiUrl - 启动失败时写入崩溃日志文件便于事后排查 - 前端类型声明从 Wails 自动生成的绑定派生,避免手写契约漂移 - 提取 parseAccountFile 消除 ExportAccounts/OrganizeAccounts 重复解析逻辑 - 删除 utils 中未使用的 ReadJSON/WriteJSON/WriteError 及空目录 internal/app - gofmt 统一格式化(activity/types/scheduler 字段对齐) - 新增 logger/seckill/utils 单元测试 - 清理 git 中遗留产物(frontend/app.js、yml.txt、其他日志/)并补全 .gitignore
This commit is contained in:
Vendored
+11
-28
@@ -6,34 +6,17 @@ declare module '*.vue' {
|
||||
export default component
|
||||
}
|
||||
|
||||
// Wails Go 绑定类型声明
|
||||
interface Window {
|
||||
go: {
|
||||
main: {
|
||||
App: {
|
||||
LoadProducts: (refresh: boolean) => Promise<any>
|
||||
GetAccounts: () => Promise<any[]>
|
||||
ReloadAccounts: () => Promise<any>
|
||||
StartSeckill: (accountProducts: Record<string, string>) => Promise<any>
|
||||
SetSchedule: (req: any) => Promise<any>
|
||||
CancelSchedule: () => Promise<any>
|
||||
GetResults: () => Promise<Record<string, string>>
|
||||
GetLogs: (since: number) => Promise<any>
|
||||
GetTime: () => Promise<any>
|
||||
ClearResults: () => Promise<any>
|
||||
QueryScore: (accountName: string) => Promise<any>
|
||||
GetVersion: () => Promise<string>
|
||||
GetSettings: () => Promise<any>
|
||||
SaveSettings: (cfg: any) => Promise<any>
|
||||
VerifyExchange: (accountName: string) => Promise<any>
|
||||
VerifyAllExchange: () => Promise<any>
|
||||
VerifyAndExport: (commodityID: string) => Promise<any>
|
||||
ExportAccounts: (accountNames: string[], filename: string) => Promise<any>
|
||||
ExportAccountsWithProduct: (accountNames: string[], commodityID: string, commodityName: string) => Promise<any>
|
||||
OrganizeAccounts: (commodityID: string, commodityName: string, startTime: number, endTime: number) => Promise<any>
|
||||
GetActivities: () => Promise<Array<{ id: string; displayName: string }>>
|
||||
GetCurrentActivity: () => Promise<{ id: string; displayName: string }>
|
||||
SwitchActivity: (id: string) => Promise<{ success: boolean; activity?: string; displayName?: string; error?: string }>
|
||||
// 统一从 Wails 自动生成的强类型绑定派生 window.go.main.App 的类型声明,
|
||||
// 避免手写声明与后端契约漂移。后端方法签名变更后重新运行 `wails generate`
|
||||
// 会更新 wailsjs/go/main/App.d.ts,此处类型随之更新;若前端引用了已删除或
|
||||
// 已重命名的方法,TypeScript 编译(vue-tsc)会直接报错。
|
||||
import type * as GoApp from './wailsjs/go/main/App'
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
go: {
|
||||
main: {
|
||||
App: typeof GoApp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user