diff --git a/docs/api.md b/docs/api.md index 6804d07..5a22737 100644 --- a/docs/api.md +++ b/docs/api.md @@ -93,8 +93,8 @@ 3. Response: JSON -> 说明: 匹配模式可以用的英雄: (owned == true || (free == true && not expired)) && (usetype == 0 || usetype == 2) -> 赛季排位模式可以用的英雄: (owned == true || (free == true && not expired)) && (usetype == 0 || usetype == 1) +> 说明: 匹配模式可以用的英雄: (owned == true || (trial== true && not expired)) && (usetype == 0 || usetype == 2) +> 赛季排位模式可以用的英雄: (owned == true || (trial== true && not expired)) && (usetype == 0 || usetype == 1) ```js diff --git a/src/controllers/AccountController.ts b/src/controllers/AccountController.ts index a3da3d1..426ac26 100644 --- a/src/controllers/AccountController.ts +++ b/src/controllers/AccountController.ts @@ -17,23 +17,9 @@ export default class AccountController extends BaseController { result.cards = account.cards; let heros: any[] = []; for(let [key, hero] of account.heros) { - heros.push({ - heroid: hero.heroid, - owned: true, - usetype: 0, - level: hero.level, - exp: hero.exp, - free: hero.free, - free_expire: 0 - }); + heros.push(hero.toJson()); } result.heros = heros; - // let hero = new Hero(); - // hero.free = true; - // hero.level = 1; - // hero.exp = 0; - // hero.heroid = 30012; - // account.heros.set(30012+'', hero) await account.save(); result.moneys = account.moneys; result.normal_stat= account.normal_stat; diff --git a/src/models/User.ts b/src/models/User.ts index 37a2b5b..b208051 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -88,7 +88,7 @@ class UserClass extends FindOrCreate{ public async unlockHero(heroid: number) { if (this.heros.has(heroid + '')) { - if (!this.heros.get(heroid + '').free) { + if (!this.heros.get(heroid + '').trial) { throw new ZError(102, '你已经解锁了该英雄'); } }