From f92af1cd1f16c5bd1d9edc05f337b224088dc6fb Mon Sep 17 00:00:00 2001 From: zhl Date: Fri, 22 Jan 2021 13:26:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8E=A5=E5=8F=A3,=20=E8=B0=83=E6=95=B4=E4=BB=A3?= =?UTF-8?q?=E5=B8=81=E7=9A=84=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api.md | 15 ++++++--------- src/controllers/AccountController.ts | 5 ++--- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/docs/api.md b/docs/api.md index 9341fb0..0d28329 100644 --- a/docs/api.md +++ b/docs/api.md @@ -40,15 +40,12 @@ trial: false, // 是否是试用 trial_expire: 1609919293, // 试用到期时间, 0: 说明是永久 }], - moneys: { - 'coin': 0, // 金币 - 'diamond': 0, // 钻石 - 'hero_shard': 0, // 通用英雄碎片 - 'hero_exp': 0, // 通用英雄经验 - 'hero_shard_heroid': 0, // 英雄专用碎片 - 'hero_exp_heroid': 0, // 英雄专用经验 - 'card_scroll': 0, //抽卡卷轴 - }, + moneys: [ + { + "itemid": 80012, //代币的id + "itemnum": 140 // 数量 + } + ], normal_stat: [0, 0, 0, 0] //匹配: 胜利场数, 失败场数, 平局场数, 掉线场数 season_rank: 1 // 当前赛季排名 match_score: 1000 //当前匹配分, 用于匹配时上传 diff --git a/src/controllers/AccountController.ts b/src/controllers/AccountController.ts index 12024f7..6959489 100644 --- a/src/controllers/AccountController.ts +++ b/src/controllers/AccountController.ts @@ -7,8 +7,6 @@ import { BaseConst } from '../constants/BaseConst' import { Hero } from '../models/subdoc/Hero' import { CardGroup } from '../models/CardGroup' import { BagItem, ItemType } from '../models/BagItem' -import ItemCtrl from '../logic/ItemCtrl' -import { ItemInfo } from '../logic/ItemDef' export default class AccountController extends BaseController { @role('anon') @@ -72,7 +70,8 @@ export default class AccountController extends BaseController { result.heros = heros await account.save() - result.moneys = account.moneys + const moneyList = await BagItem.find({accountid, itemtype: ItemType.MONEY}) + result.moneys = moneyList.map(o => o.toJson()) result.normal_stat = account.normal_stat result.extinfo = account.extinfo result.season_score = account.season_score