更新解锁英雄接口的文档
This commit is contained in:
parent
c4c3ba8ac1
commit
0e80dc5bf1
18
docs/api.md
18
docs/api.md
@ -193,7 +193,23 @@
|
||||
|
||||
3. Response: JSON
|
||||
|
||||
根据errcode判断成功or失败
|
||||
> 说明: 解锁成功的话, 会返回当前解锁英雄的数据
|
||||
|
||||
|
||||
```js
|
||||
[{
|
||||
heroid: 1022, // 英雄id
|
||||
owned: true, // 是否已拥有
|
||||
ban: false, // 是否被禁用
|
||||
usetype: 1, // 赛季专属, 0: 通用, 1: 赛季排位专用, 2: 匹配专用
|
||||
free: false, // 是否免费
|
||||
free_expire: 1609919293 // 免费到期时间, 0: 说明是永久免费
|
||||
level: 1, // 等级
|
||||
exp: 0, // 当前的经验值
|
||||
}]
|
||||
```
|
||||
|
||||
|
||||
|
||||
### 8. 抽卡
|
||||
1. Method: POST
|
||||
|
@ -33,15 +33,22 @@ export default class HeroController extends BaseController {
|
||||
throw new ZError(101, '未指定heroid');
|
||||
}
|
||||
try {
|
||||
let hero;
|
||||
if (!type) {
|
||||
let hero = await account.unlockHero(heroid);
|
||||
hero = await account.unlockHero(heroid);
|
||||
await account.save();
|
||||
return hero;
|
||||
hero.owned = true;
|
||||
hero.ban = false;
|
||||
hero.usetype = 0;
|
||||
} else {
|
||||
let hero = await account.tryHero(heroid);
|
||||
hero = await account.tryHero(heroid);
|
||||
await account.save();
|
||||
return hero;
|
||||
hero.owned = false;
|
||||
hero.ban = false;
|
||||
hero.usetype = 0;
|
||||
hero.free_expire = 0;
|
||||
}
|
||||
return hero;
|
||||
} catch (err) {
|
||||
throw err;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user