V 3.0.1 LaiTool V3.0.1-preview.3
This commit is contained in:
@@ -24,7 +24,8 @@ export class BookModel extends Realm.Object<BookModel> {
|
||||
videoConfig: string | null // 合成视频设置
|
||||
prefixPrompt: string | null // 前缀
|
||||
suffixPrompt: string | null // 后缀
|
||||
subtitlePosition: string | null
|
||||
subtitlePosition: string | null // 字幕位置
|
||||
watermarkPosition: string | null // 水印位置,一个json数组字符串
|
||||
|
||||
static schema: Realm.ObjectSchema = {
|
||||
name: 'Book',
|
||||
@@ -37,7 +38,7 @@ export class BookModel extends Realm.Object<BookModel> {
|
||||
oldVideoPath: 'string?',
|
||||
srtPath: 'string?',
|
||||
audioPath: 'string?',
|
||||
draftSrtStyle : 'string?',
|
||||
draftSrtStyle: 'string?',
|
||||
backgroundMusic: 'string?',
|
||||
friendlyReminder: 'string?',
|
||||
imageFolder: 'string?',
|
||||
@@ -50,7 +51,8 @@ export class BookModel extends Realm.Object<BookModel> {
|
||||
videoConfig: "string?",
|
||||
prefixPrompt: "string?",
|
||||
suffixPrompt: "string?",
|
||||
subtitlePosition: 'string?'
|
||||
subtitlePosition: 'string?',
|
||||
watermarkPosition: "string?"
|
||||
},
|
||||
// 主键为_id
|
||||
primaryKey: 'id'
|
||||
|
||||
@@ -155,6 +155,13 @@ const migration = (oldRealm: Realm, newRealm: Realm) => {
|
||||
newBookTask[i].subValue = '[]'
|
||||
}
|
||||
}
|
||||
if (oldRealm.schemaVersion < 22) {
|
||||
const oldBookTask = oldRealm.objects('Book')
|
||||
const newBookTask = newRealm.objects('Book')
|
||||
for (let i = 0; i < oldBookTask.length; i++) {
|
||||
newBookTask[i].watermarkPosition = '[]'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class BaseRealmService extends BaseService {
|
||||
@@ -196,7 +203,7 @@ export class BaseRealmService extends BaseService {
|
||||
BookTaskDetailModel
|
||||
],
|
||||
path: this.dbpath,
|
||||
schemaVersion: 21,
|
||||
schemaVersion: 22,
|
||||
migration: migration
|
||||
}
|
||||
this.realm = await Realm.open(config)
|
||||
|
||||
@@ -277,7 +277,7 @@ export class BookService extends BaseRealmService {
|
||||
* @param bookId 小说的ID
|
||||
* @param bookData 要修改的小说数据
|
||||
*/
|
||||
async UpdateBookData(bookId: string, bookData) {
|
||||
async UpdateBookData(bookId: string, bookData: Book.SelectBook) {
|
||||
try {
|
||||
if (bookId == null) {
|
||||
throw new Error('修改小说数据失败,缺少小说ID')
|
||||
|
||||
Reference in New Issue
Block a user