()
| 101 | } |
| 102 | |
| 103 | static getAll(): { [key: string]: string } { |
| 104 | this.init(); |
| 105 | try { |
| 106 | const stmt = this.db.prepare("SELECT key, value FROM config"); |
| 107 | const rows = stmt.all() as { key: string; value: string }[]; |
| 108 | |
| 109 | const config: { [key: string]: string } = {}; |
| 110 | rows.forEach(row => { |
| 111 | config[row.key] = row.value; |
| 112 | }); |
| 113 | return config; |
| 114 | } catch (error) { |
| 115 | console.error("读取所有配置失败:", error); |
| 116 | return {}; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | static delete(key: string): void { |
| 121 | this.init(); |