fix: settings表key是MySQL保留字,加反引号
This commit is contained in:
@@ -246,7 +246,7 @@ const router = (app) => {
|
|||||||
app.put('/api/admin/settings', authenticate, async (req, res) => {
|
app.put('/api/admin/settings', authenticate, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
for (const [key, value] of Object.entries(req.body)) {
|
for (const [key, value] of Object.entries(req.body)) {
|
||||||
await pool.query('INSERT INTO settings (key, value) VALUES (?, ?) ON DUPLICATE KEY UPDATE value = VALUES(value)', [key, value]);
|
await pool.query('INSERT INTO settings (`key`, value) VALUES (?, ?) ON DUPLICATE KEY UPDATE value = VALUES(value)', [key, value]);
|
||||||
}
|
}
|
||||||
res.json({ status: 200, message: '保存成功' });
|
res.json({ status: 200, message: '保存成功' });
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user