使用pg数据库重构
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user