使用pg数据库重构

This commit is contained in:
2025-02-16 23:08:25 +08:00
parent 0b67c146a8
commit a3c122e76b
39 changed files with 306 additions and 681 deletions

View File

@@ -1,6 +1,6 @@
import { API } from "../../Plugs/API/API";
import ServerStdResponse from "../../ServerStdResponse";
import MySQLConnection from '../../Plugs/MySQLConnection'
import Database from '../../Plugs/Database'
import Auth from "../../Plugs/Middleware/Auth";
// 删除资源
@@ -10,13 +10,13 @@ class DelResource extends API {
}
public async onRequset(data: any, res: any) {
let { id } = data;
if (!id) {
let { uuid } = data;
if (!uuid) {
return res.json(ServerStdResponse.PARAMS_MISSING);
}
let execRes = await MySQLConnection.execute('DELETE FROM resource WHERE `id` = ?', [id]);
let execRes = await Database.query('DELETE FROM resource WHERE uuid = $1', [uuid]);
if (!execRes || execRes.affectedRows != 1) {
if (!execRes) {
return res.json(ServerStdResponse.SERVER_ERROR);
}
return res.json({ ...ServerStdResponse.OK });