修正排行榜第一个数字是空的bug

This commit is contained in:
zhl 2021-05-11 19:34:08 +08:00
parent d3eefdbc39
commit b0b14a13ed
3 changed files with 9 additions and 12 deletions

View File

@ -190,7 +190,7 @@
rankList: [
[
'account id', 帐号id
'rank', 排名
'score', 分数
'nickname', 昵称(暂无)
'avatar' 头像
]

View File

@ -6,8 +6,6 @@ import {
PuzzleStatusClass
} from '../../models/match/PuzzleSession'
import { ZError } from '../../common/ZError'
import { BaseConst } from '../../constants/BaseConst'
import { mission_vo } from '../../config/parsers/mission_vo'
import {
broadcast,
createRoom,
@ -21,18 +19,17 @@ import { Schedule } from '../../clock/Schedule'
import {
calcPvpScore,
calcSingleScore,
checkSingleFinish, fetchLevelCfg, fetchSinglePuzzleType, getRank,
checkSingleFinish,
fetchLevelCfg,
fetchSinglePuzzleType,
getRank,
startGame,
transformRecord, updateSingleRank
transformRecord,
updateSingleRank
} from '../../services/GameLogic'
import { ObjectId } from 'bson'
import { Shop } from '../../models/shop/Shop'
import { isObjectId } from '../../utils/string.util'
import {
getAccountRank,
getAccountScore,
getRankList
} from '../../services/Rank'
import { getAccountScore } from '../../services/Rank'
class PuzzleController extends BaseController {

View File

@ -161,7 +161,7 @@ export async function getRank({shop, level, accountId, mode, skip, limit }
const key = rankKey(shop, level, mode)
let datas: any = await getRankList(skip, limit, key)
// let scoreMap: Map<any, number> = new Map()
let rankList: [any[]] = [[]]
let rankList: [any[]] = []
for (let i = 0, l = datas.length; i < l; i += 2) {
// scoreMap.set(datas[i], datas[i + 1] << 0)
rankList.push([datas[i], datas[i + 1] << 0])