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()
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
def do_player_bindBankAccount(self): if ftlog.is_debug(): request = runhttp.getRequest() ftlog.debug('ErdayiHttpHandler.do_player_bindBankAccount', 'params=', runhttp.getDict()) ftlog.debug('ErdayiHttpHandler.do_player_bindBankAccount', 'request=', request) try: userId, err = self.checkBaseParams() if err: return err.pack() bankNo = runhttp.getParamStr('bankNo') if not bankNo: return PlayerControl.makeResponse(userId, ErrorEnum.ERR_BAD_PARAM) bankName = runhttp.getParamStr('bankName') if not bankName: return PlayerControl.makeResponse(userId, ErrorEnum.ERR_BAD_PARAM) bankAccount = runhttp.getParamStr('bankAccount') if not bankAccount: return PlayerControl.makeResponse(userId, ErrorEnum.ERR_BAD_PARAM) ftlog.debug('do_player_bindBankAccount', 'userId=', userId, 'bankNo=', bankNo, 'bankName=', bankName, 'bankAccount=', bankAccount) response = PlayerControl.bindBankAccount(userId, bankNo, bankName, bankAccount) return response.pack() except: ftlog.error() return PlayerControl.makeResponse(userId, ErrorEnum.ERR_UNKNOWN).pack()
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()
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
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}
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()
def putTiles(self): if not self._passThis(): return {'info': 'can not use this tool !', 'code': 1} play_mode = runhttp.getParamStr('play_mode') seat1 = runhttp.getParamStr('seat1', '') seat2 = runhttp.getParamStr('seat2', '') seat3 = runhttp.getParamStr('seat3', '') seat4 = runhttp.getParamStr('seat4', '') jing = runhttp.getParamStr('jing', '') laizi = runhttp.getParamStr('laizi', '') pool = runhttp.getParamStr('pool') ftlog.debug('play_mode =', play_mode, 'seat1 =', seat1, 'seat2 =', seat2, 'seat3 =', seat3, 'seat4 =', seat4, 'jing=', jing,'laizi=',laizi, 'pool =', pool, caller=self) tile_info = { 'seat1': self._splitTiles(seat1), 'seat2': self._splitTiles(seat2), 'seat3': self._splitTiles(seat3), 'seat4': self._splitTiles(seat4), 'jing': self._splitTiles(jing), 'pool': self._splitTiles(pool), 'laizi': self._splitTiles(laizi) } key = 'put_card:' + play_mode daobase.executeMixCmd('set', key, json.dumps(tile_info)) return {'info': 'ok', 'code': 0}
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
def do_player_ex_matchReg(self): try: userId, err = self.checkBaseParams() if err: return err.pack() ftlog.debug('do_player_ex_matchReg', 'userId=', userId) from dizhu.erdayimatch.erdayi3api import Report3rdInterface roomId = runhttp.getParamStr('roomId') matchId = runhttp.getParamStr('matchId') Report3rdInterface.matchReg(roomId, matchId, userId, 'luwei') return {'status':'ok'} except: ftlog.error() return PlayerControl.makeResponse(userId, ErrorEnum.ERR_UNKNOWN).pack()
def doDataToRedis(self): ftlog.debug('doDataToRedis..is..ok') DataList = runhttp.getParamStr('listData', '') DataList = json.loads(DataList) ftlog.debug('DataList =', DataList) DataName = runhttp.getParamStr('itemList', '') ftlog.debug('DataName =', DataName) mo = MsgPack() mo.setCmd('insertToredis') daobase.executeMixCmd('del', DataName) for ecode in DataList: ftlog.debug('value =', ecode) daobase.executeMixCmd('lpush', DataName, ecode) mo.setResult('ok', 1) return mo
def doForceLogOut(self): userids = runhttp.getParamStr('userids', '') logoutmsg = runhttp.getParamStr('logoutmsg', '') userids = userids.split(',') ulen = len(userids) for x in xrange(ulen): userids[x] = int(userids[x]) ftlog.debug('doForceLogOut', userids) for uid in userids: userdata.clearUserCache(uid) onlines.forceLogOut(uid, logoutmsg) mo = MsgPack() mo.setCmd('forcelogout') mo.setResult('ok', 1) return mo
def _check_param_prodOrderId(self, key, params): prodOrderId = runhttp.getParamStr(key, '') ftlog.debug('BaseHttpMsgChecker._check_param_prodId key=', key, 'params=', params, 'prodOrderId=', prodOrderId) if not prodOrderId: return 'param prodOrderId error', None return None, prodOrderId
def _check_param_params(self, key, params): try: jstr = runhttp.getParamStr(key) params = strutil.loads(jstr) return None, params except: return 'the jsonstr params is not a list Format !!', None
def doPutMessage(self, gameId, fromUid, toUid, mtype, msg, ismgr, scope, clientIds): button = runhttp.getParamStr('button', None) button = strutil.loads(button, ignoreException=True) data = None mo = MsgPack() if mtype == 0 and len(msg) > 0 and toUid > 0 and gameId >= 0: # 发送私人消息 # 必须参数 # 1)msg - 消息 # 2)toUid - 接收消息的userId # 3)gameId data = pkmessage.sendPrivate(gameId, toUid, fromUid, msg, button) elif mtype == 1 and len(msg) > 0 and gameId >= 0: # 发送站内消息到全体用户 # 必选参数 # msg - 消息 # gameId data = pkmessage.sendGlobal(gameId, msg, button) elif mtype == 2 and gameId > 0 and len(msg) > 0: # 发送LED # TODO 当前Game服务为4,5,6号 , 每个服务都发送 mo.setCmd('send_led') mo.setParam('msg', msg) mo.setParam('gameId', gameId) mo.setParam('ismgr', 1) router.sendToAll(mo, gdata.SRV_TYPE_UTIL) data = True elif mtype == 3 and gameId > 0 and toUid > 0 and len(msg) > 0: # 封装popwnd # 必选参数 # gameId # toUid 接收弹窗的userId # msg 弹窗消息内容 task = TodoTaskShowInfo(msg, True) mo = TodoTaskHelper.makeTodoTaskMsg(gameId, toUid, task) # 将消息发送给此人 router.sendToUser(mo, toUid) data = True elif mtype == 4 and gameId > 0 and len(msg) > 0 and len(scope) > 0: mo.setCmd('send_led') mo.setParam('msg', msg) ftlog.info('send_led new msg=', msg) mo.setParam('gameId', gameId) ftlog.info('send_led new gameId=', gameId) mo.setParam('ismgr', ismgr) ftlog.info('send_led new ismgr=', ismgr) mo.setParam('scope', scope) ftlog.info('send_led new scope=', scope) mo.setParam('clientIds', clientIds) ftlog.info('send_led new clientIds=', clientIds) router.sendToAll(mo, gdata.SRV_TYPE_UTIL) data = True if data == None: mo.setError(1, 'params error') else: mo.setResult('ok', 'true') return mo
def _check_param_actId(self, key, params): try: actId = runhttp.getParamStr(key) return None, actId except: return 'the actId params is not a str Format !!', None
def _check_param_urlParams(self, key, params): value = runhttp.getParamStr(key) if not value: return None, {} try: value = strutil.loads(value) except: return 'urlParams必须是json字符串', None return None, value
def _check_param_assets(self, key, params): assets = runhttp.getParamStr(key, '') if not assets: return 'param assets is empty!!', None try: assets = strutil.loads(assets) except: return 'param assets must be json-dump string!!', None return None, assets
def _check_param_hotparams(self, key, params): hotparams = runhttp.getParamStr(key, '') try: if len(hotparams) > 0: hotparams = strutil.loads(hotparams) return None, hotparams except: pass return 'param hotparams error, must be a json dumps string', None
def _check_param_todotask_kwarg(self, key, params): todotask_kwarg = runhttp.getParamStr(key, '') if not todotask_kwarg: return 'param todotask_kwarg is empty!!', None try: todotask_kwarg = strutil.loads(todotask_kwarg) except: return 'param todotask_kwarg must be json-dump string!!', None return None, todotask_kwarg
def _check_param_clientIds(self, key, params): ret = [] try: jstr = runhttp.getParamStr(key) clientIdList = jstr.split('|') for clientId in clientIdList: ret.append(clientId) except: ret = [] return None, ret
def do_gdss_del_HallNotify_Info(self): ntimeId = runhttp.getParamStr('ntimeId', '') uuid = runhttp.getParamStr('uuid', '') hall = runhttp.getParamStr('hall', '') ntime = runhttp.getParamStr('ntime', '') import freetime.util.log as ftlog try: ftlog.hinfo('HttpGameHandler.do_gdss_del_HallNotify_Info enter', ntimeId, uuid, hall, ntime) from hall.servers.center.rpc import newnotify_remote ok = newnotify_remote.delHallNotifyInfo(ntimeId, uuid, hall, ntime) if ok: ftlog.hinfo('HttpGameHandler.do_gdss_del_HallNotify_Info ok', ntimeId, uuid, hall, ntime) return {'retmsg': 1} else: ftlog.hinfo('HttpGameHandler.do_gdss_del_HallNotify_Info failed', ntimeId, uuid, hall, ntime) return {'retmsg': 0} except: ftlog.hinfo('HttpGameHandler.do_gdss_del_HallNotify_Info error', ntimeId, uuid, hall, ntime) return {'error': 404}
def cancelPutTiles(self): """ 撤销摆牌 """ if not self._passThis(): return {'info': 'f**k you!', 'code': 1} play_mode = runhttp.getParamStr('play_mode') key = 'put_card:' + play_mode daobase.executeMixCmd('del', key) return {'info': 'ok', 'code': 0}
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
def _check_param_curTime(self, key, params): value = runhttp.getParamStr(key) if not value: return None, pktimestamp.getCurrentTimestamp() if not isstring(value): return self.makeErrorResponse(-1, '当前时间格式错误'), None try: dt = datetime.strptime(value, '%Y-%m-%d %H:%M:%S') return None, pktimestamp.datetime2Timestamp(dt) except: return self.makeErrorResponse(-1, '当前时间格式错误'), None
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
def do_gdss_get_HallNotify_Info(self): hall = runhttp.getParamStr('hall', '') import freetime.util.log as ftlog try: ftlog.hinfo('HttpGameHandler.do_gdss_get_HallNotify_Info enter',hall) from hall.servers.center.rpc import newnotify_remote notifyList = newnotify_remote.getHallNotifyInfo(hall) ftlog.hinfo("HttpGameHandler.do_gdss_get_HallNotify_Info ok", notifyList) return {'retmsg': notifyList} except: ftlog.hinfo('HttpGameHandler.do_gdss_get_HallNotify_Info error', hall) return {'error': 404}
def _check_param_serverIds(self, key, params): allIds = gdata.allServersMap().keys() serverIds = runhttp.getParamStr(key, '') if serverIds == 'all': return None, allIds slist = serverIds.split(',') if slist and len(slist) > 0: for s in slist: if not s in allIds: return 'param serverIds not is allServersMap ' + str(s) + ' allIds=' + str(allIds), None return None, slist return 'param serverIds error', None
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
def _check_param_serverIds(self, key, params): allIds = gdata.allServersMap().keys() serverIds = runhttp.getParamStr(key, '') if serverIds == 'all': return None, allIds slist = serverIds.split(',') if slist and len(slist) > 0: for s in slist: if not s in allIds: return 'param serverIds not is allServersMap ' + str( s) + ' allIds=' + str(allIds), None return None, slist return 'param serverIds error', None
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
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
def do_player_getVCode(self): try: userId, err = self.checkBaseParams() if err: return err.pack() mobile = runhttp.getParamStr('mobile') if not mobile: return PlayerControl.makeResponse(userId, ErrorEnum.ERR_BAD_MOBILE) ftlog.debug('do_player_getVCode', 'userId=', userId, 'mobile=', mobile) response = PlayerControl.getVCode(userId, mobile) return response.pack() except: ftlog.error() return PlayerControl.makeResponse(userId, ErrorEnum.ERR_UNKNOWN).pack()
def putTiles(self): if not self._passThis(): return {'info': 'can not use this tool !', 'code': 1} play_mode = runhttp.getParamStr('play_mode') seat1 = runhttp.getParamStr('seat1', '') seat2 = runhttp.getParamStr('seat2', '') seat3 = runhttp.getParamStr('seat3', '') seat4 = runhttp.getParamStr('seat4', '') jing = runhttp.getParamStr('jing', '') laizi = runhttp.getParamStr('laizi', '') pool = runhttp.getParamStr('pool') ftlog.debug('play_mode =', play_mode, 'seat1 =', seat1, 'seat2 =', seat2, 'seat3 =', seat3, 'seat4 =', seat4, 'jing=', jing, 'laizi=', laizi, 'pool =', pool, caller=self) tile_info = { 'seat1': self._splitTiles(seat1), 'seat2': self._splitTiles(seat2), 'seat3': self._splitTiles(seat3), 'seat4': self._splitTiles(seat4), 'jing': self._splitTiles(jing), 'pool': self._splitTiles(pool), 'laizi': self._splitTiles(laizi) } key = 'put_card:' + play_mode daobase.executeMixCmd('set', key, json.dumps(tile_info)) return {'info': 'ok', 'code': 0}
def _check_param_key(self, key, params): value = runhttp.getParamStr("key", "gamelist2") if not value: return 'param key error', None ftlog.debug('HttpGameHandler._check_param_key key:', value) return None, value
def _check_param_scope(self, key, params): value = runhttp.getParamStr(key, 'hall') return None, value
def _check_param_hotfixpy(self, key, params): hotfixpy = runhttp.getParamStr(key, '') if hotfixpy: return None, hotfixpy return 'param hotfixpy error', None
def _check_param_exchangeId(self, key, params): value = runhttp.getParamStr(key) if not value: return 'param exchangeId error', None return None, value
def _check_param_authInfo(self, key, params): value = runhttp.getParamStr(key, '') if not value: return 'param authInfo error', None return None, value
def _check_param_actname(self, key, params): value = runhttp.getParamStr(key) if not value: return 'no actname', None return None, value
def _check_param_roundId(self, key, params): roundId = runhttp.getParamStr(key, "") return None, roundId
def _check_param_recordData(self, key, params): recordData = runhttp.getParamStr(key, "") return None, recordData
def _check_param_buttonId(self, key, params): buttonId = runhttp.getParamStr(key, '') ftlog.debug('BaseHttpMsgChecker._check_param_buttonId key=', key, 'params=', params, 'buttonId=', buttonId) return None, buttonId
def _check_param_timeStmp(self, key, params): time = runhttp.getParamStr(key, "") return None, time
def _check_param_error(self, key, params): error = runhttp.getParamStr(key, '') ftlog.debug('BaseHttpMsgChecker._check_param_error key=', key, 'params=', params, 'error=', error) return None, error
def _check_param_platformOrder(self, key, params): platformOrder = runhttp.getParamStr(key, '') ftlog.debug('BaseHttpMsgChecker._check_param_platformOrder key=', key, 'params=', params, 'platformOrder=', platformOrder) return None, platformOrder
def _check_param_redEnvelopeId(self, key, params): value = runhttp.getParamStr("redEnvelopeId", "") ftlog.debug('HttpGameHandler._check_param_redEnvelopeId redEnvelopeId:', value) return None, value
def _check_param_msg(self, key, params): value = runhttp.getParamStr(key, '') if not value: return 'param msg error', None return None, value