コード例 #1
0
ファイル: base_http_checker.py プロジェクト: zhaozw/hall37
 def _check_param_appId(self, key, params):
     appId = runhttp.getParamInt(key, 0)
     ftlog.debug('BaseHttpMsgChecker._check_param_appId key=', key,
                 'params=', params, 'appId=', appId, 'gameIds=',
                 gdata.gameIds())
     if not appId in gdata.gameIds():
         return 'param appId error', None
     return None, appId
コード例 #2
0
ファイル: base_http_checker.py プロジェクト: zhaozw/hall37
 def _check_param_appId(self, key, params):
     appId = runhttp.getParamInt(key, 0)
     ftlog.debug('BaseHttpMsgChecker._check_param_appId key=', key,
                 'params=', params,
                 'appId=', appId,
                 'gameIds=', gdata.gameIds())
     if not appId in gdata.gameIds():
         return 'param appId error', None
     return None, appId
コード例 #3
0
 def _check_param_appId(self, key, params):
     appId = runhttp.getParamInt(key, 0)
     if appId == 0:
         appId = runhttp.getParamInt('gameId', 0)
     if not appId in gdata.gameIds():
         return 'param appId error', None
     return None, appId
コード例 #4
0
ファイル: quick_start.py プロジェクト: zhaozw/hall37
 def _initCandidateRoomIds(cls):
     global _CANDIDATE_ROOM_IDS
     croomids = {}
     for gameId in gdata.gameIds():
         roomids = cls._initCandidateRoomIdsByGameId(gameId)
         croomids[gameId] = roomids
     _CANDIDATE_ROOM_IDS = croomids
コード例 #5
0
ファイル: httpmessage.py プロジェクト: zhaozw/hall37
 def _check_param_appId(self, key, params):
     appId = runhttp.getParamInt(key, 0)
     if appId == 0:
         appId = runhttp.getParamInt('gameId', 0)
     if not appId in gdata.gameIds():
         return 'param appId error', None
     return None, appId
コード例 #6
0
 def _collectInterestEventMap(self, taskKinds):
     interestEventMap = {}
     for taskKind in taskKinds:
         for eventType, gameIds in taskKind.inspector.interestEventMap.iteritems(
         ):
             gameIds = gameIds or gdata.gameIds()
             existsGameIds = interestEventMap.get(eventType)
             if not existsGameIds:
                 existsGameIds = set()
                 interestEventMap[eventType] = existsGameIds
             existsGameIds.update(gameIds)
     return interestEventMap
コード例 #7
0
ファイル: task.py プロジェクト: luningcowboy/tuyoo
    def _collect_event_map(cls, task_kinds):
        event_map = {}
        for task_kind in task_kinds:
            for event_type, gids in task_kind.inspector.interestEventMap.iteritems(
            ):
                gids = gids or gdata.gameIds()
                exists_gids = event_map.get(event_type)
                if not exists_gids:
                    exists_gids = set()
                    event_map[event_type] = exists_gids

                exists_gids.update(gids)
        return event_map
コード例 #8
0
ファイル: httphello.py プロジェクト: luningcowboy/tuyoo
    def doHelloTuyou(self):
        gameId = runhttp.getParamInt('gameId')
        clientId = runhttp.getParamStr('clientId', '')
        ftlog.debug('Hello->gameId=', gameId, 'clientId=', clientId)

        mo = MsgPack()
        mo.setCmd('hello')

        if gameId not in gdata.gameIds():
            mo.setError(1, 'gameId error !')
            ftlog.error('doHelloTuyou gameId error', runhttp.getDict())
            return mo

        try:
            clientIdInt = pokerconf.clientIdToNumber(clientId)
        except:
            clientIdInt = 0
            ftlog.error()

        if clientIdInt <= 0:
            mo.setError(2, 'clientId error !')
            ftlog.error('doHelloTuyou clientId error', runhttp.getDict())
            return mo

        nicaiCode = runhttp.getParamStr('nicaiCode', '')
        if not nicaiCode:
            mo.setError(3, 'nicai error !')
            ftlog.error('doHelloTuyou nicai error', runhttp.getDict())
            return mo
        # 1. 生存你猜CODE
        HelloTuyou.getNiCaiCode(mo, nicaiCode)

        # 2. 取得更新信息
        updateVersion = runhttp.getParamInt('updateVersion')
        alphaVersion = runhttp.getParamInt('alphaVersion', 0)
        HelloTuyou.getUpdataInfo(mo, gameId, clientId, updateVersion, alphaVersion)

        # 3. 静态配置文件的MD5和URL
        staticConf = hallconf.getUpgradeStaticConf()
        mo.updateResult(staticConf)

        # 4. 返回三方SDK的控制开关
        HelloTuyou.getThirdSwitches(mo, clientId)

        # 设置其他返回值
        mo.setResult('gameId', gameId)
        mo.setResult('clientId', clientId)

        return mo
コード例 #9
0
ファイル: account_handler.py プロジェクト: zhaozw/hall37
def updateOnLineInfos(event):
    if event.count % 10 != 0:
        return

    allcount = 0
    ucounts = {}
    for gameId in gdata.gameIds():
        count, _, _ = bireport.getRoomOnLineUserCount(gameId)
        allcount += count
        ucounts[gameId] = count
    ucounts[HALL_GAMEID] = allcount

    _ONLINES.clear()
    _ONLINES.update(ucounts)
    ftlog.debug('updateOnLineInfos->', _ONLINES)
コード例 #10
0
ファイル: account_handler.py プロジェクト: luningcowboy/tuyoo
def updateOnLineInfos(event):
    if event.count % 10 != 0 :
        return

    allcount = 0
    ucounts = {}
    for gameId in gdata.gameIds():
        count, _, _ = bireport.getRoomOnLineUserCount(gameId)
        allcount += count
        ucounts[gameId] = count
    ucounts[HALL_GAMEID] = allcount

    _ONLINES.clear()
    _ONLINES.update(ucounts)
    ftlog.debug('updateOnLineInfos->', _ONLINES)
コード例 #11
0
ファイル: task.py プロジェクト: zhaozw/hall37
 def _registerEvents(self):
     for taskKind in self._taskKindMap.values():
         for inspector in taskKind.inspectors:
             for eventType, gameIds in inspector.interestEventMap.iteritems():
                 gameIds = gameIds or gdata.gameIds()
                 for gameId in gameIds:
                     game = gdata.games().get(gameId)
                     if game:
                         game.getEventBus().subscribe(eventType, self._handleEvent)
                         self._addInterestEventType(eventType, gameId)
                         if ftlog.is_debug():
                             ftlog.debug('TYTaskSystemImpl._registerEvents eventType=', eventType,
                                         'gameId=', gameId,
                                         'taskUnitId=', taskKind.taskUnit.taskUnitId)
                     else:
                         ftlog.warn('TYTaskSystemImpl._registerEvents gameId=', gameId,
                                    'err=', 'Not find game')
コード例 #12
0
ファイル: hallaccount.py プロジェクト: luningcowboy/tuyoo
def getGameInfo(userId, clientId):
    '''
    取得当前用户的游戏账户信息dict
    '''
    ftlog.debug('hall.getGameInfo', userId, clientId)
    # 大厅游戏, 获取所有游戏的大师分
    gameids = hallconf.getDaShiFenFilter(clientId)
    allGameIds = gdata.gameIds()
    dashifen = {}
    i = 0
    for gid in gameids :
        if gid in allGameIds :
            infos = TYGame(gid).getDaShiFen(userId, clientId)
            if infos :
                infos['index'] = i
                dashifen[gid] = infos
                i = i + 1
    return {'dashifen' : dashifen}
コード例 #13
0
ファイル: hallaccount.py プロジェクト: zhaozw/hall37
def getGameInfo(userId, clientId):
    '''
    取得当前用户的游戏账户信息dict
    '''
    ftlog.debug('hall.getGameInfo', userId, clientId)
    # 大厅游戏, 获取所有游戏的大师分
    gameids = hallconf.getDaShiFenFilter(clientId)
    allGameIds = gdata.gameIds()
    dashifen = {}
    i = 0
    for gid in gameids:
        if gid in allGameIds:
            infos = TYGame(gid).getDaShiFen(userId, clientId)
            if infos:
                infos['index'] = i
                dashifen[gid] = infos
                i = i + 1
    return {'dashifen': dashifen}
コード例 #14
0
ファイル: httpgameupdate.py プロジェクト: luningcowboy/tuyoo
    def doGameUpdateInfo(self):
        gameId = runhttp.getParamInt('gameId')
        clientId = runhttp.getParamStr('clientId', '')
        version = runhttp.getParamStr('version', '')
        updateVersion = runhttp.getParamInt('updateVersion', -1)

        ftlog.debug('http gameupdateinfo IN->gameId=', gameId, 'clientId=',
                    clientId, 'version=', version, 'updateVersion=',
                    updateVersion)

        mo = MsgPack()
        mo.setCmd('gameupdateinfo')

        if gameId not in gdata.gameIds():
            mo.setError(1, 'gameId error !')
            return mo

        clientIdInt = pokerconf.clientIdToNumber(clientId)
        if clientIdInt <= 0:
            mo.setError(2, 'clientId error !')
            return mo

        if not version:
            mo.setError(3, 'version error !')
            return mo

        if updateVersion < 0:
            mo.setError(4, 'updateVersion error !')
            return mo

        updates = hall_game_update.getUpdateInfo2(gameId, version,
                                                  updateVersion)

        ftlog.debug('http gameupdateinfo OUT->updates=', updates)

        mo.setResult('gameId', gameId)
        mo.setResult('clientId', clientId)
        mo.setResult('version', version)
        mo.setResult('updateVersion', updateVersion)
        mo.setResult('updates', updates)

        return mo
コード例 #15
0
ファイル: httphello.py プロジェクト: zhaozw/hall37
    def doHelloTuyou(self):
        gameId = runhttp.getParamInt('gameId')
        clientId = runhttp.getParamStr('clientId', '')
        ftlog.debug('Hello->gameId=', gameId, 'clientId=', clientId)

        mo = MsgPack()
        mo.setCmd('hello')

        if gameId not in gdata.gameIds():
            mo.setError(1, 'gameId error !')
            return mo

        clientIdInt = pokerconf.clientIdToNumber(clientId)
        if clientIdInt <= 0:
            mo.setError(2, 'clientId error !')
            return mo

        nicaiCode = runhttp.getParamStr('nicaiCode', '')
        if not nicaiCode:
            mo.setError(3, 'nicai error !')
            return mo
        # 1. 生存你猜CODE
        HelloTuyou.getNiCaiCode(mo, nicaiCode)

        # 2. 取得更新信息
        updateVersion = runhttp.getParamInt('updateVersion')
        alphaVersion = runhttp.getParamInt('alphaVersion', 0)
        HelloTuyou.getUpdataInfo(mo, gameId, clientId, updateVersion, alphaVersion)

        # 3. 静态配置文件的MD5和URL
        staticConf = hallconf.getUpgradeStaticConf()
        mo.updateResult(staticConf)

        # 4. 返回三方SDK的控制开关
        HelloTuyou.getThirdSwitches(mo, clientId)

        # 设置其他返回值
        mo.setResult('gameId', gameId)
        mo.setResult('clientId', clientId)

        return mo
コード例 #16
0
ファイル: task.py プロジェクト: zhaozw/hall37
 def _registerEvents(self):
     for taskKind in self._taskKindMap.values():
         for inspector in taskKind.inspectors:
             for eventType, gameIds in inspector.interestEventMap.iteritems(
             ):
                 gameIds = gameIds or gdata.gameIds()
                 for gameId in gameIds:
                     game = gdata.games().get(gameId)
                     if game:
                         game.getEventBus().subscribe(
                             eventType, self._handleEvent)
                         self._addInterestEventType(eventType, gameId)
                         if ftlog.is_debug():
                             ftlog.debug(
                                 'TYTaskSystemImpl._registerEvents eventType=',
                                 eventType, 'gameId=', gameId,
                                 'taskUnitId=',
                                 taskKind.taskUnit.taskUnitId)
                     else:
                         ftlog.warn(
                             'TYTaskSystemImpl._registerEvents gameId=',
                             gameId, 'err=', 'Not find game')