Example #1
0
 def matchCheck(cls, matchId):
     '''
     比赛报名                
     GET:match/check               
     '''
     params = {
         'cp_id': str(PlayerControl.getConf('3rdapi.cpid')),
         'match_id': str(matchId),
     }
     host = PlayerControl.getConf('3rdapi.host')
     response = HttpGetRequest.request(host, 'match/check', params)
     ftlog.debug('Report3rdInterface.matchCheck:', 'matchId=', matchId,
                 'params=', params, 'path=match/check'
                 'response=', response)
     response = Erdayi3rdInterface.translateResponse(response)
     return response.get('resp_code'), response.get('resp_msg')
Example #2
0
 def reportRankFinish(cls, roomId, matchId):
     '''
     名次上传完毕
     match/ranks/sent
     '''
     params = {
         'cp_id': str(PlayerControl.getConf('3rdapi.cpid')),
         'match_id': str(matchId),
     }
     model = ReportEntryModel(ReportEntryModel.ReportType_RankFinish,
                              params)
     ReporterManager.getOrCreateReporter(roomId).enqueue(model)
Example #3
0
 def matchReg(cls, roomId, matchId, userId, userName):
     '''
     比赛报名                
     match/reg                
     '''
     params = {
         'cp_id': str(PlayerControl.getConf('3rdapi.cpid')),
         'match_id': str(matchId),
         'player_name': userName,
         'player_id': str(userId)
     }
     model = ReportEntryModel(ReportEntryModel.ReportType_MatchReg, params)
     ReporterManager.getOrCreateReporter(roomId).enqueue(model)
Example #4
0
    def haiXuanLevelUpList(cls, roomId, matchId, promotion_match_id,
                           promotion_player_list):
        '''
        海选赛晋级名单上报
        :param matchId: 晋级用户所参加的海选赛的20位比赛ID
        :param promotion_match_id: 晋级用户所要晋级到的某一场B级赛(或B级以上赛事)的18位比赛ID
        :param promotion_player_list: 最大200条(超出200条需分两次调接口上报)
        GET: match/promotion/ranks/send
        :return: 
        model = ReportEntryModel(ReportEntryModel.ReportType_Rank, params)
        ReporterManager.getOrCreateReporter(roomId).enqueue(model)
        '''
        playerIdList = []
        for playerInfo in promotion_player_list:
            if playerInfo.get('player_id'):
                playerIdList.append({"player_id": playerInfo.get('player_id')})

        params = {
            'cp_id': str(PlayerControl.getConf('3rdapi.cpid')),
            'match_id': str(matchId),
            'promotion_match_id': str(promotion_match_id),
            'promotion_player_list': playerIdList
        }

        model = ReportEntryModel(
            ReportEntryModel.ReportType_HaiXuanLevelUpList, params)
        ReporterManager.getOrCreateReporter(roomId).enqueue(model)

        host = PlayerControl.getConf('3rdapi.host')
        response = HttpGetRequest.request(host, 'match/promotion/ranks/send',
                                          params)
        response = Erdayi3rdInterface.translateResponse(response)
        if ftlog.is_debug():
            ftlog.debug('Report3rdInterface.haiXuanLevelUpList: matchId=',
                        matchId, 'params=', params,
                        'path=match/promotion/ranks/send. response=', response)

        return response.get('resp_code'), response.get('resp_msg')
Example #5
0
 def reportRank(cls, roomId, matchId, rankList):
     '''
     最终大排名结果上报
     match/ranks/send                
     '''
     ranks = rankList
     params = {
         'cp_id': str(PlayerControl.getConf('3rdapi.cpid')),
         'match_id': str(matchId),
         'ranks':
         ranks,  # (最大200条)[{'player_id':0, 'ranking': 1, 'status':'0'}]
     }
     model = ReportEntryModel(ReportEntryModel.ReportType_Rank, params)
     ReporterManager.getOrCreateReporter(roomId).enqueue(model)
Example #6
0
 def reportEviewRound(cls,
                      roomId,
                      matchId,
                      userId,
                      tableId,
                      cardPlayerId,
                      cardGroupId,
                      score,
                      mpscore,
                      mpRatio,
                      mpRatioRank,
                      mpRatioScore,
                      cardType,
                      cardHole=None):
     '''
     人机对局结果上报
     match/eview/round/send                          
     '''
     params = {
         'cp_id':
         str(PlayerControl.getConf('3rdapi.cpid')),
         'match_id':
         str(matchId),  # 厂商4位+ 平台自定义10位+厂商自定义6位
         'player_id':
         str(userId),
         'card_player_id':
         str(cardPlayerId),  # 纯数字, 从1开始顺序排列
         'card_group_id':
         str(cardGroupId),  # 纯数字, 从1开始顺序排列
         'card_desk_id':
         str(tableId),  # 纯数字, 从1开始顺序排列
         'card_score':
         '%.4f' % score,  # 纯数字,保留四位小数
         'mp_score':
         '%.4f' % mpscore,  # 纯数字,保留四位小数
         'mp_ratio':
         '%.4f' % mpRatio,  # 纯数字,保留四位小数
         'mp_ratio_rank':
         str(mpRatioRank),  # 纯数字(从1开始, 可重复)
         'mp_ratio_score':
         '%.4f' % mpRatioScore,  # 纯数字,保留四位小数
         'card_type':
         ','.join(map(lambda x: str(x), cardType)),
         'card_hole':
         ','.join(map(lambda x: str(x), cardHole))
         if cardHole else cardHole,  # (如果该条数据用户为庄家则字段必传,用户为防守方则不传)见数据字典
     }
     model = ReportEntryModel(ReportEntryModel.ReportType_EviewRound,
                              params)
     ReporterManager.getOrCreateReporter(roomId).enqueue(model)
Example #7
0
 def reportRoundRank(cls, roomId, matchId, stageIndex, rankList):
     '''
     移位排名结果上报        
     match/round/rank/send                        
     '''
     rank_list = rankList
     params = {
         'cp_id': str(PlayerControl.getConf('3rdapi.cpid')),
         'match_id': str(matchId),  # 厂商4位+ 平台自定义10位+厂商自定义6位
         'round_id': str(stageIndex),  # 纯数字, 从0开始顺序排列(每移位一次即+1)
         'rank_list':
         rank_list,  #(最大200条)[{'player_id':0, 'card_rank':1}, 'status':'0'] //'card_rank' 从1开始的纯数字(不可重复)
     }
     model = ReportEntryModel(ReportEntryModel.ReportType_RoundRank, params)
     ReporterManager.getOrCreateReporter(roomId).enqueue(model)
Example #8
0
    def _report(self, model):
        host = PlayerControl.getConf('3rdapi.host')
        path = model.getUrl()
        params = model.params
        ftlog.debug('AsyncReporter._report', 'path=', path, 'params=', params)
        try:
            response = HttpPostRequest.request(host, path, params)
            response = Erdayi3rdInterface.translateResponse(response)
        except:
            ftlog.error('AsyncReporter._report', 'path=', path, 'params=',
                        params)
        ftlog.debug('AsyncReporter._report', 'path=', path, 'params=', params,
                    'response=', response)

        return response.get('resp_code'), response.get('resp_msg')