✨ feat(诸子列传): 添加功能

This commit is contained in:
luying
2023-07-13 16:23:29 +08:00
parent b1af8ad204
commit 1eb6f76cce
25 changed files with 5475 additions and 71 deletions
+12 -1
View File
@@ -52,6 +52,8 @@ import { ArtifactModel } from '../db/Artifact';
import { ActivityItemModel } from '../db/ActivityItem';
import { LinkModel } from '../db/Link';
import { getHiddenData } from './memoryCache/hiddenData';
import { AuthorBookModel } from '../db/AuthorBook';
import { gameData } from '../pubUtils/data';
/**
* init: 初始的时候是否推送 true-推 false-不推
@@ -128,7 +130,6 @@ export async function getModuleData(type: string, data: { role: RoleType, sessio
let artifacts = await ArtifactModel.findbyRole(role.roleId, ARTIFACT_SELECT.ENTRY);
let activityItems = await ActivityItemModel.findbyRole(role.roleId, ACTIVITYITEM_SELECT.ENTRY);
let link = await LinkModel.findByType(SNS_LINK_TYPE.CUSTOMER);
role['heros'] = heros.map(hero => new HeroParam(hero));
role['jewels'] = jewels;
role['consumeGoods'] = items;
@@ -138,6 +139,7 @@ export async function getModuleData(type: string, data: { role: RoleType, sessio
role['ipLocation'] = role.fixedIpLocation||role.ipLocation||'未知';
role['artifacts'] = artifacts;
role['activityItems'] = activityItems;
role['authorBook'] = await getAuthorBook(role.roleId);
if (!role.showLineup) role.showLineup = role.topLineup.map(cur => cur.hid);
role.heads = role.heads.filter(cur => cur.status);
@@ -432,4 +434,13 @@ export async function leaveServer(session: FrontendOrBackendSession) {
incServerNum(sid, -1);
incConnectorNum(sid, -1);
}
async function getAuthorBook(roleId: string) {
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 }
})
}