使用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,7 +1,8 @@
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";
import { Resource } from "@/Types/Schema";
// 获取资源列表
class GetResources extends API {
@@ -11,7 +12,7 @@ class GetResources extends API {
public async onRequset(data: any, res: any) {
// const { uuid } = data._jwt;
let resourcesRes = await MySQLConnection.execute("SELECT * FROM resource");
let resourcesRes = await Database.query<Resource>("SELECT * FROM resource ORDER BY type, recommand, created_at DESC");
if (!resourcesRes) {
return res.json(ServerStdResponse.SERVER_ERROR);
}