feat: 实现 IP 白名单设置的管理界面及后端校验逻辑
This commit is contained in:
@@ -36,9 +36,14 @@ export const settingsRepository = {
|
||||
|
||||
async setSetting(key: string, value: string): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const now = Math.floor(Date.now() / 1000); // 获取当前 Unix 时间戳
|
||||
db.run(
|
||||
'INSERT INTO settings (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value',
|
||||
[key, value],
|
||||
`INSERT INTO settings (key, value, created_at, updated_at)
|
||||
VALUES (?, ?, ?, ?)
|
||||
ON CONFLICT(key) DO UPDATE SET
|
||||
value = excluded.value,
|
||||
updated_at = excluded.updated_at`,
|
||||
[key, value, now, now],
|
||||
function (err: any) { // 添加 err 类型
|
||||
if (err) {
|
||||
console.error(`设置设置项 ${key} 时出错:`, err); // 更新日志为中文
|
||||
|
||||
Reference in New Issue
Block a user