コード例 #1
0
def redis_do_command(options, userId, roomId, ralias, cmdline):

    datas = _getLastOkDefines(options)
    rdbs = datas['dbdict']['redis']
    if ralias == 'config':
        rdb = datas['pokerdict']['config_redis']
    elif ralias == 'user':
        if userId <= 0:
            return 'param userId ERROR !!'
        rdb = _getRedisDefCluster(rdbs, userId)
    elif ralias == 'table':
        if roomId <= 0:
            return 'param roomId ERROR !!'
        rdb = _getRedisDefCluster(rdbs, roomId, 'table')
    else:
        rdb = rdbs[ralias]

    conn = tydb.get_redis_conn(rdb)
    tylog.debug('redis_do_command->', cmdline)
    for x in xrange(len(cmdline)):
        c = cmdline[x]
        cmdline[x] = _decode_x(c)
    try:
        data = conn.execute_command(*cmdline)
    except Exception, ex:
        data = str(ex)
        tylog.error(cmdline)
コード例 #2
0
ファイル: actions.py プロジェクト: zhaozw/hall37
    def _initBase(self):
        ''' 初始化一些基本配置 '''

        if getattr(self.options, 'texasTeamConfInited', False):
            return

        _datas = redisdata._getLastOkDefines(self.options)
        projects_path = _datas['pokerdict']['projects_path']   # 源码目录。一般为: /home/tyhall/hall37/source

        pokerpath = self.options.pokerpath  # 也就是配置目录。一般为 /home/tyhall/hall37/source/config
        teamRoot = os.path.join(projects_path, 'texas-team')
        runningDir = os.path.join(pokerpath, 'game/8/room/')

        ftlog.debug('TexasActionHandler._initBase >>|', 'projects_path, teamRoot, runningDir:',
                projects_path, teamRoot, runningDir)

        if not os.path.exists(teamRoot):
            ftlog.debug('create teamRoot:', teamRoot)
            fsutils.makePath(teamRoot)

            self._svnCmd(teamRoot, 'checkout', teamConfUrl, 'team')
            self._svnCmd(teamRoot, 'checkout', roomConfTestingUrl, 'testing')
            self._svnCmd(teamRoot, 'checkout', roomConfReleaseUrl, 'release')

        initDirs(teamRoot, runningDir)

        self.options.texasTeamConfInited = True
コード例 #3
0
ファイル: config_actions.py プロジェクト: zhaozw/hall37
    def initDirs(self):
        if getattr(self.options, 'teamConfInited', False):
            return

        _datas = redisdata._getLastOkDefines(self.options)

        # 源码目录。一般为: /home/tyhall/hall37/source
        projects_path = _datas['pokerdict']['projects_path']

        # 也就是配置目录。一般为 /home/tyhall/hall37/source/config
        pokerpath = self.options.pokerpath

        teamRoot = os.path.join(projects_path, 'team')

        if not os.path.exists(teamRoot):
            tylog.debug('create teamRoot:', teamRoot)
            fsutils.makePath(teamRoot)

            svn.svnCmd(teamRoot, 'checkout', self.svnTestingUrl, 'testing')
            svn.svnCmd(teamRoot, 'checkout', self.svnReleaseUrl, 'release')

        self.teamRoot = teamRoot
        self.testingDir = os.path.join(teamRoot, 'testing')
        self.releaseDir = os.path.join(teamRoot, 'release')
        self.runningDir = pokerpath
コード例 #4
0
ファイル: actions.py プロジェクト: zhaozw/hall37
    def do_http_texas_commit(self, branch, commitlog):
        self._initBase()
        ftlog.debug("do_http_texas_commit branch, commitlog:", branch, commitlog)
        if branch == 'testing':
            src = teamCfgDir
            tgt = testingDir
        elif branch == 'release':
            src = testingDir
            tgt = releaseDir

            
        outputs = ['提交到 '+branch]
        outputs.append('提交日志:\n'+ commitlog + '\n')

        sh_file = os.path.join(os.path.dirname(__file__), "commit.sh")
        cmd = 'bash %s %s %s %s %s' % (sh_file, src, tgt, "wangt", "g01dfish")
        ftlog.debug("do_http_texas_commit| cmd:", cmd)
        sh_output = os.popen(cmd).read()
        ftlog.debug("do_http_texas_commit| sh_output:", sh_output)
        outputs.append(sh_output)


        ftlog.debug("do_http_texas_commit branch, tgt, commitlog:", branch, tgt, commitlog)
        cmd, status, output = self._svnCmd(teamRoot, 'commit', tgt, '-m', '"%s"' % commitlog)
        ftlog.debug("do_http_texas_commit| branch:", branch,
                    "| status, output:", status, output)
        outputs.append('svn 提交输出:\n'+ output + '\n')


        output = ('\n\n').join(outputs)

        mo = MsgPack()
        mo.setCmd('texas_commit')
        mo.setResult('output', output.replace(' ', '&nbsp;').replace('\n', '<br />'))
        return mo 
コード例 #5
0
ファイル: actions.py プロジェクト: zhaozw/hall37
 def do_http_dizhu_room_list(self):
     ftlog.debug('do_http_dizhu_room_list')
     roomsPath = fsutils.appendPath(self.gameConfPath, 'room/0.json')
     with open(roomsPath, 'r') as f:
         rooms = json.load(f)
         return {'ec': 0, 'rooms': rooms}
     return {'ec': -1, 'info': 'Failed open file'}
コード例 #6
0
ファイル: svn.py プロジェクト: zhaozw/hall37
def svnCmd(workingpath, cmd, *svnArgs):
    tylog.debug('svnCmd <<| workingpath, svnCmd, svnArgs:',
                workingpath, cmd, ' '.join(svnArgs))
    parts = []
    if workingpath:
        parts.append('cd %s' % workingpath)
    parts.append('LANG=en_US.UTF-8')
    parts.append(' '.join(['svn', cmd, '--non-interactive'] + list(svnArgs)))

    script = ';'.join(parts)
    status, output = commands.getstatusoutput(script)

    if status != 0:
        tylog.error("svnCmd >>| Failed"
                    '|path, cmd:', workingpath, cmd,
                    '|script:', script,
                    '|status, output:', status, output,
                    )
    else:
        tylog.debug('svnCmd >>'
                    '|path, cmd:', workingpath, cmd,
                    #'|script:', script,
                    #'|status, output:', status, output
                    )

    return script, status, output
コード例 #7
0
ファイル: actions.py プロジェクト: zhaozw/hall37
 def do_http_dizhu_room_list(self):
     ftlog.debug('do_http_dizhu_room_list')
     roomsPath = fsutils.appendPath(self.gameConfPath, 'room/0.json')
     with open(roomsPath, 'r') as f:
         rooms = json.load(f)
         return {'ec':0, 'rooms':rooms}
     return {'ec':-1, 'info':'Failed open file'}
コード例 #8
0
    def _initBase(self):
        ''' 初始化一些基本配置 '''

        if getattr(self.options, 't3flushTeamConfInited', False):
            return

        _datas = redisdata._getLastOkDefines(self.options)
        projects_path = _datas['pokerdict'][
            'projects_path']  # 源码目录。一般为: /home/tyhall/hall37/source

        pokerpath = self.options.pokerpath  # 也就是配置目录。一般为 /home/tyhall/hall37/source/config
        teamRoot = os.path.join(projects_path, 't3flush-team')
        runningDir = os.path.join(pokerpath, 'game/39/room/')

        ftlog.debug('T3flushActionHandler._initBase >>|',
                    'projects_path, teamRoot, runningDir:', projects_path,
                    teamRoot, runningDir)

        if not os.path.exists(teamRoot):
            ftlog.debug('create teamRoot:', teamRoot)
            fsutils.makePath(teamRoot)

            self._svnCmd(teamRoot, 'checkout', teamConfUrl, 'team')
            self._svnCmd(teamRoot, 'checkout', roomConfTestingUrl, 'testing')
            self._svnCmd(teamRoot, 'checkout', roomConfReleaseUrl, 'release')

        initDirs(teamRoot, runningDir)

        self.options.t3flushTeamConfInited = True
コード例 #9
0
ファイル: config_actions.py プロジェクト: zhaozw/hall37
    def initDirs(self):
        if getattr(self.options, 'teamConfInited', False):
            return

        _datas = redisdata._getLastOkDefines(self.options)

        # 源码目录。一般为: /home/tyhall/hall37/source
        projects_path = _datas['pokerdict']['projects_path']

        # 也就是配置目录。一般为 /home/tyhall/hall37/source/config
        pokerpath = self.options.pokerpath

        teamRoot = os.path.join(projects_path, 'team')

        if not os.path.exists(teamRoot):
            tylog.debug('create teamRoot:', teamRoot)
            fsutils.makePath(teamRoot)

            svn.svnCmd(teamRoot, 'checkout', self.svnTestingUrl, 'testing')
            svn.svnCmd(teamRoot, 'checkout', self.svnReleaseUrl, 'release')

        self.teamRoot = teamRoot
        self.testingDir = os.path.join(teamRoot, 'testing')
        self.releaseDir = os.path.join(teamRoot, 'release')
        self.runningDir = pokerpath
コード例 #10
0
ファイル: redisdata.py プロジェクト: zhaozw/hall37
def redis_do_command(options, userId, roomId, ralias, cmdline):
    
    datas = _getLastOkDefines(options)
    rdbs = datas['dbdict']['redis']
    if ralias == 'config' :
        rdb = datas['pokerdict']['config_redis']
    elif ralias == 'user' :
        if userId <= 0 :
            return 'param userId ERROR !!'
        rdb = _getRedisDefCluster(rdbs, userId)
    elif ralias == 'table' :
        if roomId <= 0 :
            return 'param roomId ERROR !!'
        rdb = _getRedisDefCluster(rdbs, roomId, 'table')
    else:
        rdb = rdbs[ralias]

    conn = tydb.get_redis_conn(rdb)
    tylog.debug('redis_do_command->', cmdline)
    for x in xrange(len(cmdline)) :
        c = cmdline[x]
        cmdline[x] = _decode_x(c)
    try:
        data = conn.execute_command(*cmdline)
    except Exception, ex:
        data = str(ex)
        tylog.error(cmdline)
コード例 #11
0
ファイル: typrotocol.py プロジェクト: zhaozw/hall37
 def _countPack(self):
     self.PACK_COUNT += 1
     if self.PACK_COUNT % 50000 == 0:
         ct = datetime.now()
         dt = ct - self.PACK_TIME
         pps = 50000 / (dt.seconds + dt.microseconds / 1000000.0)
         self.PACK_TIME = ct
         tylog.debug("PPS", pps, TyTasklet.concurrent_task_count)
コード例 #12
0
ファイル: actions.py プロジェクト: zhaozw/hall37
 def do_http_dizhu_save_room(self, roomId, roomConf):
     ftlog.debug('do_http_dizhu_save_room roomId=', roomId,
                 'roomConf=', roomConf)
     
     try:
         pass
     except:
         pass
コード例 #13
0
 def _countPack(self):
     self.PACK_COUNT += 1
     if self.PACK_COUNT % 50000 == 0:
         ct = datetime.now()
         dt = ct - self.PACK_TIME
         pps = 50000 / (dt.seconds + dt.microseconds / 1000000.0)
         self.PACK_TIME = ct
         tylog.debug("PPS", pps, TyTasklet.concurrent_task_count)
コード例 #14
0
ファイル: actions.py プロジェクト: zhaozw/hall37
    def do_http_dizhu_save_room(self, roomId, roomConf):
        ftlog.debug('do_http_dizhu_save_room roomId=', roomId, 'roomConf=',
                    roomConf)

        try:
            pass
        except:
            pass
コード例 #15
0
ファイル: actions.py プロジェクト: zhaozw/hall37
 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
コード例 #16
0
ファイル: actions.py プロジェクト: zhaozw/hall37
    def _svnCmd(self, workingpath, svnCmd, *svnArgs):
        print 'DEBUG TexasActionHandler._svnCmd <<| workingpath, svnCmd, svnArgs', workingpath, svnCmd, svnArgs
        svnau = '--username wangt --password g01dfish --no-auth-cache'
        cmd = ['cd ' + workingpath]
        cmd.append('export LANG=en_US.UTF-8')
        cmd.append(' '.join(['svn', svnCmd, '--non-interactive', svnau] + list(svnArgs)))

        cmd = ';'.join(cmd)
        status, output = commands.getstatusoutput(cmd)
        ftlog.debug('TexasActionHandler._svnCmd >>| cmd, status, output:', cmd, status, output)
        return cmd, status, output
コード例 #17
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
コード例 #18
0
    def _svnCmd(self, workingpath, svnCmd, *svnArgs):
        print 'DEBUG t3flushActionHandler._svnCmd <<| workingpath, svnCmd, svnArgs', workingpath, svnCmd, svnArgs
        svnau = '--username wangt --password g01dfish --no-auth-cache'
        cmd = ['cd ' + workingpath]
        cmd.append('export LANG=en_US.UTF-8')
        cmd.append(' '.join(['svn', svnCmd, '--non-interactive', svnau] +
                            list(svnArgs)))

        cmd = ';'.join(cmd)
        status, output = commands.getstatusoutput(cmd)
        ftlog.debug('T3flushActionHandler._svnCmd >>| cmd, status, output:',
                    cmd, status, output)
        return cmd, status, output
コード例 #19
0
ファイル: actions.py プロジェクト: zhaozw/hall37
    def do_http_texas_get_json_file(self, jsonfile):
        self._initBase()
        ftlog.debug("do_http_texas_gen_json_file jsonfile:", jsonfile)
        if fsutils.fileExists(jsonfile) :
            datas = fsutils.readJsonFile(jsonfile)
        else:
            datas = {'error': 'file "%s" not existed' % jsonfile}

        mo = MsgPack()
        mo.setCmd('json_file_data')
        mo.setResult('isOk', True)
        mo.setResult('jsonfile', jsonfile)
        mo.setResult('datas', datas)
        return mo 
コード例 #20
0
    def do_http_t3flush_get_json_file(self, jsonfile):
        self._initBase()
        ftlog.debug("do_http_t3flush_get_json_file jsonfile:", jsonfile)
        if fsutils.fileExists(jsonfile):
            datas = fsutils.readJsonFile(jsonfile)
        else:
            datas = {'error': 'file "%s" not existed' % jsonfile}

        mo = MsgPack()
        mo.setCmd('json_file_data')
        mo.setResult('isOk', True)
        mo.setResult('jsonfile', jsonfile)
        mo.setResult('datas', datas)
        return mo
コード例 #21
0
ファイル: actions.py プロジェクト: zhaozw/hall37
    def do_http_texas_precommit(self, branch):
        self._initBase()
        ftlog.debug("do_http_texas_precommit branch:", branch)
        if branch == 'testing':
            jsonfile        = os.path.join(teamCfgDir, '0.json.all')
            jsonfileprev    = os.path.join(testingDir, '0.json.all')
        elif branch == 'release':
            jsonfile        = os.path.join(testingDir, '0.json.all')
            jsonfileprev    = os.path.join(releaseDir, '0.json.all')
            
        _, _, svnlog = self._svnCmd(teamRoot, 'log', '-l 5', jsonfileprev)
        svnlog = '\n'.join([line for line in svnlog.split('\n') if not line.startswith('------')])

        mo = MsgPack()
        mo.setCmd('texas_precommit')
        mo.setResult('isOk', True)
        mo.setResult('jsonfile', jsonfile)
        mo.setResult('jsonfileprev', jsonfileprev)
        mo.setResult('svnlog', svnlog)
        return mo 
コード例 #22
0
    def calcStartTimes(self, roomId, match_room_conf, days):
        ''' 获取某个房间的开赛时间完整列表'''
        import time
        from datetime import datetime, timedelta

        cron = FTCron(match_room_conf["startTimes"])
        if match_room_conf.get('startTimesExcluded'):
            match_room_conf['startTimesExcluded'] = set(
                match_room_conf['startTimesExcluded'])

        excludedTimes = match_room_conf.get('startTimesExcluded')
        timestamp = time.time()
        ntime = datetime.fromtimestamp(int(timestamp))
        now = datetime.now()

        startTimeList = []

        while True:
            nexttime = cron.getNextTime(ntime)
            if nexttime is not None:
                if (nexttime - now).days >= days:  # 最多给看未来这么多天的配置。太多了数据量大,慢
                    break
                nextStartTime = int(time.mktime(nexttime.timetuple()))
                ntime = nexttime + timedelta(seconds=30)
                if excludedTimes and (
                        nexttime.strftime('%H:%M') in excludedTimes
                        or nexttime.strftime('%Y%m%d') in excludedTimes
                        or nexttime.strftime('%Y%m%d %H:%M') in excludedTimes
                        or nexttime.strftime('%w') in excludedTimes):
                    ftlog.debug("|skip nextStartTime:", nexttime,
                                nextStartTime)
                    continue
                ftlog.debug("|nextStartTime:", nexttime, nextStartTime)
                startTimeList.append('%d-%02d-%02d %02d:%02d' %
                                     nexttime.timetuple()[:5])
            else:
                break
        return startTimeList
コード例 #23
0
    def do_http_t3flush_precommit(self, branch):
        self._initBase()
        ftlog.debug("do_http_t3flush_precommit branch:", branch)
        if branch == 'testing':
            jsonfile = os.path.join(teamCfgDir, '0.json.all')
            jsonfileprev = os.path.join(testingDir, '0.json.all')
        elif branch == 'release':
            jsonfile = os.path.join(testingDir, '0.json.all')
            jsonfileprev = os.path.join(releaseDir, '0.json.all')

        _, _, svnlog = self._svnCmd(teamRoot, 'log', '-l 5', jsonfileprev)
        svnlog = '\n'.join([
            line for line in svnlog.split('\n')
            if not line.startswith('------')
        ])

        mo = MsgPack()
        mo.setCmd('t3flush_precommit')
        mo.setResult('isOk', True)
        mo.setResult('jsonfile', jsonfile)
        mo.setResult('jsonfileprev', jsonfileprev)
        mo.setResult('svnlog', svnlog)
        return mo
コード例 #24
0
ファイル: actions.py プロジェクト: zhaozw/hall37
    def calcStartTimes(self, roomId, match_room_conf, days):
        ''' 获取某个房间的开赛时间完整列表'''
        import time
        from datetime import datetime, timedelta

        cron = FTCron(match_room_conf["startTimes"])
        if match_room_conf.get('startTimesExcluded'):
            match_room_conf['startTimesExcluded'] = set(match_room_conf['startTimesExcluded'])

        excludedTimes = match_room_conf.get('startTimesExcluded')
        timestamp = time.time()
        ntime = datetime.fromtimestamp(int(timestamp))
        now = datetime.now()
        
        startTimeList = []
        
        while True:
            nexttime = cron.getNextTime(ntime)
            if nexttime is not None:
                if (nexttime - now).days >= days:  # 最多给看未来这么多天的配置。太多了数据量大,慢
                    break
                nextStartTime = int(time.mktime(nexttime.timetuple()))
                ntime = nexttime + timedelta(seconds=30)
                if excludedTimes and (
                        nexttime.strftime('%H:%M') in excludedTimes
                        or nexttime.strftime('%Y%m%d') in excludedTimes
                        or nexttime.strftime('%Y%m%d %H:%M') in excludedTimes
                        or nexttime.strftime('%w') in excludedTimes
                        ):
                    ftlog.debug("|skip nextStartTime:", nexttime, nextStartTime)
                    continue
                ftlog.debug("|nextStartTime:", nexttime, nextStartTime)
                startTimeList.append('%d-%02d-%02d %02d:%02d' % nexttime.timetuple()[:5])
            else:
                break
        return startTimeList
        
コード例 #25
0
    def do_http_t3flush_commit(self, branch, commitlog):
        self._initBase()
        ftlog.debug("do_http_t3flush_commit branch, commitlog:", branch,
                    commitlog)
        if branch == 'testing':
            src = teamCfgDir
            tgt = testingDir
        elif branch == 'release':
            src = testingDir
            tgt = releaseDir

        outputs = ['提交到 ' + branch]
        outputs.append('提交日志:\n' + commitlog + '\n')

        sh_file = os.path.join(os.path.dirname(__file__), "commit.sh")
        cmd = 'bash %s %s %s %s %s' % (sh_file, src, tgt, "wangt", "g01dfish")
        ftlog.debug("do_http_t3flush_commit| cmd:", cmd)
        sh_output = os.popen(cmd).read()
        ftlog.debug("do_http_t3flush_commit| sh_output:", sh_output)
        outputs.append(sh_output)
        outputs.append('复制文件:\n' + '%s => %s' % (src, tgt) + '\n')

        ftlog.debug("do_http_t3flush_commit branch, tgt, commitlog, :", branch,
                    tgt, commitlog)
        cmd, status, output = self._svnCmd(teamRoot, 'commit', tgt, '-m',
                                           '"%s"' % commitlog)
        ftlog.debug("do_http_t3flush_commit| branch:", branch,
                    "| status, output:", status, output)
        outputs.append('svn 提交输出:\n' + output + '\n')
        output = ('\n\n').join(outputs)
        #output = '暂时不实现\n不真的提交'

        mo = MsgPack()
        mo.setCmd('t3flush_commit')
        mo.setResult('output',
                     output.replace(' ', '&nbsp;').replace('\n', '<br />'))
        return mo
コード例 #26
0
 def get_data(conn, rkey):
     tylog.debug('find key->', rkey)
     datas[rkey] = _execute_redis_fetch(conn, rkey)
コード例 #27
0
ファイル: actions.py プロジェクト: zhaozw/hall37
 def do_http_dizhu_get_room(self, roomId):
     ftlog.debug('do_http_dizhu_get_room roomId=', roomId)
     pass
コード例 #28
0
 def do_http_t3flush_gen_json_file(self, jsonfile):
     self._initBase()
     ftlog.debug('do_http_t3flush_gen_json_file', jsonfile)
     if jsonfile == 'game/39/room/0.json':
         return self.gen_t3flush_room_json()
コード例 #29
0
ファイル: actions.py プロジェクト: zhaozw/hall37
 def do_http_texas_gen_json_file(self, jsonfile):
     self._initBase()
     ftlog.debug('do_http_texas_gen_json_file', jsonfile)
     if jsonfile == 'game/8/room/0.json':
         return self.gen_texas_room_json()
コード例 #30
0
ファイル: redisdata.py プロジェクト: zhaozw/hall37
 def get_data(conn, rkey):
     tylog.debug('find key->', rkey)
     datas[rkey] = _execute_redis_fetch(conn, rkey)
コード例 #31
0
ファイル: redisdata.py プロジェクト: zhaozw/hall37
 def delete_nslogin(conn, rkey):
     conn.hdel(rkey, 'newnslogin.lastlogin')
     conn.hdel(rkey, 'newnslogin.nslogin')
     tylog.debug('REDIS HDEL-->[', rkey, 'newnslogin.nslogin, newnslogin.lastlogin]')
     delkeys.append(rkey + ' newnslogin.nslogin, newnslogin.lastlogin')
コード例 #32
0
 def delete_redis_key(conn, rkey):
     conn.delete(rkey)
     delkeys.append(rkey)
     tylog.debug('REDIS DELETE-->[', rkey, ']')
コード例 #33
0
ファイル: redisdata.py プロジェクト: zhaozw/hall37
 def delete_redis_key(conn, rkey):
     conn.delete(rkey)
     delkeys.append(rkey)
     tylog.debug('REDIS DELETE-->[', rkey, ']')
コード例 #34
0
ファイル: actions.py プロジェクト: zhaozw/hall37
 def do_http_dizhu_get_room(self, roomId):
     ftlog.debug('do_http_dizhu_get_room roomId=', roomId)
     pass
コード例 #35
0
ファイル: actions.py プロジェクト: zhaozw/hall37
    def do_http_model_list(self):
        mj = getResourcePath('menu.json')
        models = fsutils.readJsonFile(mj)
        # 读取game目录下的游戏目录
        otherConfPath = fsutils.appendPath(self.options.pokerpath, 'game')
        otherconf = os.listdir(otherConfPath)
        games = []
        for gid in otherconf:
            try:
                # 创建game-游戏配置目录。由于其它游戏的配置目录都是空, 就都跳过
                if int(gid) not in [8, 30, 39]:
                    continue

                gid = str(int(gid))
                children = []
                tylog.debug("do_http_model_list|get game mode|", gid=gid)
                self.getGameConfiger(int(gid), children)
                if children:
                    games.append({'text': 'game-' + gid, 'children': children})

                # # 创建该游戏下面的所有配置目录
                # gameConfigPath = fsutils.appendPath(otherConfPath, gid)
                # gameConfigs = os.listdir(gameConfigPath)
                # for gc in gameConfigs:
                #     if str(gc) != '.svn':
                #         children.append({'text': str(gc), 'attributes':{
                #                 "purl" : "model/config/game/" + gid + '/' + gc + '.html'
                #             }}
                #         )
            except:
                tylog.error("do_http_model_list|get game mode error|", gid=gid)
        models[0]['children'].extend(games)
        # models[0]['children'].append({'text': '查看模板关联', 'attributes':{
        #                         "purl" : "model/config/game/incidence.html"
        #                     }})

        # 动态测试工具
        debugs = []
        models.append({'text': '调试工具', 'children': debugs})

        webroot = fsutils.appendPath(self.options.workpath, 'webroot', 'model',
                                     'debug')
        hfs = os.listdir(webroot)
        for hf in hfs:
            if hf.endswith('.html'):
                hc = fsutils.readFile(webroot + '/' + hf)
                t = self._findTitle(hc)
                if t:
                    purl = "model/debug/" + hf
                    debugs.append({'text': t, 'attributes': {"purl": purl}})
        debugs.sort(key=lambda x: x['text'])
        mo = MsgPack()
        mo.setCmd('model_list')
        mo.setResult('models', models)
        mo.setResult('pokerpath', self.options.pokerpath)
        mo.setResult('mgrpath', self.options.workpath)
        mo.setResult('localip', fsutils.getLocalMachineIp())
        mo.setResult(
            'title',
            '.'.join(fsutils.getLocalMachineIp()[0].split('.')[2:]) + '管理器')
        return mo
コード例 #36
0
 def delete_nslogin(conn, rkey):
     conn.hdel(rkey, 'newnslogin.lastlogin')
     conn.hdel(rkey, 'newnslogin.nslogin')
     tylog.debug('REDIS HDEL-->[', rkey,
                 'newnslogin.nslogin, newnslogin.lastlogin]')
     delkeys.append(rkey + ' newnslogin.nslogin, newnslogin.lastlogin')