增加获取赛季详情的接口

This commit is contained in:
zhl 2021-01-18 20:07:19 +08:00
parent 12d79a7958
commit 3b30c5886b
3 changed files with 55 additions and 2 deletions

View File

@ -53,6 +53,7 @@
season_rank: 1 // 当前赛季排名
match_score: 1000 //当前匹配分, 用于匹配时上传
season_score: 1000 // 排位分, 用于显示
season_data: {} // 当前赛季统计信息, 内容同接口11
}
```
@ -279,6 +280,41 @@
}
```
### 11. 赛季统计信息
1. Method: POST
2. URI: /api/:accountid/season_data
| 字段 | 说明 |
| -------- | -------------------------------------- |
| accountid | 帐号id |
3. Response: JSON
```json
{
"0": 477, //最高伤害
"1": 62, // 最高承伤
"2": 289, // 最高总战力
"3": 150, // 最高单体战力
"4": 6, // 最高每局胡牌数
"5": 0, // 每局最多送给队友抽牌数
"0_total": 1071.3, // 所有伤害积分
"1_total": 86, // 所有承伤积分
"2_total": 1302, // 最高总战力积分
"3_total": 1325, // 单体战力总积分
"4_total": 390, // 所有胡牌数
"5_total": 0, // 赠送牌数
"honor_ap": 4174.3, // 历史战功和
"mvp_ap": 4174.3, // mvp积分和
"win": 5, // 胜利场数,
"lost": 0, // 失败场数
"score": 1281.061909262327, // 当前天体分
"match_score": 2921.59286389349 // 当前匹配分
}
```
## 三. 服务端接口列表

View File

@ -60,16 +60,28 @@ export default class AccountController extends BaseController {
for(let [key, hero] of account.heros) {
heros.push(hero.toJson());
}
result.heros = heros;
await account.save();
result.moneys = account.moneys;
result.normal_stat= account.normal_stat;
result.extinfo = account.extinfo;
result.season_score = account.season_score;
result.season_data = account.season_data;
result.match_score = account.getMatchScore();
return result;
}
@router('post /api/:accountid/season_data')
async seasonData(req: any) {
let result: any = {};
let account = req.user;
for (let [key, val] of account.season_data) {
result[key] = val;
}
result.score = account.season_score;
result.match_score = account.getMatchScore();
return result;
}
@router('post /api/:accountid/cards')
async cardlist(req: any) {
let account = req.user;

View File

@ -96,7 +96,12 @@ export default class RecordController extends BaseController {
// @ts-ignore
let val = Number(statData[key]);
honorp += val * scores[numKey];
user.season_data.inc(key + '_total', val * scores[numKey]);
if (numKey == 4 || numKey == 5) {
user.season_data.inc(key + '_total', val);
} else {
user.season_data.inc(key + '_total', val * scores[numKey]);
}
if (user.season_data.has(key + '')) {
user.season_data.set(key + '', Math.max(user.season_data.get(key + ''), val))
} else {