From b693f00c196616c1bf0095baf2fb4c556f6f33e5 Mon Sep 17 00:00:00 2001 From: luying Date: Thu, 13 Jul 2023 21:15:01 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(=E8=AF=B8=E5=AD=90=E5=88=97?= =?UTF-8?q?=E4=BC=A0):=20=E5=88=9D=E5=A7=8B=E4=B8=8B=E5=8F=91=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app/services/connectorService.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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