diff --git a/src/controllers/MatchController.ts b/src/controllers/MatchController.ts index 09dc6e7..e8fa2b5 100644 --- a/src/controllers/MatchController.ts +++ b/src/controllers/MatchController.ts @@ -4,13 +4,13 @@ import { BaseConst } from '../constants/BaseConst' import { ZError } from '../common/ZError' import { MatchCfg } from '../cfg/parsers/MatchCfg' import { BagItem } from '../models/BagItem' -import { checkGameing, setGameing } from '../service/rank' +import { checkGameing, setGameEnd } from '../service/rank' export default class MatchController extends BaseController { @router('post /svr/:accountid/beginmatch') 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) if (!cfg || !cfg.consume) { throw new ZError(10, 'match not found') @@ -33,4 +33,12 @@ export default class MatchController extends BaseController { return {} } + @router('post /svr/:accountid/leftgame') + async userLeft(req: any) { + let { accountid, roomid } = req.params + console.log(`${roomid} player ${accountid} left game manul`) + await setGameEnd(accountid) + return {} + } + }