Exemplo n.º 1
0
    def onUserLogin(cls, event):
        ftlog.debug("SkillLevelGift.onUserLogin: event=", event)

        # gameId = 6
        userId = event.userId
        clientId = sessiondata.getClientId(userId)
        gameId = strutil.getGameIdFromHallClientId(clientId)
        ddzconf = cls.getDdzActivityConf()
        mapkey = "SkillLevelGift" + ddzconf.get("start", "")

        if gameId != DIZHU_GAMEID:
            return

        toggle = ddzconf.get("toggle", False)
        ftlog.debug("SkillLevelGift.onUserLogin: userId=", userId, "open_toggle=", toggle)
        if not toggle:
            return

        isFirst = Redis.isFirst(userId, mapkey)
        ftlog.debug("SkillLevelGift.onUserLogin: userId=", userId, "isFirst=", isFirst)
        if not isFirst:
            return

        # 发放道具
        mail = ddzconf.get("mail", "")
        assets = ddzconf.get("assets")
        UserBag.sendAssetsToUser(gameId, userId, assets, 'DDZ_ATC_SKILLLEVEL_GIFT', mail)
        ftlog.debug("SkillLevelGift.onUserLogin: userId=", userId, "send assets=", assets, "mail=", mail)
Exemplo n.º 2
0
    def onUserLogin(cls, event):
        ftlog.debug("ItemSender.onUserLogin: event=", event)

        userId = event.userId
        dizhuconf = cls.getDdzActivityConf()

        if not Tool.isGameDdz(userId):
            return

        if cls.isOutdate():
            ftlog.debug("ItemSender.onUserLogin: userId=", userId,
                        "isOutdate=", True)
            return

        # 若clientId不支持,则返回
        isSupport = cls.isClientIdSupport(
            userId, dizhuconf.get('supportContainClientIdOr', []))
        ftlog.debug("ItemSender.onUserLogin: userId=", userId, "isSupport=",
                    isSupport)
        if not isSupport:
            return

        isFirst = Redis.isFirst(userId, cls.getUniqueKey())
        ftlog.debug("ItemSender.onUserLogin: userId=", userId, "isFirst=",
                    isFirst)
        if not isFirst:
            return

        # 发放道具
        ftlog.debug("ItemSender.onUserLogin: userId=", userId, "ddzconf=",
                    dizhuconf)
        mail = dizhuconf.get("mail")
        assets = dizhuconf.get("assets")
        if not assets:
            return

        UserBag.sendAssetsToUser(DIZHU_GAMEID, userId, assets,
                                 'DDZ_ATC_ITEM_SENDER', mail)
        ftlog.debug("ItemSender.onUserLogin: userId=", userId, "send assets=",
                    assets, "mail=", mail)
Exemplo n.º 3
0
    def sendingRewardOnceIfNeed(cls, userId):
        ftlog.debug('BindingPhoneHandler.sendingRewardOnceIfNeed:start',
                    'userId=', userId, 'isOutdate=', cls.isOutdate())
        if cls.isOutdate():
            return None

        ## 是否在clientId集合中
        dizhuconf = cls.getActivityConfig()
        clientIdList = dizhuconf.get('clientIdList', [])
        clientId = sessiondata.getClientId(userId)
        ftlog.debug('BindingPhoneHandler.sendingRewardOnceIfNeed:clientId',
                    'userId=', userId, 'clientId=', clientId, 'ok=', clientId
                    in clientIdList)
        if clientId not in clientIdList:
            return None

        ## 是否是第一次领取
        isFirst = Redis.isFirst(userId, cls.getFieldKey())
        ftlog.debug('BindingPhoneHandler.sendingRewardOnceIfNeed:isFirst',
                    'userId=', userId, 'isFirst=', isFirst)
        if not isFirst:
            return None

        ## 发放奖励
        mail = dizhuconf.get('mail')
        assetsList = dizhuconf.get('assets')

        ftlog.debug('BindingPhoneHandler.sendingRewardOnceIfNeed:send',
                    'userId=', userId, 'dizhuconf=', dizhuconf)
        if not assetsList:
            return None

        UserBag.sendAssetsListToUser(DIZHU_GAMEID, userId, assetsList,
                                     cls.EVENT_ID, mail, cls.ACTIVITY_ID)
        ftlog.debug('BindingPhoneHandler.sendingRewardOnceIfNeed:end',
                    'userId=', userId, 'assetsList=', assetsList, 'mail=',
                    mail)

        return None