From c7127b35d1837e463245a0bca18308c28515979a Mon Sep 17 00:00:00 2001 From: zhl Date: Fri, 8 Jan 2021 12:31:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=A3=E9=94=81=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=E6=97=B6,=E6=98=AF=E5=90=A6=E7=AC=A6=E5=90=88?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E7=9A=84=E5=88=A4=E6=96=AD=E6=A0=87=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api.md | 4 ++-- src/controllers/AccountController.ts | 16 +--------------- src/models/User.ts | 2 +- 3 files changed, 4 insertions(+), 18 deletions(-) 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, '你已经解锁了该英雄'); } }