def get_wagers(startTime=None, endTime=None, accountId=None): # 投注 # 修改用户状态 headers = tokenhelp.gen_headers() url = tokenhelp.PINBO_URL + '/report/all-wagers' data = {} if accountId: data['userCode'] = "probet." + accountId # 时间转换 if startTime and endTime: if endTime - startTime >= 24 * 3600: logging.debug(errorLogic.client_param_invalid) raise exceptionLogic(errorLogic.client_param_invalid) startTime = timestamp2Str(startTime - 12 * 3600) endTime = timestamp2Str(endTime - 12 * 3600) data['dateFrom'] = startTime # '2018-05-19 00:00:00' data['dateTo'] = endTime # '2018-05-19 23:40:30' data['locale'] = 'zh-cn' # 需要校验数据 session = aiohttp.ClientSession() try: with aiohttp.Timeout(180): resp = yield from session.get(url=url, headers=headers, params=data, verify_ssl=False) #print(resp.status) if resp.status != 200: raise exceptionLogic(errorLogic.client_param_invalid) except Exception as e: logging.exception(repr(e)) raise exceptionLogic(errorLogic.sys_unknow_error) else: res = yield from resp.read() res = json.loads(res.decode()) if type(res) == list: pass else: code = res.get('code', '') if code != '' and (code in errorLogic.pinbo_error_code.keys()): logging.debug(code + ":" + errorLogic.pinbo_error_code[code]) raise exceptionLogic([code, errorLogic.pinbo_error_code[code]]) return res finally: if session: yield from session.close()
def handleHttp(dict_param: dict): dictApprovalvar_match_data = yield from classDataBaseMgr.getInstance( ).getPreMatchDataListRetDict() respMatchData = [] for var_match_id, var_match_data in dictApprovalvar_match_data.items(): objNewData = gmProtocol.classGmMatchData() objNewData.strProjectName = var_match_data.strMatchType objNewData.strMatchId = var_match_data.strMatchId objNewData.iGameState = var_match_data.iMatchState objNewData.strActivityName = var_match_data.strMatchName try: objNewData.strGameStartTime = timeHelp.timestamp2Str( var_match_data.iMatchStartTimestamp) except: objNewData.strGameStartTime = timeHelp.timestamp2Str(0) objNewData.strTeam1Name = var_match_data.strTeamAName objNewData.strTeam2Name = var_match_data.strTeamBName objNewData.strTeam1Logo = var_match_data.strTeamALogoUrl objNewData.strTeam2Logo = var_match_data.strTeamBLogoUrl objNewData.iMatchRoundNum = var_match_data.iMatchRoundNum objNewData.iHideFlag = var_match_data.iHideFlag #objNewData.strTeamAId = var_match_data.strTeamAId #objNewData.strTeamBId = var_match_data.strTeamBId objNewData.iTeamAScore = var_match_data.iTeamAScore objNewData.iTeamBScore = var_match_data.iTeamBScore objNewData.iSupportA = var_match_data.iSupportA objNewData.iSupportB = var_match_data.iSupportB for var_round_num, var_guess_list in var_match_data.dictGuess.items(): for var_guess_id in var_guess_list: objGuessData = yield from classDataBaseMgr.getInstance( ).getGuessData(var_guess_id) objGmPlayData = gmProtocol.classGmPlayData() objGmPlayData.strPlayTypeName = objGuessData.strGuessName # gmProtocol.getTypeMapNameFun(objGuessData.iGuessType,matchData.strTeamAName,matchData.strTeamBName,objGuessData.fSplitScore) objGmPlayData.iGuessState = objGuessData.iGuessState objGmPlayData.dictTeamInfo = objGuessData.dictCTR objGmPlayData.strGuessId = objGuessData.strGuessId objGmPlayData.iRoundNum = var_round_num objNewData.arrPlayTypeList.append(objGmPlayData) respMatchData.append(objNewData) logging.debug(classJsonDump.dumps(respMatchData)) return classJsonDump.dumps(respMatchData)
def handleHttp(dict_param: dict): strMatchId = dict_param['strMatchId'] objMatchData = yield from classDataBaseMgr.getInstance().getMatchData( strMatchId) objNewData = gmProtocol.classGmMatchData() objNewData.strProjectName = objMatchData.strMatchType objNewData.strMatchId = objMatchData.strMatchId objNewData.iGameState = objMatchData.iMatchState objNewData.strActivityName = objMatchData.strMatchName objNewData.strGameStartTime = timeHelp.timestamp2Str( objMatchData.iMatchStartTimestamp) objNewData.strTeam1Name = objMatchData.strTeamAName objNewData.strTeam2Name = objMatchData.strTeamBName objNewData.strTeam1Logo = objMatchData.strTeamALogoUrl objNewData.strTeam2Logo = objMatchData.strTeamBLogoUrl objNewData.iMatchRoundNum = objMatchData.iMatchRoundNum objNewData.iHideFlag = objMatchData.iHideFlag #objNewData.strTeamAId = objMatchData.strTeamAId #objNewData.strTeamBId = objMatchData.strTeamBId objNewData.iTeamAScore = objMatchData.iTeamAScore objNewData.iTeamBScore = objMatchData.iTeamBScore objNewData.iSupportA = objMatchData.iSupportA objNewData.iSupportB = objMatchData.iSupportB return classJsonDump.dumps(objNewData)
def handleHttp(dict_param: dict): strProjectName = dict_param['strProjectName'] iPageSize = int(dict_param['iPageSize']) iPageNum = int(dict_param['iPageNum']) iPageNum -= 1 if strProjectName == 'all': pass else: if not (strProjectName in gmProtocol.gameType): raise exceptionLogic(errorLogic.projectNameNotValid) iBeginIndex = iPageNum * iPageSize iEndIndex = iBeginIndex + iPageSize listMatchIds = yield from classDataBaseMgr.getInstance( ).getFinishResultMatch(iBeginIndex, iEndIndex) listMatchData = yield from classDataBaseMgr.getInstance().getMatchDataList( listMatchIds) objResp = gmProtocol.classGmMatchTotal() objResp.iTotalNum = yield from classDataBaseMgr.getInstance( ).getRecentMatchFinishDataCount() if len(listMatchData) != len(listMatchData): raise exceptionLogic(errorLogic.sys_unknow_error) for iIndex in range(0, len(listMatchData)): matchData = listMatchData[iIndex] objNewData = gmProtocol.classGmMatchData() objNewData.strProjectName = matchData.strMatchType objNewData.strMatchId = matchData.strMatchId objNewData.iGameState = matchData.iMatchState objNewData.strActivityName = matchData.strMatchName objNewData.strGameStartTime = timeHelp.timestamp2Str( matchData.iMatchStartTimestamp) objNewData.strTeam1Name = matchData.strTeamAName objNewData.strTeam2Name = matchData.strTeamBName objNewData.strTeam1Logo = matchData.strTeamALogoUrl objNewData.strTeam2Logo = matchData.strTeamBLogoUrl objNewData.iMatchRoundNum = matchData.iMatchRoundNum objNewData.iHideFlag = matchData.iHideFlag objNewData.strTeamAId = matchData.strTeamAId objNewData.strTeamBId = matchData.strTeamBId objNewData.iTeamAScore = matchData.iTeamAScore objNewData.iTeamBScore = matchData.iTeamBScore objNewData.iSupportA = matchData.iSupportA objNewData.iSupportB = matchData.iSupportB objNewData.iAwardFlag = matchData.iAwardFlag objNewData.iAwardNum = matchData.iAwardNum objNewData.iAwardType = matchData.iAwardType objNewData.iWinOrLose = matchData.iWinOrLose objNewData.iCancelResultFlag = matchData.iCancelResultFlag objNewData.iCancelResultBeginTime = matchData.iCancelResultBeginTime objNewData.iCancelResultEndTime = matchData.iCancelResultEndTime objResp.arrMatchData.append(objNewData) return classJsonDump.dumps(objResp)
def calcDayWater(): #todo 同步中午12点前24小时的平博投注单 try: betList=yield from get_wagers() for x in betList: yield from todo_pingbo_wagers(x) except Exception as e: logging.exception(e) logging.error('{},中午流水计算平博注单修复失败,请及时人工修复平博注单,计算流水'.format(timestamp2Str(getNow()))) else: strLastCheckTime = yield from classDataBaseMgr.getInstance().getCalcDayWaterTime() if strLastCheckTime is None: yield from classDataBaseMgr.getInstance().setCalcDayWaterTime(timeHelp.getNow()) iLastCheckTime = int(strLastCheckTime) if not timeHelp.isSameBetDay(iLastCheckTime,timeHelp.getNow()): #隔bet日了,中午进行计算日流水,做返利活动 #计算日流水 yield from classDataBaseMgr.getInstance().setCalcDayWaterTime(timeHelp.getNow()) iTodayStartTs = timeHelp.todayStartTimestamp() #获取昨日投注流水 funFuture = asyncio.ensure_future(runExecuteAll(iTodayStartTs,iTodayStartTs-86400)) listAllRet = yield from asyncio.wait_for(funFuture,10) #TODO log for var_ret in listAllRet: strAccountId = var_ret["loginId"] iValidCoin = int(var_ret["validWaterCoin"] * 100) #单位换算成分 #拿用户数据 if len(strAccountId) <= 0 or strAccountId is None: logging.error("account data not find") continue if iValidCoin <= 0: logging.error("account [{}] validCoin [{}] not find".format(strAccountId,iValidCoin)) continue objPlayerData, objPlayLock = yield from classDataBaseMgr.getInstance().getPlayerDataByLock(strAccountId) if objPlayerData is None: logging.error("account [{}] data not find") continue dictVipCfg = vip_config.get(objPlayerData.iLevel,None) if dictVipCfg is None: logging.error("accountId[{}] vipLevel[{}] cfg is not valid".format(objPlayerData.strAccountId,objPlayerData.iLevel)) continue yield from classDataBaseMgr.getInstance().releasePlayerDataLock(objPlayerData.strAccountId) iRebate = int(iValidCoin / 1000 * dictVipCfg[rebate]) balance = objPlayerData.iCoin + iRebate objPlayerData.iCoin += iRebate #TODO 日红利计算的bill要记录一下 yield from classDataBaseMgr.getInstance().setPlayerDataByLock(objPlayerData,objPlayLock) yield from addPlayerBill(strAccountId, iValidCoin, balance, CoinOp.coinOpPingboDayWaterRebate, iValidWater=iRebate, strDes="日有效流水[{}]返利[{}]".format(iValidCoin/100,iRebate/100))
def XgxPayOrder(strAccountId, iRmbFen, strPayMethord, strChannel, strIp): params = { "merchant_id": "", "merId": "1804121558158584", "extInfo": 'test', "merOrderId": strPayOrder, "payerId": 'p' + timeHelp.timestamp2Str(timeHelp.getNow()), "notifyUrl": 'http://api.probet.com/paycallback/lpay/callback', "reqFee": iRmbFen, # 请求支付金额,以“分”为单位 "itemName": "probet充值{}元".format(iRmbFen / 100), # 商品名称 "itemDesc": "probet充值{}元".format(iRmbFen / 100), # 商品描述 }
def get_settle_wagers(session): headers = tokenhelp.gen_headers() url = tokenhelp.PINBO_URL + '/report/all-wagers' data = {} data['settle'] = 1 data['locale'] = 'zh-cn' startTime = timestamp2Str(getNow() - 17 * 3600) endTime = timestamp2Str(getNow() - 12 * 3600) data['dateFrom'] = startTime # '2018-05-19 00:00:00' data['dateTo'] = endTime # '2018-05-19 23:40:30' # 需要校验数据 try: with aiohttp.Timeout(180): resp = yield from session.get(url=url, headers=headers, params=data, verify_ssl=False, timeout=180) if resp.status != 200: logging.exception('pingbo network error [{}]'.format(resp)) return [] except Exception as e: logging.exception(repr(e)) return [] else: res = yield from resp.read() res = json.loads(res.decode()) if isinstance(res, list): return res else: code = res.get('code', '') if code != '' and (code in errorLogic.pinbo_error_code.keys()): logging.exception(code + ":" + errorLogic.pinbo_error_code[code]) return []
def handleHttp(dict_param: dict): strMatchId = dict_param['strMatchId'] objMatchData = yield from classDataBaseMgr.getInstance().getMatchData( strMatchId) #objMatchAssertData,objMatchAssertlock = yield from singletonDefine.g_obj_GmDataMgr.getMatchAssertData(strMatchId,False) objNewData = gmProtocol.classGmMatchData() #objNewData.strProjectName = strProjectName objNewData.strProjectName = objMatchData.strMatchType objNewData.strMatchId = objMatchData.strMatchId objNewData.iGameState = objMatchData.iMatchState objNewData.strActivityName = objMatchData.strMatchName objNewData.strGameStartTime = timeHelp.timestamp2Str( objMatchData.iMatchStartTimestamp) objNewData.strTeam1Name = objMatchData.strTeamAName objNewData.strTeam2Name = objMatchData.strTeamBName objNewData.strTeam1Logo = objMatchData.strTeamALogoUrl objNewData.strTeam2Logo = objMatchData.strTeamBLogoUrl objNewData.iMatchRoundNum = objMatchData.iMatchRoundNum objNewData.iHideFlag = objMatchData.iHideFlag #objNewData.strTeamAId = objMatchData.strTeamAId #objNewData.strTeamBId = objMatchData.strTeamBId objNewData.iTeamAScore = objMatchData.iTeamAScore objNewData.iTeamBScore = objMatchData.iTeamBScore objNewData.iSupportA = objMatchData.iSupportA objNewData.iSupportB = objMatchData.iSupportB for var_round_num, var_guess_list in objMatchData.dictGuess.items(): for var_guess_id in var_guess_list: objGuessData = yield from classDataBaseMgr.getInstance( ).getGuessData(var_guess_id) objGmPlayData = gmProtocol.classGmPlayData() objGmPlayData.strPlayTypeName = objGuessData.strGuessName objGmPlayData.iGuessState = objGuessData.iGuessState objGmPlayData.dictTeamInfo = objGuessData.dictCTR objGmPlayData.strGuessId = objGuessData.strGuessId objGmPlayData.iRoundNum = var_round_num objGmPlayData.iHideFlag = objGuessData.iHideFlag objGmPlayData.strGuessResult = objGuessData.strGuessResult objNewData.arrPlayTypeList.append(objGmPlayData) return classJsonDump.dumps(objNewData)
def updateMatchPlatform(): global g_iCheckTime listMatchType = ["kog", "lol", "dota2"] gameTypeMapping = {2: "kog", 3: "lol", 4: "dota2"} objRedis = classDataBaseMgr.getInstance() # 获取上次的更新时间 #iCheckTime = yield from objRedis.getLastAddCheckTime() iNowTime = timeHelp.getNow() if g_iCheckTime is None or g_iCheckTime == 0: #yield from objRedis.setLastAddCheckTime(iNowTime) g_iCheckTime = iNowTime else: dictGameKinds = {v: k for k, v in gameTypeMapping.items()} # 每5秒检查一次数据 if (iNowTime - g_iCheckTime) >= 5: # 获取比赛竞猜的相关配置数据 竞猜玩法(第一滴血等)、竞猜目标(A队B队) try: for var_match_type in listMatchType: try: if procVariable.debug: if not procVariable.dataDebug: strPostUrl = matchcenter_config.dataPlatformReleaseBaseUrlForDebug + matchcenter_config.dataPlatformPostGetMatchData.format( var_match_type) else: strPostUrl = matchcenter_config.dataPlatformDebugBaseUrl + matchcenter_config.dataPlatformPostGetMatchData.format(var_match_type) + \ matchcenter_config.debugAppend else: strPostUrl = matchcenter_config.dataPlatformReleaseBaseUrl + matchcenter_config.dataPlatformPostGetMatchData.format( var_match_type) strBeginTime = timeHelp.timestamp2Str(iNowTime) strEndTime = timeHelp.timestamp2Str( iNowTime + 86400 * matchcenter_config.getMatchPreDay) # 7天以后 dictParam = { 'matchId': -1, 'startTime': strBeginTime, 'endTime': strEndTime } dictPost = getPostFormat(dictParam) dictHeader = { 'Accept': 'text/html', 'Content-Type': 'application/x-www-form-urlencoded' } with aiohttp.Timeout(100): try: client = aiohttp.ClientSession( response_class=aiohttpClientResponseWrap) logging.debug( "data center [{}]".format(strPostUrl)) # 请求数据中心的接口 result = yield from client.post( strPostUrl, data=dictPost, headers=dictHeader) if result.status != 200: logging.error( "get status[{}] game_type[{}]".format( result.status, var_match_type)) else: #print(dir(result)) response = yield from result.read( ) # 获取返回信息 #logging.debug(response) dictResponse = json.loads(response) dictData = dictResponse['data'] #print(dictData) if len(dictData) <= 0: continue for var_match_id, var_match_data in dictData.items( ): #查看本场比赛是否已经被添加进去 matchId = var_match_type + var_match_id bIsAdd = yield from objRedis.checkPreMatchIdExist( matchId, var_match_type) if bIsAdd: #logging.info("{} matchId have already added".format(matchId)) continue # 添加一个赛事 objNewMatchData = matchData.classMatchData( ) objNewMatchData.strMatchId = matchId objNewMatchData.iMatchState = 0 objNewMatchData.strMatchType = var_match_type objNewMatchData.strTeamAName = var_match_data[ 'team1Name'] objNewMatchData.strTeamBName = var_match_data[ 'team2Name'] objNewMatchData.iMatchState = 0 # 0:未开始 1:停止下注 2:比赛中 3:已结束 4:赛事被官方取消 5:后台主动关闭 var_match_data[ 'matchStartTime'] = var_match_data[ 'matchStartTime'] objNewMatchData.iMatchStartTimestamp = timeHelp.strToTimestamp( var_match_data['matchStartTime']) objNewMatchData.iMatchEndTimestamp = objNewMatchData.iMatchStartTimestamp + 3600 objNewMatchData.iTeamAScore = 0 objNewMatchData.iTeamBScore = 0 objNewMatchData.strMatchName = var_match_data[ 'eventName'] objNewMatchData.iMatchRoundNum = int( var_match_data['roundCount']) objNewMatchData.arrayGuess = [ ] # Guess GuessID = matchId + '_' + str(type) objNewMatchData.strTeamALogoUrl = var_match_data[ 'team1Logo'] objNewMatchData.strTeamBLogoUrl = var_match_data[ 'team2Logo'] #objNewMatchData.strTeamAId = var_match_data['team1Id'] #objNewMatchData.strTeamBId = var_match_data['team2Id'] yield from objRedis.addPreMatchForApproval( objNewMatchData) logging.info( "save new have not template match[{}] matchAName[{}] matchBName[{}]" .format( objNewMatchData.strMatchId, objNewMatchData.strTeamAName, objNewMatchData.strTeamBName)) finally: yield from client.close() except Exception as e: logging.error( repr(e) + str(" game_type {}".format(var_match_type))) logging.error(traceback.extract_stack()) continue finally: #yield from objRedis.setLastAddCheckTime(iNowTime) g_iCheckTime = iNowTime
def statistics_log(self): ''' 本函数是监视 bill.log 文件,需要处理这种异常: 如果两次调用中间隔天了,比如在 0409 00:01 时调用本函数,logserver 昨天会有部分记录无法读取, 这时候要返回去处理昨天的记录 :return: ''' now_time = timeHelp.getNow() self.file_seek_pos_change_flag = False if not timeHelp.isSameDay( now_time, self.last_update_time) or self.change_continue_flag: #隔日了,需要处理一下逻辑,免的丢一些数据源 #查看新的日志源 #-86400 是为了拼出上一天的日志名称,如 self.change_continue_flag = True newFileName = os.path.dirname( os.path.realpath(__file__)) + "/../logdata/bill.log" # newFileName = os.path.dirname(os.path.realpath(__file__)) + "/logdata/bill.log" oldFileName = newFileName + '.' + str( timeHelp.timestamp2Str(now_time - 86400, format="%Y-%m-%d")) flag, file_handle = self.try_change_file(oldFileName) #已经看到有滚的日志了,那么可以把这个被滚过的日志读取完毕 if flag: # 如果日志已经滚过了,这里需要修改成来的滚过的文件。并且读取完毕 self.change_file_by_handle(oldFileName, file_handle, self.file_seek_pos) ## 处理途中如果出错了就算了,记下日志 try: yield from self.read_all_lines() except Exception as e: #print('*** error when deal with {}: {}'.format(oldFileName, repr(e))) logging.exception(e) #这里立即入库一下,因为lastupdatetime还没有改动到新的一天,这次的 #file_pos_svr_id应该是隔日前一天的 #这里要注意的问题 above self.close_file() #做个保护 #如果日志滚上去了,但是新的日志并没有创建,但是 pos还是要归0,并记录到 mysql self.file_seek_pos = 0 self.last_change_time = timeHelp.getNow() yield from self.file_pos_db_by_param(newFileName, 0, now_time) self.change_continue_flag = False #切换到新的滚的日志handle while True: flag, file_handle = self.try_change_file(newFileName) if flag: self.change_file_by_handle(newFileName, file_handle, 0) break else: #10秒一次检查是否有隔日的日志可以扫 yield from asyncio.sleep(10) elif os.path.exists(oldFileName): logging.error('error: {} open file {} failed'.format( timeHelp.getNow(), oldFileName)) else: yield from self.read_lines() if self.file_seek_pos_change_flag: yield from self.file_pos_db() self.last_update_time = now_time
def handleHttp(dict_param: dict): strGuessId = dict_param['strGuessId'] objGuessData = yield from classDataBaseMgr.getInstance().getGuessData( strGuessId) if objGuessData is None: raise exceptionLogic(errorLogic.guess_data_not_found) objResp = gmProtocol.classGmMergeMatchDetailDataAndRecentPlayerData() objMatchDetailData = gmProtocol.classGmMatchDetailData() objMatchDetailData.strGuessId = strGuessId objMatchDetailData.iTotalJoin = 0 #yield from classDataBaseMgr.getInstance().getGuessBetAccountNum(strGuessId) iNowTime = timeHelp.getNow() list60BetMembers = yield from classDataBaseMgr.getInstance( ).getGuessMemberStaticListByScore(strGuessId, iNowTime - 60, iNowTime - 60 * 61) i60TotalBetCoin = 0 for var_bet in list60BetMembers: i60TotalBetCoin += var_bet['num'] listBetMembers = yield from classDataBaseMgr.getInstance( ).getGuessMemberStaticListByScore(strGuessId, iNowTime - 60, iNowTime - 60 * 61) iTotalBetCoin = 0 for var_bet in listBetMembers: iTotalBetCoin += var_bet['num'] #量比计算 objMatchDetailData.fEquivalenceRatio = 0 if i60TotalBetCoin <= 0 else iTotalBetCoin / i60TotalBetCoin fTempCalcRefund = 0 for var_ctr_key, var_ctr_value in objGuessData.dictCTR.items(): fTempCalcRefund += 1 / (var_ctr_value.fRate) objMatchDetailData.fRefund = round(1 / fTempCalcRefund, 2) objMatchDetailData.iLimitCoin = objGuessData.iLimitPerAccount objMatchDetailData.iRefundLock = objGuessData.iFixReturnRate listCTRIds = objGuessData.dictCTR.keys() for var_ctr_key in listCTRIds: listResult = yield from classDataBaseMgr.getInstance( ).getGraphBetRange(strGuessId, var_ctr_key, gmProtocol.graphRange) objMatchDetailData.dictGraphItem[var_ctr_key] = listResult #拿到所有的,不分类型的记录 listBetMembersMinute = yield from classDataBaseMgr.getInstance( ).getGuessMemberStaticListByScore(strGuessId, iNowTime, iNowTime - 60) #近一分钟内的 for var_ctr_key in listCTRIds: tempDict = {} for var_graph_rate in gmProtocol.graphRange: tempDict[var_graph_rate] = 0 #todo 优化 for var_bet_member in listBetMembersMinute: if var_bet_member['type'] == var_ctr_key: #不是本选择项的统计,忽略 fGraphIndex = gmProtocol.getGraphIndex(var_bet_member['rate']) if fGraphIndex in tempDict: tempDict[fGraphIndex] += var_bet_member["num"] else: tempDict[fGraphIndex] = var_bet_member["num"] objMatchDetailData.dictGraphItemLastMinute[var_ctr_key] = [ value for key, value in tempDict.items() ] iCursor = int(dict_param['iCursor']) iLen = yield from classDataBaseMgr.getInstance().getCurrentGuessMemberLen( strGuessId) if iCursor <= 0: iCursor = iLen - 10 if iCursor < 0: iCursor = 0 listCurrent = yield from classDataBaseMgr.getInstance( ).getCurrentGuessMember(strGuessId, iCursor, iLen) objRecentPlayerResp = gmProtocol.classGmRecentPlayerData() objRecentPlayerResp.iCursor = iLen if len(listCurrent) > 0: objGuessData = yield from classDataBaseMgr.getInstance().getGuessData( strGuessId) objResp.arrChooseName = list(objGuessData.dictCTR.keys()) for var_member in listCurrent: objNewData = gmProtocol.classGmRecentBetItem() objNewData.strAccountId = var_member["id"] objNewData.strChooseId = var_member["type"] objNewData.iBetNum = var_member["num"] objNewData.iTime = timeHelp.timestamp2Str(var_member["time"]) objNewData.fRate = var_member["rate"] objRecentPlayerResp.arrCurrentBetInfo.append(objNewData) objResp.data1 = objMatchDetailData objResp.data2 = objRecentPlayerResp return classJsonDump.dumps(objResp)