Exemplo n.º 1
0
    def onAction(self, action, name):
        tylog.info('BaseActionHandler.onAction'
                   '| action, name:', action, name)

        ret = None
        if action == 'generate':
            ret = self.doGenerate(name)
        elif action == 'show':
            ret = self.doShowPage(name)
        elif action == 'get':
            revision = runhttp.getParamStr("revision")
            branch = runhttp.getParamStr("branch")
            ret = self.doGet(name, branch, revision)
        elif action == 'svnLog':
            branch = runhttp.getParamStr("branch")
            ret = self.doSvnLog(name, branch)
        elif action == 'commit':
            branch = runhttp.getParamStr("branch")
            log = runhttp.getParamStr("log")
            ret = self.doCommit(name, branch, log)

        tylog.info('BaseActionHandler.onAction'
                   '| action, name:', action, name,
                   '| ret:', ret)
        return ret
Exemplo n.º 2
0
 def _check_param_action_name(self, key, params, extend_tag):
     value = runhttp.getParamStr(key, '')
     if len(value) > 0:
         return None, value
     if value in ('config_check', 'config_update'):
         return None, value
     return 'the action name error', None
Exemplo n.º 3
0
 def _check_param_roomConf(self, key, params, extend_tag):
     value = runhttp.getParamStr(key)
     try:
         value = strutil.loads(value)
         return None, value
     except:
         return 'roomConf must json string', None
Exemplo n.º 4
0
 def _check_param_roomConf(self, key, params, extend_tag):
     value = runhttp.getParamStr(key)
     try:
         value = strutil.loads(value)
         return None, value
     except:
         return 'roomConf must json string', None
Exemplo n.º 5
0
 def do_http_texas_get_match_time(self):
     '''获取所有比赛的所有场次的所有开赛时间'''
     self._initBase()
     days = int(runhttp.getParamStr('days', 5))
     ftlog.debug("TexasActionHandler.do_http_texas_get_match_time", "days:", days)
     match_time = self.calcAllStartTimes(days)
     mo = MsgPack()
     mo.setCmd('match_time')
     mo.setResult('match_time', match_time)
     return mo
Exemplo n.º 6
0
 def do_http_t3flush_get_match_time(self):
     '''获取所有比赛的所有场次的所有开赛时间'''
     self._initBase()
     days = int(runhttp.getParamStr('days', 5))
     ftlog.debug("T3flushActionHandler.do_http_t3flush_get_match_time",
                 "days:", days)
     match_time = self.calcAllStartTimes(days)
     mo = MsgPack()
     mo.setCmd('match_time')
     mo.setResult('match_time', match_time)
     return mo
Exemplo n.º 7
0
    def onAction(self, action, name):
        tylog.info('BaseActionHandler.onAction'
                   '| action, name:', action, name)

        ret = None
        if action == 'generate':
            ret = self.doGenerate(name)
        elif action == 'show':
            ret = self.doShowPage(name)
        elif action == 'get':
            revision = runhttp.getParamStr("revision")
            branch = runhttp.getParamStr("branch")
            ret = self.doGet(name, branch, revision)
        elif action == 'svnLog':
            branch = runhttp.getParamStr("branch")
            ret = self.doSvnLog(name, branch)
        elif action == 'commit':
            branch = runhttp.getParamStr("branch")
            log = runhttp.getParamStr("log")
            ret = self.doCommit(name, branch, log)

        tylog.info('BaseActionHandler.onAction'
                   '| action, name:', action, name, '| ret:', ret)
        return ret
Exemplo n.º 8
0
 def _check_param_jsonfile(self, key, params, extend_tag):
     value = runhttp.getParamStr(key, '')
     return None, value
Exemplo n.º 9
0
 def _check_param_commitlog(self, key, params, extend_tag):
     value = runhttp.getParamStr(key, '')
     return None, value
Exemplo n.º 10
0
 def _check_param_jsonfile(self, key, params, extend_tag):
     value = runhttp.getParamStr(key, '')
     return None, value
Exemplo n.º 11
0
 def _check_param_name(self, key, params, extend_tag):
     value = runhttp.getParamStr(key, 'unknown')
     return None, value
Exemplo n.º 12
0
    def do_http_debug_action(self, action):

        if action == 'redis_clear_all':
            result = redisdata.redis_clear_all(self.options)

        userId = runhttp.getParamInt('userId', 0)
        gameId = runhttp.getParamInt('gameId', 0)
        key = runhttp.getParamStr('key', '')
        value = runhttp.getParamStr('value', '')

        if action == 'redis_search_all_userdata':
            result = redisdata.redis_search_all_userdata(self.options, userId)

        if action == 'html_redirect':
            datas = redisdata._getLastOkDefines(self.options)
            httpgame = datas['pokerdict']['http_game']
            rurl = runhttp.getParamStr('url')
            if os.environ.get('RUN_IN_DOCKER', 0):
                # 在开发docker模式下,需要替换为外部HALL37HTTP端口号(此端口由nginx代理服务)
                refhost = runhttp.getParamStr('refhost')
                tks = refhost.split(':')
                tks[-1] = os.environ.get('PORT_NGINX', '80')
                httpgame = ':'.join(tks)
            result = rurl.replace('${http_game}', httpgame)

        if action == 'redis_get_userdata':
            result = redisdata.redis_get_userdata(self.options, userId)

        if action == 'redis_set_userdata':
            result = redisdata.redis_set_userdata(self.options, userId, key,
                                                  value)

        if action == 'redis_get_gamedata':
            result = redisdata.redis_get_gamedata(self.options, userId, gameId)

        if action == 'redis_set_gamedata':
            result = redisdata.redis_set_gamedata(self.options, userId, gameId,
                                                  key, value)

        if action == 'redis_get_map_clientid':
            result = redisdata.redis_get_config(self.options,
                                                'poker:map.clientid')

        if action == 'redis_get_map_productid':
            result = redisdata.redis_get_config(self.options,
                                                'poker:map.productid')

        if action == 'redis_get_map_activityid':
            result = redisdata.redis_get_config(self.options,
                                                'poker:map.activityid')

        if action == 'redis_get_map_evnetid':
            result = redisdata.redis_get_config(self.options,
                                                'poker:map.bieventid')

        if action == 'redis_del_userdata':
            result = redisdata.redis_del_userdata(self.options, userId)

        if action == 'redis_del_gamedata':
            result = redisdata.redis_del_gamedata(self.options, userId, gameId)

        if action == 'redis_del_day1st':
            result = redisdata.redis_del_weakdata(self.options, userId, False)

        if action == 'redis_del_daylogin':
            result = redisdata.redis_del_weakdata(self.options, userId, True)

        if action == 'redis_get_usertime':
            result = redisdata.redis_get_usertime(self.options, userId)

        if action == 'redis_command':
            cmdline = runhttp.getParamStr('command', '')
            cmdline = strutil.loads(cmdline)
            ralias = runhttp.getParamStr('redisalias', '')
            roomId = runhttp.getParamInt('roomId', 0)
            result = redisdata.redis_do_command(self.options, userId, roomId,
                                                ralias, cmdline)

        datas = redisdata._getLastOkDefines(self.options)
        httpgame = datas['pokerdict']['http_game']
        if action == 'putmsg':
            httpgame = httpgame + '/v1/putmsg'
            result = tyhttp.dohttpquery(httpgame, runhttp.getDict())

        if action == 'get_room_info':
            httpgame = httpgame + '/_http_manager_get_room_details'
            result = tyhttp.dohttpquery(httpgame, runhttp.getDict())

        if action == 'hotfix_code':
            from optparse import Values
            options = Values()
            setattr(options, 'poker_path', self.options.pokerpath)
            setattr(options, 'hotfixpy', runhttp.getParamStr('hotfixpy'))
            setattr(options, 'hotfixwait', 1)
            setattr(options, 'serverIds', runhttp.getParamStr('serverIds'))
            result = hotfix.action(options, 0)

        if isinstance(result, (long, int, float, bool)):
            result = str(result)
        if isinstance(result, (list, tuple, dict, set)):
            result = json.dumps(result,
                                indent=2,
                                sort_keys=True,
                                ensure_ascii=False)
        if not isinstance(result, (str, unicode)):
            result = str(result)
        result = result.replace('<', '&lt;')
        result = result.replace('>', '&gt;')
        result = result.replace('\r', '')
        result = result.replace('\n', '<br>')
        result = result.replace('\\n', '<br>')
        result = result.replace(' ', '&nbsp;')
        result = result.replace('\\\\x', '\\x')
        mo = MsgPack()
        mo.setCmd(action)
        mo.setResult('ok', 1)
        mo.setResult('text', result)
        return mo
Exemplo n.º 13
0
 def _check_param_action(self, key, params, extend_tag):
     value = runhttp.getParamStr(key, '')
     if isinstance(value, (str, unicode)) and len(value) >= 0:
         return None, value
     return 'the action error', None
Exemplo n.º 14
0
 def _check_param_action_uuids(self, key, params, extend_tag):
     value = runhttp.getParamStr(key, '')
     value = strutil.loads(value, ignoreException=1)
     if isinstance(value, list) and len(value) >= 0:
         return None, value
     return 'the action_uuids error', None
Exemplo n.º 15
0
 def _check_param_action_params(self, key, params, extend_tag):
     value = runhttp.getParamStr(key, '')
     value = strutil.loads(value, ignoreException=True)
     if isinstance(value, (list, dict)):
         return None, value
     return 'the action params error', None
Exemplo n.º 16
0
 def _check_param_commitlog(self, key, params, extend_tag):
     value = runhttp.getParamStr(key, '')
     return None, value
Exemplo n.º 17
0
 def _check_param_name(self, key, params, extend_tag):
     value = runhttp.getParamStr(key, 'unknown')
     return None, value
Exemplo n.º 18
0
 def _check_param_action_user(self, key, params, extend_tag):
     value = runhttp.getParamStr(key, '')
     return None, value