优化:武将初始加载
This commit is contained in:
@@ -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>; // 将所有字段变成可选项
|
||||
Reference in New Issue
Block a user