temp
This commit is contained in:
@@ -249,6 +249,38 @@ const migration = (oldRealm: Realm, newRealm: Realm) => {
|
||||
newBookTask[i].klingOptions = undefined;
|
||||
}
|
||||
}
|
||||
if (oldRealm.schemaVersion < 40) {
|
||||
const oldBookTask = oldRealm.objects('BookTask')
|
||||
const newBookTask = newRealm.objects('BookTask')
|
||||
for (let i = 0; i < oldBookTask.length; i++) {
|
||||
newBookTask[i].videoCategory = "RUNWAY";
|
||||
newBookTask[i].videoCategory = "RUNWAY";
|
||||
}
|
||||
}
|
||||
if (oldRealm.schemaVersion < 41) {
|
||||
const oldBookTask = oldRealm.objects('BookTaskDetail')
|
||||
const newBookTask = newRealm.objects('BookTaskDetail')
|
||||
for (let i = 0; i < oldBookTask.length; i++) {
|
||||
newBookTask[i].mjVideoOptions = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldRealm.schemaVersion < 42) {
|
||||
const oldBookTask = oldRealm.objects('VideoMessage')
|
||||
const newBookTask = newRealm.objects('VideoMessage')
|
||||
for (let i = 0; i < oldBookTask.length; i++) {
|
||||
newBookTask[i].videoUrls = [];
|
||||
}
|
||||
}
|
||||
|
||||
if (oldRealm.schemaVersion < 43) {
|
||||
const oldBookTask = oldRealm.objects('VideoMessage')
|
||||
const newBookTask = newRealm.objects('VideoMessage')
|
||||
for (let i = 0; i < oldBookTask.length; i++) {
|
||||
newBookTask[i].subVideoPath = [];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export class BaseRealmService extends BaseService {
|
||||
@@ -291,7 +323,7 @@ export class BaseRealmService extends BaseService {
|
||||
VideoMessage
|
||||
],
|
||||
path: this.dbpath,
|
||||
schemaVersion: 39,
|
||||
schemaVersion: 43,
|
||||
migration: migration
|
||||
}
|
||||
this.realm = await Realm.open(config)
|
||||
|
||||
@@ -73,6 +73,9 @@ export class BookTaskDetailService extends BaseRealmService {
|
||||
subImagePath: (item.subImagePath as string[])?.map((subImage) => {
|
||||
return JoinPath(define.project_path, subImage)
|
||||
}),
|
||||
subVideoPath: (item.subVideoPath as string[])?.map((subVideo) => {
|
||||
return JoinPath(define.project_path, subVideo)
|
||||
}),
|
||||
characterTags: item.characterTags ? item.characterTags.map((tag) => tag) : null,
|
||||
sceneTags: item.sceneTags ? item.sceneTags.map((tag) => tag) : null,
|
||||
subValue: isEmpty(item.subValue) ? null : JSON.parse(item.subValue),
|
||||
@@ -202,7 +205,16 @@ export class BookTaskDetailService extends BaseRealmService {
|
||||
}
|
||||
// 开始修改
|
||||
for (let key in updateData) {
|
||||
bookTaskDetail[key] = updateData[key]
|
||||
|
||||
let newData = updateData[key];
|
||||
|
||||
if (key == "generateVideoPath") {
|
||||
if (!isEmpty(updateData[key])) {
|
||||
newData = path.relative(define.project_path, updateData[key])
|
||||
}
|
||||
}
|
||||
|
||||
bookTaskDetail[key] = newData;
|
||||
}
|
||||
bookTaskDetail.updateTime = new Date()
|
||||
})
|
||||
|
||||
@@ -13,6 +13,7 @@ import { TagDefine } from '../../../tagDefine.js'
|
||||
import { ImageStyleDefine } from "../../../../define/iamgeStyleDefine"
|
||||
import { cloneDeep } from 'lodash'
|
||||
import { GeneralResponse } from '../../../../model/generalResponse'
|
||||
import { ImageToVideoModels } from '@/define/enum/video'
|
||||
|
||||
let dbPath = path.resolve(define.db_path, 'book.realm')
|
||||
|
||||
@@ -91,6 +92,7 @@ export class BookTaskService extends BaseRealmService {
|
||||
imageFolder: JoinPath(define.project_path, bookTask.imageFolder),
|
||||
cacheImageList: bookTask.cacheImageList ? Array.from(bookTask.cacheImageList).map(item => JoinPath(define.project_path, item)) : [],
|
||||
imageCategory: bookTask.imageCategory ? bookTask.imageCategory : BookImageCategory.MJ, // 默认使用MJ出图
|
||||
videoCategory : bookTask.videoCategory ? bookTask.videoCategory : ImageToVideoModels.MJ_VIDEO
|
||||
} as Book.SelectBookTask;
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user