Exemple #1
0
    def _handleSigninFeeNotEnoughException(cls, room, ex, uid, mo):
        payOrder = ex.fee.getParam('payOrder')

        clientId = sessiondata.getClientId(uid)
        clientOs, _clientVer, _ = strutil.parseClientId(clientId)
        msg = runcmd.getMsgPack()
        ddzver = msg.getParam('ddzver', 0) if msg else 0

        ftlog.debug("groupmatch._handleSigninFeeNotEnoughException", "userId", uid, "_clientVer=", _clientVer)
        if ddzver >= 3.772:
            cls._handleSigninFeeNotEnoughException_V3_772(room, ex, uid, mo)
            return

        if payOrder:
            clientOs = clientOs.lower()
            product, _shelves = hallstore.findProductByPayOrder(room.gameId, uid, clientId, payOrder)
            if product:
                buyType = ''
                btnTxt = ''
                if ex.fee.assetKindId == hallitem.ASSET_CHIP_KIND_ID and clientOs == 'winpc':
                    user_diamond = userdata.getAttrInt(uid, 'diamond')
                    if user_diamond >= int(product.priceDiamond):
                        buyType = 'consume'
                        btnTxt = '兑换'
                    else:
                        buyType = 'charge'
                        btnTxt = '去充值'
                orderShow = TodoTaskOrderShow.makeByProduct(ex.fee.failure, '', product, buyType)
                orderShow.setParam('sub_action_btn_text', btnTxt)
                mo = TodoTaskHelper.makeTodoTaskMsg(room.gameId, uid, orderShow)
                router.sendToUser(mo, uid)
                return True
        mo = TodoTaskHelper.makeTodoTaskMsg(room.gameId, uid, TodoTaskShowInfo(ex.fee.failure))
        router.sendToUser(mo, uid)
Exemple #2
0
 def _processEvent(self, event, timestamp):
     # 充值达到chargeTotal
     if (isinstance(event, (EventUserLogin, ChargeNotifyEvent))
         and userdata.getAttrInt(event.userId, 'chargeTotal') >= self.minCharge):
         self.finishTime = timestamp
         self.gainTime = 0
         return True
     return False
Exemple #3
0
    def checkMatchRank(cls, userId, matchId, rank):
        matchId = gdata.getBigRoomId(matchId)
        lottery_conf = dizhuconf.getMatchLotteryConf()
        lottery_switch = lottery_conf.get('open')
        if not lottery_switch:
            return False

        # 钻石数量为0触发
        user_diamond = userdata.getAttrInt(userId, 'diamond')
        if user_diamond != 0:
            return False

        # 身上没有任何报名券 触发
        discount_conf = lottery_conf.get('discountItem', [])
        if not discount_conf:
            return False

        for discountItem in discount_conf:
            itemId = discountItem.get('itemId')
            userHaveAssetsCount = UserBag.getAssetsCount(userId, itemId)
            if userHaveAssetsCount != 0:
                return False

        match_conf = lottery_conf.get('matchList', {}).get(str(matchId), [])
        if not match_conf:
            return False
        for conf in match_conf:
            beginRank = conf['beginRank']
            endRank = conf['endRank']
            if beginRank <= rank <= endRank:
                if ftlog.is_debug():
                    ftlog.debug('checkMatchRank userId=', userId, 'matchId=', matchId, 'return True')
                return True

        # 若是客户端请求则需要验证排名信息
        # histories = MatchHistoryHandler.getMatchHistory(userId, recordId, 1, mixId)
        # for history in histories:
        #     recordRank = history.get('rank')
        #     if rank != recordRank:
        #         return False
        #     timestamp = history.get('timestamp')
        #     currtimestamp = pktimestamp.getCurrentTimestamp()
        #     if (currtimestamp - timestamp) > 300:
        #         return False

        if ftlog.is_debug():
            ftlog.debug('checkMatchRank userId=', userId, 'matchId=', matchId, 'return False')
        return False
Exemple #4
0
    def _handleSigninFeeNotEnoughException(self, ex, userId, mo):
        payOrder = ex.fee.getParam('payOrder')
        clientId = sessiondata.getClientId(userId)
        clientOs, _clientVer, _ = strutil.parseClientId(clientId)
        msg = runcmd.getMsgPack()
        ddzver = msg.getParam('ddzver', 0) if msg else 0

        if ftlog.is_debug():
            ftlog.debug(
                'DizhuErdayiMatchCtrlRoom._handleSigninFeeNotEnoughException',
                'roomId=', self.roomId, 'userId=', userId, 'feeItem=',
                ex.fee.assetKindId, 'feeParams=', ex.fee.params)

        if ddzver >= 3.772:
            self._handleSigninFeeNotEnoughException_V3_772(ex, userId, mo)
            return

        if payOrder:
            clientOs = clientOs.lower()
            product, _shelves = hallstore.findProductByPayOrder(
                self.gameId, userId, clientId, payOrder)
            if product:
                buyType = ''
                btnTxt = ''
                if ex.fee.assetKindId == hallitem.ASSET_CHIP_KIND_ID and clientOs == 'winpc':
                    user_diamond = userdata.getAttrInt(userId, 'diamond')
                    if user_diamond >= int(product.priceDiamond):
                        buyType = 'consume'
                        btnTxt = '兑换'
                    else:
                        buyType = 'charge'
                        btnTxt = '去充值'
                orderShow = TodoTaskOrderShow.makeByProduct(
                    ex.fee.failure, '', product, buyType)
                orderShow.setParam('sub_action_btn_text', btnTxt)
                mp = TodoTaskHelper.makeTodoTaskMsg(self.gameId, userId,
                                                    orderShow)
                router.sendToUser(mp, userId)
                return True
        mp = TodoTaskHelper.makeTodoTaskMsg(self.gameId, userId,
                                            TodoTaskShowInfo(ex.fee.failure))
        router.sendToUser(mp, userId)