ソースを参照

更新了mysql 配置文件

Ryuiso 1 年間 前
コミット
44b648b463
2 ファイル変更10 行追加6 行削除
  1. 6 6
      app/api/bigModel/route.ts
  2. 4 0
      declarations.d.ts

+ 6 - 6
app/api/bigModel/route.ts

@@ -4,10 +4,10 @@ import mysql from 'mysql2/promise';
 // 创建全局的 MySQL 连接池
 const pool = mysql.createPool({
   connectionLimit: 100,
-  host: '127.0.0.1', // 服务器地址
-  port: 3306,
-  user: 'root',
-  password: '123456', // 密码
+  host: '60.204.184.98', // 服务器地址
+  port: 33308,
+  user: 'chat',
+  password: 'DZzx6ACMhinTtTtS', // 密码
   database: 'chat',
 })
 
@@ -31,7 +31,7 @@ export async function POST(req: any) {
 
     const [rows, fields] = await connection.query('SELECT * FROM dialog where id = ?', [id]);
 
-    if (rows.length === 0) {
+    if ((rows as any).length === 0) {
       // 执行 MySQL 添加头表
       connection.execute('INSERT INTO dialog (id, create_time) VALUES (?,?)', [id, new Date])
     }
@@ -42,7 +42,7 @@ export async function POST(req: any) {
       const createDate = message.date;
       const content = message.content;
       const [detailRows, fields] = await connection.query('SELECT * FROM dialog_detail where id = ?', [detailId]);
-      if (detailRows.length === 0) {
+      if ((detailRows as any).length === 0) {
         // 执行 MySQL 添加头表
         connection.execute('INSERT INTO dialog_detail (id,dialog_id,type,content,create_by, create_time) VALUES (?, ?, ?,?,?,?)', [detailId, id, role, content, role, createDate])
       }

+ 4 - 0
declarations.d.ts

@@ -0,0 +1,4 @@
+declare module 'js-export-excel' {
+  const Excel: any;
+  export default Excel;
+}