优化:武将初始加载

This commit is contained in:
luying
2021-09-01 19:56:19 +08:00
parent 9d25fafbde
commit e572cb2fa5
15 changed files with 507 additions and 86 deletions
+10
View File
@@ -26,6 +26,15 @@ export default class Skin extends BaseModel {
return rec;
}
public static async insertSkins(roleId: string, roleName: string, skinInfos: SkinUpdate[]) {
let insertInfos: SkinUpdate[] = [];
for(let skinInfo of skinInfos) {
insertInfos.push({ ...skinInfo, roleId, roleName });
}
const items: SkinType[] = await SkinModel.insertMany(insertInfos);
return items;
}
public static async increaseSkin(roleId: string, id: number, info: { roleId: string, roleName: string, id: number, skinName: string, hid: number }, lean = true) {
const doc = new SkinModel();
const setOnInsert = Object.assign(doc.toJSON(), info);
@@ -39,3 +48,4 @@ export const SkinModel = getModelForClass(Skin);
export interface SkinType extends Pick<DocumentType<Skin>, keyof Skin> {
id: number;
};
export type SkinUpdate = Partial<SkinType>; // 将所有字段变成可选项