Example #1
0
 def _moveHall51DataBack(self, userId, gameId, clientId):
     try:
         flag = DaoGameDataHall.HGET(userId, 'userChipMoveGame')
         ftlog.info('_moveHall51DataBack', userId, gameId, flag)
         if flag > 0:
             # 当前用户登录过HALL51
             chip, exp, charm, coupon = DaoGameDataHall.HMGET(
                 userId, ['chip', 'exp', 'charm', 'coupon'])
             chip, exp, charm, coupon = ftstr.parseInts(
                 chip, exp, charm, coupon)
             ftlog.info('_moveHall51DataBack data->', userId, gameId, chip,
                        exp, charm, coupon)
             if charm > 0:
                 self.incrCharm(userId, charm)
             if exp > 0:
                 self.incrExp(userId, exp)
             if coupon > 0:
                 trueDelta, finalCount = self.incrCoupon(
                     userId, gameId, coupon, ChipNotEnoughOpMode.NOOP,
                     'SYSTEM_REPAIR', 0)
                 ftlog.info('_moveHall51DataBack data coupon->', userId,
                            gameId, coupon, trueDelta, finalCount)
             if chip > 0:
                 trueDelta, finalCount = self.incrChip(
                     userId, gameId, chip, ChipNotEnoughOpMode.NOOP,
                     'SYSTEM_REPAIR', 0)
                 ftlog.info('_moveHall51DataBack data chip->', userId,
                            gameId, chip, trueDelta, finalCount)
             DaoGameDataHall.HDEL(
                 userId,
                 ['chip', 'exp', 'charm', 'coupon', 'userChipMoveGame'])
             pluginCross.halldatanotify.sendDataChangeNotify(
                 userId, gameId, 'chip')
     except:
         ftlog.error()
Example #2
0
def notifyChargeOk(userId, gameId, clientId):
    '''
    处理充值成功事件
    
    获取用户的loc,如果在gameId游戏中,则想改游戏的牌桌发送充值成功的消息
    '''
    truelocs, _onTableIds = pluginCross.onlinedata.checkUserLoc(
        userId, clientId, gameId)
    ftlog.debug('MajiangQuickStartCoin.onCmdQuickStart checkUserLoc:',
                truelocs)
    for loc in truelocs:
        lgameId, lroomId, ltableId, lseatId = loc.split('.')
        lgameId, lroomId, ltableId, lseatId = ftstr.parseInts(
            lgameId, lroomId, ltableId, lseatId)
        if lgameId != gameId:
            return

        if lroomId > 0 and ltableId > 0:
            #             mo = MsgPack()
            #             mo.setCmd('table_manage')
            #             mo.setAction('charge_success')
            #             mo.setParam('userId', userId)
            #             mo.setParam('clientId', clientId)
            #             mo.setParam('roomId', lroomId)
            #             mo.setParam('tableId', ltableId)
            gameRpcRoomOne.srvroom.doUserChangeDone(lroomId, ltableId, userId,
                                                    clientId, 0)
Example #3
0
    def recoverUserTableChips(self, userId, onTableIds, intClientId):
        deltaChips = 0
        try:
            tableChips = pluginCross.halldata.getTableChipDict(userId)
            ftlog.debug('recoverUserTableChips->tableChips=', tableChips,
                        'onTableIds=', onTableIds)
            delTablesIds = []
            for tableId, tchip in tableChips.iteritems():
                tableId, tchip = ftstr.parseInts(tableId, tchip)
                if tableId in onTableIds:
                    # the user is on the table, do not clear
                    pass
                else:
                    if tchip > 0:
                        troomId = tableId / tyconfig.MAX_TABLE_ID
                        gameId = troomId / tyconfig.MAX_ROOM_ID / tyconfig.MAX_ROOM_ID / tyconfig.MAX_CONFIG_ID
                        ftlog.info('recoverUserTableChips->userId=', userId,
                                   'gameId=', gameId, 'troomId=', troomId,
                                   'tableId=', tableId, 'tchip=', tchip)
                        _, _, delta = pluginCross.halldata.moveAllTableChipToChip(
                            userId, gameId, 'TABLE_TCHIP_TO_CHIP', troomId,
                            intClientId, tableId)
                        deltaChips += delta
                    delTablesIds.append(tableId)

            if delTablesIds:
                ftlog.info('recoverUserTableChips->delTableChips=', userId,
                           'delTablesIds=', delTablesIds)
                pluginCross.halldata.delTableChips(userId, delTablesIds)
        except:
            ftlog.error()
        return deltaChips
Example #4
0
    def _conform(self, gameId, userId, clientId, item, timestamp, params):

        flagName = 'item.open.flag:%s' % (item.kindId)
        if gameId == tyglobal.gameId():
            value = pluginCross.halldata.getHallDataList(userId, flagName)
        else:
            value = _getSubGameDataVal(gameId, userId, flagName)

        if ftstr.parseInts(value) == 1:
            return True
        return False
Example #5
0
def doJoinCreateTable(userId, gameId, clientId, roomId0, tableId0, playMode,
                      msg):
    """用户加入自建牌桌
    """
    loc = onlinedata.checkUserLoc(userId, clientId, gameId)
    lgameId, lroomId, ltableId, lseatId = loc.split('.')
    lgameId, lroomId, ltableId, lseatId = ftstr.parseInts(
        lgameId, lroomId, ltableId, lseatId)
    if lgameId > 0 and lroomId > 0 and ltableId > 0 and lseatId >= 0:
        ftlog.warn('create_table error, user in table')
        sendPopTipMsg(userId, "请稍候,正在进桌...")
        config = {
            "type": "quickstart",
            "pluginParams": {
                "roomId": lroomId,
                "tableId": ltableId,
                "seatId": lseatId
            }
        }
        todotask = TodoTaskEnterGameNew(lgameId, config)
        mo = MsgPack()
        mo.setCmd('todo_tasks')
        mo.setResult('gameId', gameId)
        mo.setResult('pluginId', lgameId)
        mo.setResult('userId', userId)
        mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
        tyrpcconn.sendToUser(userId, mo)
    else:
        createTableNo = msg.getParam('createTableNo', 0)
        if not createTableNo:
            return
        tableId0, roomId0 = CreateTableData.getTableIdByCreateTableNo(
            createTableNo)
        if not tableId0 or not roomId0:
            sendPopTipMsg(userId, "找不到您输入的房间号")
            return
        msg1 = MsgPack()
        msg1.setParam("shadowRoomId", roomId0)
        msg1.setParam("roomId", roomId0)
        msg1.setParam("tableId", tableId0)
        msg1.setParam("createTableNo", createTableNo)
        msg1.setCmdAction("room", "join_create_table")
        router.sendRoomServer(msg1, roomId0)
Example #6
0
def doCreateTable(userId,
                  gameId,
                  clientId,
                  roomId0,
                  tableId0,
                  playMode,
                  hasRobot=0,
                  msg=None):
    """房主创建牌桌"""
    if not playMode:
        ftlog.error('game_handler, cat not create table without playMode...')

    loc = onlinedata.checkUserLoc(userId, clientId, gameId)
    lgameId, lroomId, ltableId, lseatId = loc.split('.')
    lgameId, lroomId, ltableId, lseatId = ftstr.parseInts(
        lgameId, lroomId, ltableId, lseatId)
    if lgameId > 0 and lroomId > 0 and ltableId > 0 and lseatId >= 0:
        ftlog.warn('create_table error, user in table', lgameId, lroomId,
                   ltableId, lseatId)
        sendPopTipMsg(userId, "请稍候,正在进桌...")
        config = {
            "type": "quickstart",
            "pluginParams": {
                "roomId": lroomId,
                "tableId": ltableId,
                "seatId": lseatId
            }
        }
        todotask = TodoTaskEnterGameNew(lgameId, config)
        mo = MsgPack()
        mo.setCmd('todo_tasks')
        mo.setResult('gameId', gameId)
        mo.setResult('pluginId', lgameId)
        mo.setResult('userId', userId)
        mo.setResult('tasks', TodoTaskHelper.encodeTodoTasks(todotask))
        router.sendToUser(mo, userId)
    elif _canEnterGame(userId, gameId):
        # 保存建桌时间戳
        gamedata.setGameAttr(userId, gameId, 'createTableTime',
                             fttime.getCurrentTimestamp())

        itemParams = msg.getParam("itemParams")

        playerCount = 4
        playerTypeId = itemParams.get(MFTDefine.PLAYER_TYPE, 1)
        playerTypeConfig = majiang_conf.getCreateTableConfig(
            gameId, playMode, MFTDefine.PLAYER_TYPE, playerTypeId)
        if not playerTypeConfig:
            ftlog.info('MajiangCreateTable.doCreateTable playerTypeId:',
                       playerTypeId, ' playerTypeConfig:', playerTypeConfig)

            sendPopTipMsg(userId, '人数配置有误,请稍后重试')
            return

        playerCount = playerTypeConfig.get('count', 4)
        ftlog.debug('MajiangCreateTable.create_table playerCount:',
                    playerCount)
        cardCountKey = playerTypeConfig.get(MFTDefine.CARD_COUNT,
                                            MFTDefine.CARD_COUNT)

        cardCountId = itemParams.get(cardCountKey, 0)
        cardCountConfig = majiang_conf.getCreateTableConfig(
            gameId, playMode, cardCountKey, cardCountId)
        if not cardCountConfig:
            sendPopTipMsg(userId, '房卡配置有误,请稍后重试')
            return

        if hasRobot == 1 and 'hasRobot' in cardCountConfig:
            cardCountConfig = cardCountConfig.get('hasRobot', {})
            ftlog.debug('MajiangCreateTable.create_table hasRobot == 1:')
        fangka_count = cardCountConfig.get('fangka_count', 1)
        ftlog.debug('MajiangCreateTable.create_table fangka_count:',
                    fangka_count, ' cardCountConfig:', cardCountConfig)

        msg.setParam('isCreateTable', 1)  # 标记创建的桌子是 自建桌
        '''
        根据五个因素筛选合适的房间
        1)gameId         游戏ID
        2)playMode       游戏玩法
        3)playerCount    玩家个数
        4)hasRobot       是否有机器人
        5)itemId         房卡道具
        '''
        itemId = hall_fangka.queryFangKaItem(gameId, userId, clientId)
        if itemId:
            ftlog.debug('MajiangCreateTable._chooseCreateRoom fangKa itemId:',
                        itemId)
        roomId, checkResult = MajiangCreateTable._chooseCreateRoom(
            userId, gameId, playMode, playerCount, hasRobot, itemId)
        ftlog.debug('MajiangCreateTable._chooseCreateRoom roomId:', roomId,
                    ' checkResult:', checkResult)

        if checkResult == TYRoom.ENTER_ROOM_REASON_OK:
            msg1 = MsgPack()
            msg1.setCmdAction("room", "create_table")
            msg1.setParam("roomId", roomId)
            msg1.setParam("itemParams", itemParams)
            msg1.setParam('needFangka', fangka_count)
            ftlog.debug(
                'MajiangCreateTable._chooseCreateRoom send message to room:',
                msg1)

            router.sendRoomServer(msg1, roomId)
        else:
            sendPopTipMsg(userId, "暂时无法创建请稍后重试")

    else:
        ftlog.info('majiang2 game_handler, ignore enter game request...')
Example #7
0
    def onCmdQuickStart(cls, msg, userId, gameId, roomId, tableId, playMode,
                        clientId):
        '''UT server中处理来自客户端的quick_start请求  
        Args:
            msg
                cmd : quick_start
                if roomId == 0:
                    表示快速开始,服务器为玩家选择房间,然后将请求转给GR

                if roomId > 0 and tableId == 0 : 
                    表示玩家选择了房间,将请求转给GR

                if roomId > 0 and tableId == roomId * 10000 :
                    表示玩家在队列里断线重连,将请求转给GR

                if roomId > 0 and tableId > 0:
                    if onlineSeatId > 0: 
                        表示玩家在牌桌里断线重连,将请求转给GT
                    else:
                        表示玩家选择了桌子,将请求转给GR
        '''
        assert isinstance(userId, int) and userId > 0
        assert isinstance(roomId, int) and roomId >= 0
        assert isinstance(tableId, int) and tableId >= 0

        if ftlog.is_debug():
            ftlog.debug("<< |clientId:",
                        clientId,
                        "|userId, roomId, tableId:",
                        userId,
                        roomId,
                        tableId,
                        "|gameId, playMode:",
                        gameId,
                        playMode,
                        caller=cls)

        # 单开, 无论何时quick_start进入都检查loc
        if not pokerconf.isOpenMoreTable(clientId):
            truelocs, _onTableIds = pluginCross.onlinedata.checkUserLoc(
                userId, clientId, gameId)
            if ftlog.is_debug():
                ftlog.debug('old client, checkUserLoc->', truelocs, caller=cls)
            for loc in truelocs:
                lgameId, lroomId, ltableId, lseatId = loc.split('.')
                lgameId, lroomId, ltableId, lseatId = ftstr.parseInts(
                    lgameId, lroomId, ltableId, lseatId)

                #                 if gameId == 60 and lgameId != gameId and lroomId > 0:
                #                     try:
                #                         ftlog.info("gtServerRpc.doPlayerLeave:", lgameId, userId, lroomId, ltableId, lseatId)
                #                         gtServerRpc.doPlayerLeave(lgameId, userId, lroomId, ltableId, lseatId, clientId)
                #                     except Exception as e:
                #                         ftlog.error(e)
                if lgameId == gameId and lroomId > 0:
                    ftlog.debug('onCmdQuickStart re-connected |userId, loc:',
                                userId,
                                loc,
                                '|roomId, tableId:',
                                roomId,
                                tableId,
                                caller=cls)
                    roomId = lroomId
                    tableId = ltableId
                    msg.setParam('isReConnected', True)
                    if ftlog.is_debug():
                        ftlog.debug('old client, reset roomId, tableId->',
                                    roomId,
                                    tableId,
                                    caller=cls)

        if roomId == 0:  # 玩家点击快速开始
            chosenRoomId, checkResult = cls._chooseRoom(
                userId, gameId, playMode)
            ftlog.debug("after choose room",
                        "|userId, chosenRoomId, checkResult:",
                        userId,
                        chosenRoomId,
                        checkResult,
                        caller=cls)
            if checkResult == TYRoom.ENTER_ROOM_REASON_OK:
                TYRoomMixin.queryRoomQuickStartReq(msg, chosenRoomId,
                                                   0)  # 请求转给GR
            else:
                candidateRoomIds = cls._getCandidateRoomIds(gameId, playMode)
                if candidateRoomIds:
                    rid = candidateRoomIds[0]
                    msg.setParam('candidateRoomId', rid)
                cls._onEnterRoomFailed(msg, checkResult, userId, clientId,
                                       roomId)
            return

        bigRoomId = tyconfig.getBigRoomId(roomId)
        ftlog.debug('bigRoomId:', bigRoomId)
        if bigRoomId == 0:
            cls._onEnterRoomFailed(msg, TYRoom.ENTER_ROOM_REASON_ROOM_ID_ERROR,
                                   userId, clientId, roomId)
            return

        if tyconfig.getRoomGameId(bigRoomId) != gameId:
            cls._onEnterRoomFailed(msg, TYRoom.ENTER_ROOM_REASON_ROOM_ID_ERROR,
                                   userId, clientId, roomId)
            return

        if tableId == 0:  # 玩家只选择了房间
            #             if gameId == 6 and roomId != bigRoomId:
            #                 ctrlRoomId = tyconfig.getRoomDefine(roomId).parentId or roomId
            #                 queryRoomId = roomId
            #             else:
            ctrRoomIds = tyconfig.getControlRoomIds(bigRoomId)
            ctrlRoomId = ctrRoomIds[userId % len(ctrRoomIds)]
            queryRoomId = ctrlRoomId
            reason = cls._canQuickEnterRoom(userId, gameId, ctrlRoomId, 1)
            if reason == TYRoom.ENTER_ROOM_REASON_OK:
                #                 if gameId == 6:
                #                     TYRoomMixin.queryRoomQuickStartReq(msg, queryRoomId, 0)  # 请求转给GR或GT
                #                 else:
                TYRoomMixin.queryRoomQuickStartReq(msg, ctrlRoomId,
                                                   0)  # 请求转给GR或GT
            elif reason == TYRoom.ENTER_ROOM_REASON_LESS_MIN or reason == TYRoom.ENTER_ROOM_REASON_GREATER_MAX:
                #                 if gameId == 6:
                #                     innerTable = msg.getParam("innerTable", 0)  # innerTable 区分不同版本弹窗
                #                     if innerTable == 1:
                #                         roomDef = tyconfig.getRoomDefine(ctrlRoomId)
                #                         playMode = roomDef.configure.get('playMode', None)
                #                         if ftlog.is_debug():
                #                             ftlog.debug('enter_less_min userId=', userId, 'roomId=', ctrlRoomId, 'msg=', msg, 'playmode=', playMode)
                #                         msgpack = MsgPack()
                #                         msgpack.setCmd("quick_start")
                #                         msgpack.setParam("userId", userId)
                #                         msgpack.setParam("gameId", gameId)
                #                         msgpack.setParam("clientId", clientId)
                #                         msgpack.setParam("innerTable", 1)
                #                         msgpack.setParam("apiver", msg.getParam("apiver", 3.7))
                #                         cls.onCmdQuickStart(msgpack, userId, gameId, 0, 0, playMode, clientId)
                #                         if ftlog.is_debug():
                #                             ftlog.debug('reenter_less_min userId=', userId, 'roomId=', ctrlRoomId, 'msgpack=', msgpack.pack())
                #                     else:
                #                         cls._onEnterRoomFailed(msg, reason, userId, clientId, roomId)
                #                 else:
                cls._onEnterRoomFailed(msg, reason, userId, clientId, roomId)
            else:
                cls._onEnterRoomFailed(msg, reason, userId, clientId, roomId)
            return

        if tableId == roomId * 10000:  # 玩家在队列里断线重连
            TYRoomMixin.queryRoomQuickStartReq(msg, roomId, tableId)  # 请求转给GR
            return

        onlineSeat = pluginCross.onlinedata.getOnLineLocSeatId(
            userId, roomId, tableId)

        if onlineSeat:
            if onlineSeat == tyconfig.getRoomDefine(
                    roomId).configure['tableConf']['maxSeatN'] + 1:
                # 牌桌里旁观的玩家断线重连,请求转给GT
                TYRoomMixin.sendTableCallObserveReq(userId, roomId, tableId,
                                                    clientId)
            else:
                # 牌桌里坐着的玩家断线重连,请求转给GT
                # TYRoomMixin.querySitReq(userId, roomId, tableId, clientId) # GT人多时会有超时异常
                TYRoomMixin.sendSitReq(userId, roomId, tableId, clientId)
        else:  # 玩家选择了桌子,
            shadowRoomId = tyconfig.getTableRoomId(tableId)
            ctrRoomId = tyconfig.getRoomDefine(shadowRoomId).parentId
            TYRoomMixin.queryRoomQuickStartReq(
                msg, ctrRoomId, tableId, shadowRoomId=shadowRoomId)  # 请求转给GR
Example #8
0
    def onCmdQuickStart(cls, msg, userId, gameId, roomId, tableId, playMode,
                        clientId):
        '''UT server中处理来自客户端的quick_start请求  
        Args:
            msg
                cmd : quick_start
                if roomId == 0:
                    表示快速开始,服务器为玩家选择房间,然后将请求转给GR
                    
                if roomId > 0 and tableId == 0 : 
                    表示玩家选择了房间,将请求转给GR
                    
                if roomId > 0 and tableId == roomId * 10000 :
                    表示玩家在队列里断线重连,将请求转给GR
                    
                if roomId > 0 and tableId > 0:
                    if onlineSeatId > 0: 
                        表示玩家在牌桌里断线重连,将请求转给GT
                    else:
                        表示玩家选择了桌子,将请求转给GR
        '''
        assert isinstance(userId, int) and userId > 0
        assert isinstance(roomId, int) and roomId >= 0
        assert isinstance(tableId, int) and tableId >= 0
        ftlog.debug("MajiangQuickStartFriend.onCmdQuickStart clientId:",
                    clientId, " userId:", userId, " roomId:", roomId,
                    " tableId:", tableId, " gameId:", gameId, " playMode:",
                    playMode)

        tableId = 0
        # 单开, 无论何时quick_start进入都检查loc
        if not pokerconf.isOpenMoreTable(clientId):
            truelocs, _onTableIds = pluginCross.onlinedata.checkUserLoc(
                userId, clientId, gameId)
            ftlog.debug(
                'MajiangQuickStartFriend.onCmdQuickStart checkUserLoc:',
                truelocs,
                caller=cls)
            for loc in truelocs:
                lgameId, lroomId, ltableId, lseatId = loc.split('.')
                lgameId, lroomId, ltableId, lseatId = ftstr.parseInts(
                    lgameId, lroomId, ltableId, lseatId)
                if lgameId == gameId and lroomId > 0 and isFriendRoom(lroomId):
                    roomId = lroomId
                    tableId = ltableId
                    ftlog.debug(
                        'MajiangQuickStartFriend.onCmdQuickStart old client roomId:',
                        roomId,
                        ' tableId:',
                        tableId,
                        caller=cls)

        if roomId > 0 and tableId > 0:
            onlineSeat = pluginCross.onlinedata.getOnlineLocSeatId(
                userId, roomId, tableId)
            if onlineSeat:
                extParam = {}
                extParam['seatId'] = onlineSeat
                moParams = msg.getKey('params')
                for k, v in moParams.items():
                    if not k in extParam:
                        extParam[k] = v
                ftlog.debug('extParam=', extParam)
                TYRoomMixin.querySitReq(userId, roomId, tableId, clientId,
                                        extParam)  # 玩家断线重连,请求转给GT
            return

        ftlog.debug(
            'MajiangQuickStartFriend.onCmdQuickStart friendTable not isReconnect or roomId == 0 or tableId == 0, dissolved'
        )
        cls._onEnterRoomFailed(msg, TYRoom.ENTER_ROOM_REASON_FRIEND_DISSOLVE,
                               userId, clientId, roomId)
Example #9
0
    def onCmdQuickStart(cls, msg, userId, gameId, roomId, tableId, playMode,
                        clientId):
        '''UT server中处理来自客户端的quick_start请求  
        Args:
            msg
                cmd : quick_start
                if roomId == 0:
                    表示快速开始,服务器为玩家选择房间,然后将请求转给GR
                    
                if roomId > 0 and tableId == 0 : 
                    表示玩家选择了房间,将请求转给GR
                    
                if roomId > 0 and tableId == roomId * 10000 :
                    表示玩家在队列里断线重连,将请求转给GR
                    
                if roomId > 0 and tableId > 0:
                    if onlineSeatId > 0: 
                        表示玩家在牌桌里断线重连,将请求转给GT
                    else:
                        表示玩家选择了桌子,将请求转给GR
        '''
        assert isinstance(userId, int) and userId > 0
        assert isinstance(roomId, int) and roomId >= 0
        assert isinstance(tableId, int) and tableId >= 0
        ftlog.debug("MajiangQuickStartCoin.onCmdQuickStart clientId:",
                    clientId, " userId:", userId, " roomId:", roomId,
                    " tableId:", tableId, " gameId:", gameId, " playMode:",
                    playMode)

        gTimeStamp = pluginCross.mj2dao.getQuickStartCoinTimeStamp(userId)
        cTimeStamp = time.time()
        ftlog.debug('MajiangQuickStartCoin.onCmdQuickStart gTimeStamp:',
                    gTimeStamp, 'cTimeStamp:', cTimeStamp)
        # 判断两次quick_start间隔是否超过5秒,没有超过5秒,则不匹配
        if cTimeStamp - gTimeStamp < 3:
            ftlog.debug(
                'MajiangQuickStartCoin.onCmdQuickStart cTimeStamp - gTimeStamp < 5 !!!'
            )
            return

        # 单开, 无论何时quick_start进入都检查loc
        if not pokerconf.isOpenMoreTable(clientId):
            truelocs, _onTableIds = pluginCross.onlinedata.checkUserLoc(
                userId, clientId, gameId)
            ftlog.debug('MajiangQuickStartCoin.onCmdQuickStart checkUserLoc:',
                        truelocs,
                        caller=cls)
            for loc in truelocs:
                lgameId, lroomId, ltableId, lseatId = loc.split('.')
                lgameId, lroomId, ltableId, lseatId = ftstr.parseInts(
                    lgameId, lroomId, ltableId, lseatId)
                if lgameId == gameId and lroomId > 0:
                    roomId = lroomId
                    tableId = ltableId
                    ftlog.debug(
                        'MajiangQuickStartCoin.onCmdQuickStart old client roomId:',
                        roomId,
                        ' tableId:',
                        tableId,
                        caller=cls)

        if roomId == 0:  # 玩家点击快速开始
            chosenRoomId, checkResult = cls._chooseRoom(
                userId, gameId, playMode)
            ftlog.info(
                "MajiangQuickStartCoin.onCmdQuickStart after choose room userId:",
                userId,
                " chosenRoomId:",
                chosenRoomId,
                " checkResult:",
                checkResult,
                caller=cls)
            if checkResult == TYRoom.ENTER_ROOM_REASON_OK:
                # 找到合适的房间 根据roomId找到合适的table
                TYRoomMixin.queryRoomQuickStartReq(msg, chosenRoomId,
                                                   0)  # 请求转给GR
                cls.saveQuickStartTime(userId, gameId, cTimeStamp)
            else:
                candidateRoomIds = cls._getCandidateRoomIds(gameId, playMode)
                if candidateRoomIds:
                    rid = candidateRoomIds[0]
                    msg.setParam('candidateRoomId', rid)
                cls._onEnterRoomFailed(msg, checkResult, userId, clientId,
                                       roomId)
            return

        if tableId == 0:  # 玩家只选择了房间
            bigRoomId = tyconfig.getBigRoomId(roomId)
            ftlog.debug('MajiangQuickStartCoin.onCmdQuickStart bigRoomId:',
                        bigRoomId)
            if bigRoomId == 0:
                cls._onEnterRoomFailed(msg,
                                       TYRoom.ENTER_ROOM_REASON_ROOM_ID_ERROR,
                                       userId, gameId, clientId, roomId)
                return

            ctrRoomIds = tyconfig.getControlRoomIds(bigRoomId)
            ctrlRoomId = ctrRoomIds[userId % len(ctrRoomIds)]
            qsParams = msg.getParam('where', 'roomlist')
            reason = cls._canQuickEnterRoom(userId, gameId, ctrlRoomId, True,
                                            qsParams)
            ftlog.debug('MajiangQuickStartCoin.onCmdQuickStart reason:',
                        reason, 'ctrRoomIds:', ctrRoomIds, 'ctrlRoomId',
                        ctrlRoomId)
            if reason == TYRoom.ENTER_ROOM_REASON_OK:
                TYRoomMixin.queryRoomQuickStartReq(msg, ctrlRoomId,
                                                   0)  # 请求转给GR或GT
                cls.saveQuickStartTime(userId, gameId, cTimeStamp)
            else:
                cls._onEnterRoomFailed(msg, reason, userId, gameId, clientId,
                                       roomId, playMode)
            return

        if tableId == roomId * 10000:  # 玩家在队列里断线重连
            ftlog.debug('MajiangQuickStartCoin.onCmdQuickStart tableId:',
                        tableId)
            TYRoomMixin.queryRoomQuickStartReq(msg, roomId, tableId)  # 请求转给GR
            cls.saveQuickStartTime(userId, gameId, cTimeStamp)
            return

        onlineSeat = pluginCross.onlinedata.getOnLineLocSeatId(
            userId, roomId, tableId)

        if onlineSeat:
            ftlog.debug('MajiangQuickStartCoin.onCmdQuickStart tableId:',
                        tableId)
            extParam = {}
            extParam['seatId'] = onlineSeat
            moParams = msg.getKey('params')
            for k, v in moParams.items():
                if not k in extParam:
                    extParam[k] = v
            ftlog.debug('extParam=', extParam)
            TYRoomMixin.querySitReq(userId, roomId, tableId, clientId,
                                    extParam)  # 玩家断线重连,请求转给GT
            cls.saveQuickStartTime(userId, gameId, cTimeStamp)
        else:  # 玩家选择了桌子,
            ftlog.debug('MajiangQuickStartCoin.onCmdQuickStart tableId:',
                        tableId)
            shadowRoomId = tyconfig.getTableRoomId(tableId)
            ctrRoomId = tyconfig.getRoomDefine(shadowRoomId).parentId
            TYRoomMixin.queryRoomQuickStartReq(
                msg, ctrRoomId, tableId, shadowRoomId=shadowRoomId)  # 请求转给GR
            cls.saveQuickStartTime(userId, gameId, cTimeStamp)