LaiTool V3.1.1.
This commit is contained in:
@@ -140,7 +140,8 @@ export class BookBackTaskListService extends BaseRealmService {
|
||||
taskType: BookBackTaskType,
|
||||
executeType = TaskExecuteType.AUTO,
|
||||
bookTaskId = null,
|
||||
bookTaskDetailId = null
|
||||
bookTaskDetailId = null,
|
||||
responseMessageName: string = null
|
||||
): GeneralResponse.SuccessItem | GeneralResponse.ErrorItem {
|
||||
try {
|
||||
// 通过bookid获取book信息
|
||||
@@ -181,6 +182,7 @@ export class BookBackTaskListService extends BaseRealmService {
|
||||
status: BookBackTaskStatus.WAIT,
|
||||
createTime: new Date(),
|
||||
updateTime: new Date(),
|
||||
messageName: responseMessageName,
|
||||
startTime: 0,
|
||||
endTime: 0
|
||||
} as TaskModal.Task
|
||||
|
||||
@@ -162,6 +162,20 @@ const migration = (oldRealm: Realm, newRealm: Realm) => {
|
||||
newBookTask[i].watermarkPosition = '[]'
|
||||
}
|
||||
}
|
||||
if (oldRealm.schemaVersion < 23) {
|
||||
const oldBookTask = oldRealm.objects('BookTaskDetail')
|
||||
const newBookTask = newRealm.objects('BookTaskDetail')
|
||||
for (let i = 0; i < oldBookTask.length; i++) {
|
||||
newBookTask[i].subImagePath = '[]'
|
||||
}
|
||||
}
|
||||
if (oldRealm.schemaVersion < 24) {
|
||||
const oldBookTask = oldRealm.objects('BookBackTaskList')
|
||||
const newBookTask = newRealm.objects('BookBackTaskList')
|
||||
for (let i = 0; i < oldBookTask.length; i++) {
|
||||
newBookTask[i].messageName = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export class BaseRealmService extends BaseService {
|
||||
@@ -203,7 +217,7 @@ export class BaseRealmService extends BaseService {
|
||||
BookTaskDetailModel
|
||||
],
|
||||
path: this.dbpath,
|
||||
schemaVersion: 22,
|
||||
schemaVersion: 24,
|
||||
migration: migration
|
||||
}
|
||||
this.realm = await Realm.open(config)
|
||||
|
||||
@@ -195,6 +195,9 @@ export class BookService extends BaseRealmService {
|
||||
await CheckFolderExistsOrCreate(bookTaskImageFolder) // 创建默认的任务文件夹
|
||||
// 修改数据
|
||||
book.oldVideoPath = path.relative(define.project_path, oldVideoPath)
|
||||
if (book.type == BookType.ORIGINAL) {
|
||||
book.oldVideoPath = null
|
||||
}
|
||||
|
||||
let imageCategory = BookImageCategory.MJ
|
||||
if (book.type == BookType.SD_REVERSE) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Realm from 'realm'
|
||||
import path from 'path'
|
||||
import { define } from '../../../define.js'
|
||||
import { define } from '../../../define'
|
||||
import { BookTaskModel } from '../../model/Book/bookTask.js'
|
||||
import { successMessage } from '../../../../main/Public/generalTools'
|
||||
import { BaseRealmService } from './bookBasic'
|
||||
@@ -72,6 +72,7 @@ export class BookTaskDetailService extends BaseRealmService {
|
||||
return JoinPath(define.project_path, subImage)
|
||||
}),
|
||||
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),
|
||||
reversePrompt: item.reversePrompt.map((reversePrompt) => {
|
||||
return {
|
||||
@@ -116,7 +117,7 @@ export class BookTaskDetailService extends BaseRealmService {
|
||||
* 添加一条小说任务对应的详细数据
|
||||
* @param BookTaskDetail
|
||||
*/
|
||||
public AddBookTaskDetail(bookTaskDetail) {
|
||||
public AddBookTaskDetail(bookTaskDetail: Book.SelectBookTaskDetail) {
|
||||
try {
|
||||
// 判断是不是又小说ID
|
||||
if (isEmpty(bookTaskDetail.bookId) || isEmpty(bookTaskDetail.bookTaskId)) {
|
||||
@@ -191,7 +192,6 @@ export class BookTaskDetailService extends BaseRealmService {
|
||||
*/
|
||||
UpdateBookTaskDetailMjMessage(bookTaskDetailId: string, mjMessage: Book.MJMessage): void {
|
||||
try {
|
||||
console.log('UpdateBookTaskDetailMjMessage', bookTaskDetailId, mjMessage)
|
||||
this.transaction(() => {
|
||||
let mjMessageRes = this.realm.objectForPrimaryKey('MJMessage', bookTaskDetailId)
|
||||
let bookTaskDetail = this.realm.objectForPrimaryKey('BookTaskDetail', bookTaskDetailId)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Realm from 'realm'
|
||||
import path from 'path'
|
||||
import { define } from '../../../define.js'
|
||||
import { define } from '../../../define'
|
||||
import { BookTaskModel } from '../../model/Book/bookTask.js'
|
||||
import { BookBackTaskStatus, BookImageCategory, BookTaskStatus } from '../../../enum/bookEnum.js'
|
||||
import { successMessage } from '../../../../main/Public/generalTools'
|
||||
|
||||
Reference in New Issue
Block a user