Browse Source

修复一键画图

黎海 2 months ago
parent
commit
fe136f4c1c
3 changed files with 362 additions and 674 deletions
  1. 4 0
      src/db/bookService.js
  2. 12 0
      src/nodeapi/dbHandler.js
  3. 346 674
      src/pages/projectDetail/projectDetail.js

+ 4 - 0
src/db/bookService.js

@@ -108,6 +108,10 @@ class BookService {
108
         updatedBook.style = bookData.style;
108
         updatedBook.style = bookData.style;
109
       }
109
       }
110
       
110
       
111
+      if (bookData.draft_url !== undefined) {
112
+        updatedBook.draft_url = bookData.draft_url;
113
+      }
114
+      
111
       updatedBook.updated_at = new Date().toISOString();
115
       updatedBook.updated_at = new Date().toISOString();
112
       
116
       
113
       await db('book').where({ id }).update(updatedBook);
117
       await db('book').where({ id }).update(updatedBook);

+ 12 - 0
src/nodeapi/dbHandler.js

@@ -87,6 +87,15 @@ const updateDbStructure = async (db) => {
87
     });
87
     });
88
   }
88
   }
89
 
89
 
90
+  // 检查book表是否有draft_url字段
91
+  const hasDraftUrlColumn = await db.schema.hasColumn('book', 'draft_url');
92
+  if (!hasDraftUrlColumn) {
93
+    console.log('添加draft_url字段到book表');
94
+    await db.schema.table('book', table => {
95
+      table.string('draft_url').nullable();
96
+    });
97
+  }
98
+
90
   // 检查book_info表是否有image_path字段
99
   // 检查book_info表是否有image_path字段
91
   const hasImagePathColumn = await db.schema.hasColumn('book_info', 'image_path');
100
   const hasImagePathColumn = await db.schema.hasColumn('book_info', 'image_path');
92
   if (!hasImagePathColumn) {
101
   if (!hasImagePathColumn) {
@@ -160,6 +169,9 @@ const initDatabase = async (forceUpdate = false) => {
160
         table.string('audio_path').nullable();
169
         table.string('audio_path').nullable();
161
         table.string('lip_sync_video_path').nullable();
170
         table.string('lip_sync_video_path').nullable();
162
         table.string('lip_sync_task_id').nullable();
171
         table.string('lip_sync_task_id').nullable();
172
+        table.string('audio_url').nullable();
173
+        table.string('video_url').nullable();
174
+        table.string('draft_url').nullable();
163
         table.timestamp('created_at').defaultTo(db.fn.now());
175
         table.timestamp('created_at').defaultTo(db.fn.now());
164
         table.timestamp('updated_at').defaultTo(db.fn.now());
176
         table.timestamp('updated_at').defaultTo(db.fn.now());
165
       });
177
       });

File diff suppressed because it is too large
+ 346 - 674
src/pages/projectDetail/projectDetail.js