修改匹配逻辑
This commit is contained in:
parent
21b9af6a28
commit
8baf552479
@ -23,8 +23,8 @@ export function getCardGroup(accountid: string, heroid: number, cardgroup: strin
|
||||
})
|
||||
}
|
||||
|
||||
export function getUserInfo(accountid: string) {
|
||||
return axios.get(`${ config.info_svr }/${ accountid }/uinfo`)
|
||||
export function getUserInfo(accountid: string, isMatch: boolean) {
|
||||
return axios.post(`${ config.info_svr }/${ accountid }/uinfo`, {isMatch})
|
||||
.then(function (response) {
|
||||
let res = response.data
|
||||
if (res.errcode) {
|
||||
@ -123,7 +123,8 @@ export async function checkMatchTicket(accountid: string, matchid: string) {
|
||||
return axios(reqConfig).then(function (response) {
|
||||
let res = response.data
|
||||
if (res.errcode) {
|
||||
throw new Error(res.errmsg)
|
||||
error(`check match ticket error with code: ${res.errcode}, msg: ${res.errmsg}`)
|
||||
throw new Error(res.errcode)
|
||||
} else {
|
||||
return {}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ import { Client, generateId, matchMaker, Room, ServerError } from 'colyseus'
|
||||
import { BaseConst } from '../constants/BaseConst'
|
||||
import { IncomingMessage } from 'http'
|
||||
import { checkMatchTicket } from '../common/WebApi'
|
||||
import { error } from '../common/Debug'
|
||||
|
||||
interface MatchmakingGroup {
|
||||
averageRank: number;
|
||||
@ -91,7 +92,8 @@ export class RankedLobbyRoom extends Room {
|
||||
try {
|
||||
await checkMatchTicket(accountid, this.matchid)
|
||||
} catch (err) {
|
||||
throw new ServerError(11, 'not enough ticket')
|
||||
let code = isNaN(err.message) ? 9: parseInt(err.message)
|
||||
throw new ServerError(code, 'not enough ticket')
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ export class OnJoinCommand extends Command<CardGameState, {
|
||||
this.state.players.set(client.sessionId, player);
|
||||
let uinfo: {nickname: string, avatar: string, score: number, accountid: string}
|
||||
if (accountId && accountId != 'robot') {
|
||||
uinfo = await getUserInfo(accountId)
|
||||
uinfo = await getUserInfo(accountId, !!this.room.match)
|
||||
} else {
|
||||
const fc = global.$cfg.get(BaseConst.FORMULA);
|
||||
let low = (this.room.score * fc.get(70034).number / 100) | 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user