将 web-server 和 game-server 中的公共文件改为链接

This commit is contained in:
liangtongchuan
2020-09-10 17:20:27 +08:00
parent f8ac401c67
commit dbff02f5a6
32 changed files with 126 additions and 861 deletions

View File

@@ -1,5 +1,5 @@
import BaseModel from './BaseModel';
import { index, getModelForClass, prop, arrayProp, Ref, mongoose } from '@typegoose/typegoose';
import { index, getModelForClass, prop, Ref, mongoose } from '@typegoose/typegoose';
import Equip from './Equip';
/**
@@ -57,7 +57,9 @@ export default class Hero extends BaseModel {
public static async addEquip(roleId: string, hid: number, equipId: string, lean = true) {
const hero = await HeroModel.findOneAndUpdate({ roleId, hid }, {$push: {equips: equipId}}, {new: true}).lean(lean);
await Equip.putOn(hero.hid, equipId);
if (hero) {
await Equip.putOn(hero.hid, equipId);
}
return hero;
}