feat(诸子列传): 初始下发进度

This commit is contained in:
luying
2023-07-13 21:15:01 +08:00
parent ac81a9f3b4
commit b693f00c19

View File

@@ -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
}