This commit is contained in:
yuexin 2021-03-12 18:16:17 +08:00
commit 6568dcd59b

View File

@ -4,13 +4,13 @@ import { BaseConst } from '../constants/BaseConst'
import { ZError } from '../common/ZError' import { ZError } from '../common/ZError'
import { MatchCfg } from '../cfg/parsers/MatchCfg' import { MatchCfg } from '../cfg/parsers/MatchCfg'
import { BagItem } from '../models/BagItem' import { BagItem } from '../models/BagItem'
import { checkGameing, setGameing } from '../service/rank' import { checkGameing, setGameEnd } from '../service/rank'
export default class MatchController extends BaseController { export default class MatchController extends BaseController {
@router('post /svr/: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)
if (!cfg || !cfg.consume) { if (!cfg || !cfg.consume) {
throw new ZError(10, 'match not found') throw new ZError(10, 'match not found')
@ -33,4 +33,12 @@ export default class MatchController extends BaseController {
return {} 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 {}
}
} }