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) { async function getAuthorBook(roleId: string) {
let result: { bookId: number, authors: { subId: number, star: number }[], progress: number, maxProgress: number }[] = [];
let authorBooks = await AuthorBookModel.findByRoleId(roleId); let authorBooks = await AuthorBookModel.findByRoleId(roleId);
return authorBooks.map(authorBook => { for(let [bookId, maxProgress] of gameData.authorBookMaxProgress) {
let maxProgress = gameData.authorBookMaxProgress.get(authorBook.bookId); let authorBook = authorBooks.find(cur => cur.bookId == bookId);
let { bookId, authors, progress } = authorBook; result.push({ bookId, authors: authorBook?.authors??[], progress: authorBook?.progress??0, maxProgress});
return { bookId, authors, progress, maxProgress: maxProgress??0 } }
}) return result
} }