将开始匹配接口改为服务端调用

This commit is contained in:
zhl 2021-01-22 14:08:11 +08:00
parent 5baf4ddeb5
commit 32f91d29cd
2 changed files with 24 additions and 28 deletions

View File

@ -479,32 +479,6 @@
``` ```
### 18. 开始比赛
1. Method: POST
2. URI: /api/:accountid/beginmatch
| 字段 | 说明 |
| -------- | -------------------------------------- |
| accountid | 帐号id |
> POST参数
| 字段 | 说明 |
| -------- | -------------------------------------- |
| matchid |10_match.xlsx里的id |
3. Response: JSON
```js
{
ticket: '123123123' //匹配的时候须带上此ticket
}
```
@ -525,6 +499,28 @@
``` ```
### 2. 开始比赛
1. Method: POST
2. URI: /svr/:accountid/beginmatch
| 字段 | 说明 |
| -------- | -------------------------------------- |
| accountid | 帐号id |
> POST参数
| 字段 | 说明 |
| -------- | -------------------------------------- |
| matchid |10_match.xlsx里的id |
3. Response: JSON
```js
```

View File

@ -7,7 +7,7 @@ import { BagItem } from '../models/BagItem'
export default class MatchController extends BaseController { export default class MatchController extends BaseController {
@router('post /api/:accountid/beginmatch') @router('post /svr/:accountid/beginmatch')
async beginMatch(req: any) { async beginMatch(req: any) {
let {accountid, matchid} = req.params let {accountid, matchid} = req.params
let cfg: MatchCfg = global.$cfg.get(BaseConst.MATCH).get(matchid << 0) let cfg: MatchCfg = global.$cfg.get(BaseConst.MATCH).get(matchid << 0)
@ -26,6 +26,6 @@ export default class MatchController extends BaseController {
} }
record.count -= count record.count -= count
await record.save() await record.save()
return {ticket: '123123123123'} return {}
} }
} }