コード例 #1
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
コード例 #2
0
    def doActivityBetguessSetResult(self):
        '''
        @param activityGameId: 6(配置里配置的哪个GameId就填哪个GameId)
        @param activityId: 活动ID
        @param issueNumber: '2016-10-31 18:20:00'
        @param resultState: 0,1,2
        '''
        try:
            activityGameId = runhttp.getParamInt('activityGameId')
            activityId = runhttp.getParamStr('activityId')
            issueNumber = runhttp.getParamStr('issueNumber')
            resultState = runhttp.getParamInt('resultState')
            if activityGameId == None or \
                activityId == None or \
                issueNumber == None or \
                resultState == None:
                return self.makeErrorResponse('params error').pack()
            
            ftlog.debug('BetguessHttpHandler.doActivityBetguessSetResult',
                        'activityGameId=', activityGameId,
                        'activityId=', activityId,
                        'issueNumber=', issueNumber,
                        'resultState=', resultState)
            
            err, issueMap = self.getActivityIssueMapConf(activityId)
            if err:
                return err
                        
            # 验证issueNumber是否存在
            if issueNumber not in issueMap:
                return self.makeErrorResponse('issueNumber not found! issueNumber maybe error').pack()
            
            # 给活动设置竞猜结果
            if not ActivityModel.updateResult(activityGameId, activityId, issueNumber, resultState):
                return self.makeErrorResponse('result set failed! resultState maybe error').pack()

            # 获得最新的活动数据
            activityModel = ActivityModel.loadModel(activityGameId, activityId, issueNumber)
            if activityModel.resultState == activityModel.RESULT_STATE_NONE:
                return self.makeErrorResponse('activityModel.resultState not set!').pack()
            
            # 遍历参与玩家
            chipCounter = 0
            userIdList = UserRecorder.getUsers(activityGameId, activityId, issueNumber)
            for userId in userIdList:
                response = act_betguess_remote.sendRewards(userId, 
                                                        activityModel.countChipLeft, activityModel.countChipRight, activityModel.resultState, 
                                                        activityGameId, activityId, issueNumber)
                if response.get('err'):
                    return self.makeErrorResponse(response.get('err')).pack()
                chipCounter += response.get('chip', 0)
            
            activityModel = ActivityModel.loadModel(activityGameId, activityId, issueNumber)
            response = MsgPack()
            response.setResult("activityModel", activityModel.__dict__)
            response.setResult('allchip', chipCounter)
            return response.pack()
        except:
            ftlog.error()
            return self.makeErrorResponse().pack()
コード例 #3
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
コード例 #4
0
ファイル: base_http_checker.py プロジェクト: zhaozw/hall37
 def _check_param_gameId(self, key, params):
     gameId = runhttp.getParamInt(key, 0)
     if not gameId:
         gameId = runhttp.getParamInt('appId', 0)
     ftlog.debug('BaseHttpMsgChecker._check_param_gameId key=', key,
                 'params=', params, 'gameId=', gameId, 'gameIds=',
                 gdata.gameIds())
     if not gameId in gdata.gameIds():
         return 'param gameId error', None
     return None, gameId
コード例 #5
0
ファイル: base_http_checker.py プロジェクト: zhaozw/hall37
 def _check_param_gameId(self, key, params):
     gameId = runhttp.getParamInt(key, 0)
     if not gameId:
         gameId = runhttp.getParamInt('appId', 0)
     ftlog.debug('BaseHttpMsgChecker._check_param_gameId key=', key,
                 'params=', params,
                 'gameId=', gameId,
                 'gameIds=', gdata.gameIds())
     if not gameId in gdata.gameIds():
         return 'param gameId error', None
     return None, gameId
コード例 #6
0
    def do_gdss_sport_end(self):
        matchId = runhttp.getParamInt('matchId', 0)
        leagueId = runhttp.getParamInt('leagueId', 0)
        homeTeamId = runhttp.getParamInt('homeTeamId', 0)
        awayTeamId = runhttp.getParamInt('awayTeamId', 0)
        timestamp = runhttp.getParamInt('timestamp', 0)
        scoreh = runhttp.getParamInt('scoreh', 0)
        scorea = runhttp.getParamInt('scorea', 0)
        oddsw = runhttp.getParamStr('oddsw', 0)
        oddsa = runhttp.getParamStr('oddsa', 0)
        oddsl = runhttp.getParamStr('oddsl', 0)
        status = runhttp.getParamInt('status', 0)
        try:
            import freetime.util.log as ftlog
            ftlog.hinfo('HttpGameHandler.do_gdss_sport_end enter', matchId, leagueId, homeTeamId, \
                        awayTeamId, timestamp, scoreh, scorea, oddsw, oddsa, oddsl, status)
            from hall.servers.center.rpc import newnotify_remote
            ret = newnotify_remote.doSportEnd(matchId, leagueId, homeTeamId, awayTeamId, timestamp, [scoreh, scorea], [oddsw, oddsa, oddsl], status)

            if ret == 0:
                ftlog.hinfo('HttpGameHandler.do_gdss_sport_end ok')
                return {'retmsg': 1}
            else:
                ftlog.hinfo('HttpGameHandler.do_gdss_sport_end failed')
                return {'retmsg': 0}

        except:
            ftlog.hinfo('HttpGameHandler.do_gdss_sport_end error')
            return {'error': 404}
コード例 #7
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
コード例 #8
0
ファイル: httpgame.py プロジェクト: zhaozw/hall37
    def getChargeInfos(cls):
        chargeType = runhttp.getParamStr('chargeType', '')
        chargeRmbs = runhttp.getParamFloat('chargedRmbs', 0)
        chargedDiamonds = runhttp.getParamInt('chargedDiamonds', 0)
        consumeCoin = runhttp.getParamInt('consumeCoin')

        chargeMap = {}
        consumeMap = {}
        if consumeCoin > 0:
            consumeMap['coin'] = consumeCoin
        if chargeRmbs > 0:
            chargeMap['rmb'] = chargeRmbs
        if chargedDiamonds > 0:
            chargeMap['diamond'] = chargedDiamonds
        return chargeType, chargeMap, consumeMap
コード例 #9
0
ファイル: httpgame.py プロジェクト: luningcowboy/tuyoo
    def getChargeInfos(cls):
        chargeType = runhttp.getParamStr('chargeType', '')
        chargeRmbs = runhttp.getParamFloat('chargedRmbs', 0)
        chargedDiamonds = runhttp.getParamInt('chargedDiamonds', 0)
        consumeCoin = runhttp.getParamInt('consumeCoin')

        chargeMap = {}
        consumeMap = {}
        if consumeCoin > 0:
            consumeMap['coin'] = consumeCoin
        if chargeRmbs > 0:
            chargeMap['rmb'] = chargeRmbs
        if chargedDiamonds > 0:
            chargeMap['diamond'] = chargedDiamonds
        return chargeType, chargeMap, consumeMap
コード例 #10
0
ファイル: erdayi_handler.py プロジェクト: luningcowboy/tuyoo
    def do_player_bindRealInfo(self):
        try:
            userId, err = self.checkBaseParams()
            if err:
                return err.pack()
            realname = runhttp.getParamStr('realname')
            if not realname or len(realname)<=0:
                return PlayerControl.makeResponse(userId, ErrorEnum.ERR_BAD_PARAM)
            idNo = runhttp.getParamStr('idNo')
            if not idNo:
                return PlayerControl.makeResponse(userId, ErrorEnum.ERR_BAD_PARAM)
            mobile = runhttp.getParamStr('mobile')
            if not mobile:
                return PlayerControl.makeResponse(userId, ErrorEnum.ERR_BAD_PARAM)
            vcode = runhttp.getParamInt('vcode')
            if not vcode:
                return PlayerControl.makeResponse(userId, ErrorEnum.ERR_BAD_VCODE)

            ftlog.debug('do_player_bindRealInfo', 
                        'userId=', userId,
                        'realname=', realname,
                        'idNo=', idNo,
                        'mobile=', mobile,
                        'vcode=', vcode)
            
            response = PlayerControl.bindRealInfo(userId, realname, idNo, mobile, vcode)
            return response.pack()
        except:
            ftlog.error()
            return PlayerControl.makeResponse(userId, ErrorEnum.ERR_UNKNOWN).pack()
コード例 #11
0
ファイル: httphello.py プロジェクト: luningcowboy/tuyoo
def _doTcpPortTuyou():
    mo = MsgPack()
    mo.setCmd('hellotcp')
    userId = runhttp.getParamInt('userId')
    nicaiCode = runhttp.getParamStr('nicaiCode', '')
    clientId = runhttp.getParamStr('clientId', '')
    if not nicaiCode:
        mo.setError(3, 'nicai error !')
        return mo
    if userId < 1:
        mo.setError(3, 'userId error !')
        return mo

    ftlog.debug('tcpport->userId=', userId, 'nicaiCode=', nicaiCode)
    HelloTuyou.getNiCaiCode(mo, nicaiCode)

    ip, port, wsport = getGaoFangIp2(userId, clientId)
    if not ip:
        ipports = gdata.getUserConnIpPortList()
        address = ipports[userId % len(ipports)]
        ip, port = getGaoFangIp(clientId, address[0], address[1])
        if len(address) > 2 :
            wsport = address[2]
    ftlog.info('doTcpPortTuyou->', userId, ip, port)
    mo.setResult('tcpsrv', {'ip': ip, 'port': port, 'wsport' : wsport})
    return mo
コード例 #12
0
ファイル: httpgame.py プロジェクト: luningcowboy/tuyoo
 def doDeliveryProduct(self, uid, orderId, prodId, orderPrice, prodCount,
                       platformOrder, isError, error):
     ftlog.info('doDeliveryProduct->', uid, orderId, prodId, orderPrice,
                prodCount, platformOrder, isError, error)
     userdata.clearUserCache(uid)
     mo = MsgPack()
     mo.setCmd('prod_delivery')
     mo.setParam('userId', uid)
     mo.setParam('orderId', orderId)
     mo.setParam('prodId', prodId)
     mo.setParam('orderPrice', orderPrice)
     mo.setParam('orderPlatformId', platformOrder)
     if isError == 'true':
         mo.setResult('ok', '0')
         mo.setResult('info', error)
         mo.setError(1, error)
         router.sendToUser(mo, uid)
         return 'success'
     else:
         mo.setParam('ok', '1')
         isSub = runhttp.getParamInt('is_monthly', 0)
         if isSub:
             mo.setParam('isSub', isSub)
         ret = router.queryUtilServer(mo, uid)
         ftlog.info('doDeliveryProduct->', uid, orderId, prodId, orderPrice,
                    prodCount, platformOrder, isError, error, 'result=',
                    ret)
         if isinstance(ret, (str, unicode)) and ret.find('error') < 0:
             return 'success'
     return 'error'
コード例 #13
0
ファイル: base_http_checker.py プロジェクト: zhaozw/hall37
 def _check_param_prodCount(self, key, params):
     prodCount = runhttp.getParamInt(key, 1)
     ftlog.debug('BaseHttpMsgChecker._check_param_prodCount key=', key,
                 'params=', params, 'prodCount=', prodCount)
     if prodCount <= 0:
         return 'param prodCount error', None
     return None, prodCount
コード例 #14
0
ファイル: httphello.py プロジェクト: zhaozw/hall37
def _doTcpPortTuyou():
    mo = MsgPack()
    mo.setCmd('hellotcp')
    userId = runhttp.getParamInt('userId')
    nicaiCode = runhttp.getParamStr('nicaiCode', '')
    clientId = runhttp.getParamStr('clientId', '')
    if not nicaiCode:
        mo.setError(3, 'nicai error !')
        return mo
    if userId < 1:
        mo.setError(3, 'userId error !')
        return mo

    ftlog.debug('tcpport->userId=', userId, 'nicaiCode=', nicaiCode)
    HelloTuyou.getNiCaiCode(mo, nicaiCode)

    ip, port = getGaoFangIp2(userId, clientId)
    if not ip:
        ipports = gdata.getUserConnIpPortList()
        address = ipports[userId % len(ipports)]
        ip, port = getGaoFangIp(clientId, address[0], address[1])

    ftlog.info('doTcpPortTuyou->', userId, ip, port)
    mo.setResult('tcpsrv', {'ip': ip, 'port': port})
    return mo
コード例 #15
0
ファイル: httpgame.py プロジェクト: zhaozw/hall37
 def doConsumDelivery(self, appId, userId, orderId, prodId, prodCount, platformOrder):
     ftlog.info('doConsumDelivery->', appId, userId, orderId, prodId, prodCount, platformOrder)
     appKey = hallconf.getAppKeyInfo(appId).get('key', '')
     if not runhttp.checkHttpParamCode(appKey):
         mo = MsgPack()
         mo.setCmd('prod_delivery')
         mo.setError(1, '校验失败')
         ftlog.info('doConsumDelivery->', appId, userId, orderId, prodId, prodCount, platformOrder,
                    'result=code verify error')
         return mo
     userdata.clearUserCache(userId)
     mo = MsgPack()
     mo.setCmd('prod_delivery')
     mo.setParam('userId', userId)
     mo.setParam('orderId', orderId)
     mo.setParam('prodCount', prodCount)
     mo.setParam('prodId', prodId)
     mo.setParam('appId', appId)
     mo.setParam('orderPlatformId', platformOrder)
     mo.setParam('ok', '1')
     isSub = runhttp.getParamInt('is_monthly', 0)
     if isSub:
         mo.setParam('isSub', isSub)
     chargeType, chargeMap, consumeMap = self.getChargeInfos()
     mo.setParam('consumeMap', consumeMap)
     mo.setParam('chargeMap', chargeMap)
     mo.setParam('chargeType', chargeType)
     ret = router.queryUtilServer(mo, userId)
     ftlog.info('doConsumDelivery->', appId, userId, orderId, prodId, prodCount, platformOrder, 'result=', ret)
     if isinstance(ret, (str, unicode)) and ret.find('error') < 0:
         return 'success'
     return 'error'
コード例 #16
0
 def doConsumDelivery(self, appId, userId, orderId, prodId, prodCount,
                      platformOrder):
     ftlog.info('doConsumDelivery->', appId, userId, orderId, prodId,
                prodCount, platformOrder)
     appKey = hallconf.getAppKeyInfo(appId).get('key', '')
     if not runhttp.checkHttpParamCode(appKey):
         mo = MsgPack()
         mo.setCmd('prod_delivery')
         mo.setError(1, '校验失败')
         ftlog.info('doConsumDelivery->', appId, userId, orderId, prodId,
                    prodCount, platformOrder, 'result=code verify error')
         return mo
     userdata.clearUserCache(userId)
     mo = MsgPack()
     mo.setCmd('prod_delivery')
     mo.setParam('userId', userId)
     mo.setParam('orderId', orderId)
     mo.setParam('prodCount', prodCount)
     mo.setParam('prodId', prodId)
     mo.setParam('appId', appId)
     mo.setParam('orderPlatformId', platformOrder)
     mo.setParam('ok', '1')
     isSub = runhttp.getParamInt('is_monthly', 0)
     if isSub:
         mo.setParam('isSub', isSub)
     chargeType, chargeMap, consumeMap = self.getChargeInfos()
     mo.setParam('consumeMap', consumeMap)
     mo.setParam('chargeMap', chargeMap)
     mo.setParam('chargeType', chargeType)
     ret = router.queryUtilServer(mo, userId)
     ftlog.info('doConsumDelivery->', appId, userId, orderId, prodId,
                prodCount, platformOrder, 'result=', ret)
     if isinstance(ret, (str, unicode)) and ret.find('error') < 0:
         return 'success'
     return 'error'
コード例 #17
0
ファイル: httpgame.py プロジェクト: zhaozw/hall37
 def doDeliveryProduct(self, uid, orderId, prodId, orderPrice, prodCount, platformOrder, isError, error):
     ftlog.info('doDeliveryProduct->', uid, orderId, prodId, orderPrice, prodCount, platformOrder, isError, error)
     userdata.clearUserCache(uid)
     mo = MsgPack()
     mo.setCmd('prod_delivery')
     mo.setParam('userId', uid)
     mo.setParam('orderId', orderId)
     mo.setParam('prodId', prodId)
     mo.setParam('orderPrice', orderPrice)
     mo.setParam('orderPlatformId', platformOrder)
     if isError == 'true':
         mo.setResult('ok', '0')
         mo.setResult('info', error)
         mo.setError(1, error)
         router.sendToUser(mo, uid)
         return 'success'
     else:
         mo.setParam('ok', '1')
         isSub = runhttp.getParamInt('is_monthly', 0)
         if isSub:
             mo.setParam('isSub', isSub)
         ret = router.queryUtilServer(mo, uid)
         ftlog.info('doDeliveryProduct->', uid, orderId, prodId, orderPrice, prodCount, platformOrder, isError,
                    error, 'result=', ret)
         if isinstance(ret, (str, unicode)) and ret.find('error') < 0:
             return 'success'
     return 'error'
コード例 #18
0
ファイル: base_http_checker.py プロジェクト: zhaozw/hall37
 def _check_param_uid(self, key, params):
     uid = runhttp.getParamInt(key, 0)
     ftlog.debug('BaseHttpMsgChecker._check_param_uid key=', key, 'params=',
                 params, 'userId=', uid)
     if uid <= 0:
         return 'param uid error', None
     return None, uid
コード例 #19
0
ファイル: base_http_checker.py プロジェクト: zhaozw/hall37
 def _check_param_prodCount(self, key, params):
     prodCount = runhttp.getParamInt(key, 1)
     ftlog.debug('BaseHttpMsgChecker._check_param_prodCount key=', key,
                 'params=', params,
                 'prodCount=', prodCount)
     if prodCount <= 0:
         return 'param prodCount error', None
     return None, prodCount
コード例 #20
0
 def _check_param_matchId(self, key, params):
     matchId = runhttp.getParamInt(key, 0)
     ftlog.debug('BaseHttpMsgChecker._check_param_matchId key=', key,
                 'params=', params,
                 'matchId=', matchId)
     if matchId <= 0:
         return 'param matchId error', None
     return None, matchId
コード例 #21
0
ファイル: base_http_checker.py プロジェクト: zhaozw/hall37
 def _check_param_uid(self, key, params):
     uid = runhttp.getParamInt(key, 0)
     ftlog.debug('BaseHttpMsgChecker._check_param_uid key=', key,
                 'params=', params,
                 'userId=', uid)
     if uid <= 0:
         return 'param uid error', None
     return None, uid
コード例 #22
0
 def doPerfProbe(self):
     ftlog.debug('doPerfProbe')
     userId = runhttp.getParamInt('userId')
     mo = MsgPack()
     mo.setCmd('prefprobe')
     mo.setResult('userId', userId)
     mo.setResult('echoUT', self._doPerfEcho_UT(userId))
     mo.setResult('echoUTRedis', self._doPerfEcho2_UT(userId))
     return mo
コード例 #23
0
    def doActivityBetguessQuery(self):
        '''
        @param activityGameId: 6(配置里配置的哪个GameId就填哪个GameId)
        @param activityId: 活动ID
        @param issueNumber: '2016-10-31 18:20:00'
        '''
        try:
            activityGameId = runhttp.getParamInt('activityGameId')
            activityId = runhttp.getParamStr('activityId')
            issueNumber = runhttp.getParamStr('issueNumber')
            if activityGameId == None or \
                activityId == None or \
                issueNumber == None:
                return self.makeErrorResponse('params error').pack()

            ftlog.debug('BetguessHttpHandler.doActivityBetguessQuery',
                        'activityGameId=', activityGameId,
                        'activityId=', activityId,
                        'issueNumber=', issueNumber)

            activityModel = ActivityModel.loadModel(activityGameId, activityId, issueNumber)

            err, issueMap = self.getActivityIssueMapConf(activityId)
            if err:
                return err
            
            issueCalculator = IssueCalculator(issueMap)
            issueConf = issueCalculator.getCurrentIssueConf(issueNumber)
            if (issueNumber not in issueMap) or (not issueConf):
                return self.makeErrorResponse('issueNumber not found! issueNumber maybe error').pack()

            bankerPumping = issueConf.get('bankerPumping', 0)
            # 奖池为抽水金额
            totalChip = activityModel.countChipLeft+activityModel.countChipRight
            # 奖池金额
            betPoolChip = int((activityModel.countChipLeft+activityModel.countChipRight)*(1-bankerPumping))
            # 左赔率
            leftBetOdds = betPoolChip/activityModel.countChipLeft if activityModel.countChipLeft>0 else 0
            # 右赔率
            rightBetOdds = betPoolChip/activityModel.countChipRight if activityModel.countChipRight>0 else 0
            
            response = MsgPack()
            response.setResult('totalChip', totalChip)
            response.setResult('betPoolChip', betPoolChip)
            response.setResult('leftBetOdds', leftBetOdds)
            response.setResult('rightBetOdds', rightBetOdds)
            response.setResult('bankerPumping', bankerPumping)
            response.setResult('countChipLeft', activityModel.countChipLeft)
            response.setResult('countChipRight', activityModel.countChipRight)
            response.setResult('resultState', activityModel.resultState)
            
            response.setResult("activityModel", activityModel.__dict__)
            response.setResult('pastIssueNumberList', issueCalculator.getAlreadyPastIssueNumberList())
            return response.pack()
        except:
            ftlog.error()
            return self.makeErrorResponse().pack()
コード例 #24
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
コード例 #25
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
コード例 #26
0
ファイル: erdayi_handler.py プロジェクト: luningcowboy/tuyoo
    def checkBaseParams(self):
        userId = runhttp.getParamInt('userId')
        if userId <= 0:
            return userId, PlayerControl.makeResponse(userId, ErrorEnum.ERR_BAD_USERID)
        
        # sign = runhttp.getParamStr('sign')
        # if not sign:
        #     return userId, PlayerControl.makeResponse(userId, ErrorEnum.ERR_BAD_SIGN)

        authInfo = runhttp.getParamStr('authInfo')
        if not authInfo:
            return userId, PlayerControl.makeResponse(userId, ErrorEnum.ERR_BAD_AUTHINFO)
        
        return userId, None
コード例 #27
0
ファイル: base_http_checker.py プロジェクト: zhaozw/hall37
 def _check_param_clientId(self, key, params):
     clientId = runhttp.getParamStr(key, '')
     ftlog.debug('BaseHttpMsgChecker._check_param_clientId key=', key,
                 'params=', params, 'clientId=', clientId)
     if clientId and isinstance(clientId, (str, unicode)):
         return None, clientId
     userId = runhttp.getParamInt('userId', 0)
     ftlog.debug('BaseHttpMsgChecker._check_param_clientId key=', key,
                 'params=', params, 'clientId=', clientId, 'userId=',
                 userId)
     if userId:
         clientId = sessiondata.getClientId(userId)
         if clientId and isinstance(clientId, (str, unicode)):
             return None, clientId
     return 'ERROR of clientId !' + str(clientId), None
コード例 #28
0
ファイル: base_http_checker.py プロジェクト: zhaozw/hall37
 def _check_param_clientId(self, key, params):
     clientId = runhttp.getParamStr(key, '')
     ftlog.debug('BaseHttpMsgChecker._check_param_clientId key=', key,
                 'params=', params,
                 'clientId=', clientId)
     if clientId and isinstance(clientId, (str, unicode)):
         return None, clientId
     userId = runhttp.getParamInt('userId', 0)
     ftlog.debug('BaseHttpMsgChecker._check_param_clientId key=', key,
                 'params=', params,
                 'clientId=', clientId,
                 'userId=', userId)
     if userId:
         clientId = sessiondata.getClientId(userId)
         if clientId and isinstance(clientId, (str, unicode)):
             return None, clientId
     return 'ERROR of clientId !' + str(clientId), None
コード例 #29
0
ファイル: httpmessage.py プロジェクト: zhaozw/hall37
 def _check_param_fromUid(self, key, params):
     value = runhttp.getParamInt(key, 0)
     return None, value
コード例 #30
0
ファイル: httpmessage.py プロジェクト: zhaozw/hall37
 def _check_param_ismgr(self, key, params):
     value = runhttp.getParamInt(key, 1)
     return None, value
コード例 #31
0
ファイル: httphello.py プロジェクト: zhaozw/hall37
 def _check_param_isTempVipUser(self, key, params):
     value = runhttp.getParamInt(key, 0)
     if value not in (0, 1):
         return 'param needRemove error', None
     return None, value
コード例 #32
0
ファイル: httpgame.py プロジェクト: luningcowboy/tuyoo
 def _check_param_realGameId(self, key, params):
     value = runhttp.getParamInt(key, 0)
     return None, value
コード例 #33
0
ファイル: httpgame.py プロジェクト: luningcowboy/tuyoo
 def _check_param_reason(self, key, params):
     value = runhttp.getParamInt("reason", 0)
     ftlog.debug('HttpGameHandler._check_param_reason reason:', value)
     return None, value
コード例 #34
0
ファイル: httpgame.py プロジェクト: luningcowboy/tuyoo
 def _check_param_isTempVipUser(self, key, params):
     value = runhttp.getParamInt(key, 0)
     if value not in (0, 1):
         return 'param needRemove error', None
     return None, value
コード例 #35
0
ファイル: httpgame.py プロジェクト: zhaozw/hall37
 def _check_param_reason(self, key, params):
     value = runhttp.getParamInt("reason", 0)
     ftlog.debug('HttpGameHandler._check_param_reason reason:', value)
     return None, value
コード例 #36
0
ファイル: httpgame.py プロジェクト: luningcowboy/tuyoo
 def _check_param_giftKindId(self, key, params):
     value = runhttp.getParamInt(key, 0)
     return None, value
コード例 #37
0
ファイル: base_http_checker.py プロジェクト: zhaozw/hall37
 def _check_param_diamonds(self, key, params):
     diamonds = runhttp.getParamInt(key, 0)
     ftlog.debug('BaseHttpMsgChecker._check_param_diamonds key=', key,
                 'params=', params,
                 'diamonds=', diamonds)
     return None, diamonds
コード例 #38
0
ファイル: base_http_checker.py プロジェクト: zhaozw/hall37
 def _check_param_orderPrice(self, key, params):
     orderPrice = runhttp.getParamInt(key, 0)
     ftlog.debug('BaseHttpMsgChecker._check_param_orderPrice key=', key,
                 'params=', params,
                 'orderPrice=', orderPrice)
     return None, orderPrice
コード例 #39
0
ファイル: httpmgr.py プロジェクト: zhaozw/hall37
 def _check_param_wait(self, key, params):
     wait = runhttp.getParamInt(key, 1)
     return None, wait
コード例 #40
0
ファイル: httpgame.py プロジェクト: zhaozw/hall37
 def _check_param_result(self, key, params):
     value = runhttp.getParamInt(key, -1)
     if value < 0:
         return 'param result error', None
     return None, value
コード例 #41
0
ファイル: httpgame.py プロジェクト: zhaozw/hall37
 def _check_param_clientIdNum(self, key, params):
     value = runhttp.getParamInt("clientIdNum", 0)
     ftlog.debug('HttpGameHandler._check_param_clientIdNum clientIdNum:', value)
     return None, value
コード例 #42
0
ファイル: admin.py プロジェクト: zhaozw/hall37
 def _check_param_roomId(self, key, params):
     roomId = runhttp.getParamInt(key, -1)
     if isinstance(roomId, int) and roomId >= 0:
         return None, roomId
     return None, 0
コード例 #43
0
ファイル: httpmessage.py プロジェクト: zhaozw/hall37
 def _check_param_pageSize(self, key, params):
     value = runhttp.getParamInt(key, 20)
     if value <= 0:
         value = 20
     return None, value
コード例 #44
0
ファイル: admin.py プロジェクト: zhaozw/hall37
 def _check_param_tableId(self, key, params):
     tableId = runhttp.getParamInt(key, -1)
     if isinstance(tableId, int) and tableId >= 0:
         return None, tableId
     return None, 0
コード例 #45
0
ファイル: httpmessage.py プロジェクト: zhaozw/hall37
 def _check_param_pageNo(self, key, params):
     value = runhttp.getParamInt(key, 1)
     if value <= 0:
         value = 1
     return None, value
コード例 #46
0
ファイル: httpmessage.py プロジェクト: zhaozw/hall37
 def _check_param_msgtype(self, key, params):
     value = runhttp.getParamInt(key, 0)
     return None, value
コード例 #47
0
 def _check_param_duration(self, key, params):
     value = runhttp.getParamInt(key)
     return None, value
コード例 #48
0
ファイル: httpgame.py プロジェクト: luningcowboy/tuyoo
 def _check_param_result(self, key, params):
     value = runhttp.getParamInt(key, -1)
     if value < 0:
         return 'param result error', None
     return None, value
コード例 #49
0
 def _check_param_count(self, key, params):
     value = runhttp.getParamInt(key, -1)
     if value <= 0:
         return 'param count error', None
     return None, value
コード例 #50
0
ファイル: httpgame.py プロジェクト: luningcowboy/tuyoo
 def _check_param_clientIdNum(self, key, params):
     value = runhttp.getParamInt("clientIdNum", 0)
     ftlog.debug('HttpGameHandler._check_param_clientIdNum clientIdNum:',
                 value)
     return None, value
コード例 #51
0
 def _check_param_toAddExp(self, key, params):
     value = runhttp.getParamInt(key, -1)
     if value <= 0:
         return 'param toAddExp error', None
     return None, value
コード例 #52
0
ファイル: httpgame.py プロジェクト: luningcowboy/tuyoo
 def _check_param_inviter(self, key, params):
     value = runhttp.getParamInt(key, 0)
     return None, value
コード例 #53
0
 def _check_param_deltaCount(self, key, params):
     value = runhttp.getParamInt(key, 0)
     if value == 0:
         return 'param deltaCount error', None
     return None, value
コード例 #54
0
ファイル: httpgame.py プロジェクト: luningcowboy/tuyoo
 def _check_param_countyId(self, key, params):
     value = runhttp.getParamInt(key, 0)
     return None, value
コード例 #55
0
ファイル: httpgame.py プロジェクト: zhaozw/hall37
 def _check_param_inviter(self, key, params):
     value = runhttp.getParamInt(key, 0)
     return None, value