diff --git a/game-server/app/services/connectorService.ts b/game-server/app/services/connectorService.ts index 4aa1d159f..54b738667 100644 --- a/game-server/app/services/connectorService.ts +++ b/game-server/app/services/connectorService.ts @@ -437,10 +437,11 @@ export async function leaveServer(session: FrontendOrBackendSession) { } async function getAuthorBook(roleId: string) { + let result: { bookId: number, authors: { subId: number, star: number }[], progress: number, maxProgress: number }[] = []; let authorBooks = await AuthorBookModel.findByRoleId(roleId); - return authorBooks.map(authorBook => { - let maxProgress = gameData.authorBookMaxProgress.get(authorBook.bookId); - let { bookId, authors, progress } = authorBook; - return { bookId, authors, progress, maxProgress: maxProgress??0 } - }) + for(let [bookId, maxProgress] of gameData.authorBookMaxProgress) { + let authorBook = authorBooks.find(cur => cur.bookId == bookId); + result.push({ bookId, authors: authorBook?.authors??[], progress: authorBook?.progress??0, maxProgress}); + } + return result } \ No newline at end of file