Commit 629a1477 by archer

perf: 倒序

parent 9e951fbc
......@@ -40,6 +40,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
const searchRes = await pg.query<PgModelDataItemType>(`SELECT id, q, a, status
FROM modelData
WHERE user_id='${userId}' AND model_id='${modelId}'
ORDER BY id DESC
LIMIT ${pageSize} OFFSET ${pageSize * (pageNum - 1)}
`);
......
......@@ -16,9 +16,6 @@ export const connectPg = async () => {
connectionTimeoutMillis: 2000
});
global.pgClient.on('connect', () => {
console.log('pg connected');
});
global.pgClient.on('error', (err) => {
console.log(err);
global.pgClient = null;
......@@ -26,6 +23,7 @@ export const connectPg = async () => {
try {
await global.pgClient.connect();
console.log('pg connected');
return global.pgClient;
} catch (error) {
global.pgClient = null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment