✨ feat(诸子列传): 初始下发进度
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user