コード例 #1
0
def _sendReward(userId, invitee, count):
    userchip.incrCoupon(userId, HALL_GAMEID, count, ChipNotEnoughOpMode.NOOP,
                        'HALL_INVITEE_TASK_REWARD', invitee, None)
    datachangenotify.sendDataChangeNotify(HALL_GAMEID, userId, 'coupon')

    ftlog.info('SendInviteeTaskReward', 'userId=', userId, 'invitee=', invitee,
               'count=', count)
コード例 #2
0
def fixCoupon():
    userId = 11293
    target = 640
    nowCount = userchip.getCoupon(userId)
    if target < nowCount:
        userchip.incrCoupon(userId, HALL_GAMEID, target - nowCount,
                            ChipNotEnoughOpMode.NOOP,
                            'HALL_INVITEE_TASK_REWARD', 0, None)
        userdata.setAttr(userId, 'exchangedCoupon', 0)
コード例 #3
0
def _incrWinLoseCoupon(userId, deltaCount, roomId, clientId):
    trueDelta, finalCount = userchip.incrCoupon(
        userId, DIZHU_GAMEID, deltaCount,
        daoconst.CHIP_NOT_ENOUGH_OP_MODE_CLEAR_ZERO, 'COUPON_DIZHU_GAME_WIN',
        roomId, clientId)
    bireport.gcoin('in.coupon.gamewin', DIZHU_GAMEID, trueDelta)
    return trueDelta, finalCount
コード例 #4
0
ファイル: halluser.py プロジェクト: luningcowboy/tuyoo
def _moveHall51DataBack(userId, gameId, clientId):
    try:
        gameId = HALL_ID
        flag = gamedata.getGameAttrInt(userId, gameId, 'userChipMoveGame')
        ftlog.info('_moveHall51DataBack', userId, gameId, flag)
        if flag > 0:
            # 当前用户登录过HALL51
            chip, exp, charm, coupon = gamedata.getGameAttrs(
                userId, gameId, ['chip', 'exp', 'charm', 'coupon'])
            chip, exp, charm, coupon = strutil.parseInts(
                chip, exp, charm, coupon)
            ftlog.info('_moveHall51DataBack data->', userId, gameId, chip, exp,
                       charm, coupon)
            if charm > 0:
                userdata.incrCharm(userId, charm)
            if exp > 0:
                userdata.incrExp(userId, exp)
            if coupon > 0:
                trueDelta, finalCount = userchip.incrCoupon(
                    userId, gameId, coupon, userchip.ChipNotEnoughOpMode.NOOP,
                    userchip.EVENT_NAME_SYSTEM_REPAIR, 0, clientId)
                ftlog.info('_moveHall51DataBack data coupon->', userId, gameId,
                           coupon, trueDelta, finalCount)
            if chip > 0:
                trueDelta, finalCount = userchip.incrChip(
                    userId, gameId, chip, userchip.ChipNotEnoughOpMode.NOOP,
                    userchip.EVENT_NAME_SYSTEM_REPAIR, 0, clientId)
                ftlog.info('_moveHall51DataBack data chip->', userId, gameId,
                           chip, trueDelta, finalCount)
            gamedata.delGameAttrs(
                userId, gameId,
                ['chip', 'exp', 'charm', 'coupon', 'userChipMoveGame'])
            datachangenotify.sendDataChangeNotify(gameId, userId, 'chip')
    except:
        ftlog.error()
コード例 #5
0
ファイル: hallneituiguang.py プロジェクト: zhaozw/hall37
    def sendSingleOldUserPrize(cls, userId, gameId, chip, coupon):
        ftlog.info("sendSingleOldUserPrize userId=", userId, "gameId=", gameId, "chip=", chip, "coupon=", coupon)
        notify = []
        if chip != 0:
            userchip.incrChip(userId, gameId, chip, daoconst.CHIP_NOT_ENOUGH_OP_MODE_CLEAR_ZERO, 'ACTIVITY_REWARD', 0,
                              None)
            notify.append('chip')
            gamedata.incrGameAttr(userId, gameId, cls.attrname_succchip, chip)
            gamedata.incrGameAttr(userId, gameId, cls.attrname_failchip, -chip)
        if coupon != 0:
            userchip.incrCoupon(userId, gameId, coupon, daoconst.CHIP_NOT_ENOUGH_OP_MODE_NONE,
                                'COUPON_DIZHU_NEI_TUI_GUANG', 0, None)
            gamedata.incrGameAttr(userId, gameId, cls.attrname_succcoupon, coupon)
            gamedata.incrGameAttr(userId, gameId, cls.attrname_failcoupon, -coupon)
            notify.append('item')

        cls.updateNotify(gameId, userId, notify)
コード例 #6
0
ファイル: hallcoupon.py プロジェクト: zhaozw/hall37
    def exchangeCouponItem(self, userId, couponId, **kwargs):
        couponItem = self.findCouponItem(couponId)
        if not couponItem:
            if ftlog.is_debug():
                ftlog.debug('CouponService.exchangeCouponItem userId=', userId,
                            'couponId=', couponId,
                            'kwargs=', kwargs,
                            'gameId=', self.gameId,
                            'coupons=', self._couponItemMap.keys())
            raise TYBizException(-1, 'Not found couponId %s' % (couponId))

        if (couponItem.itemType == CouponItem.TYPE_PHONE_CARD
            and not kwargs.get('phone')):
            # 检查chargePhone参数
            raise TYBizException(-1, 'Please input phone number')

        # 减奖券
        trueDelta, final = pkuserchip.incrCoupon(userId, self.gameId, -couponItem.couponCount,
                                                 pkdaoconst.CHIP_NOT_ENOUGH_OP_MODE_NONE,
                                                 0, 0, 0)
        if -trueDelta < couponItem.couponCount:
            raise TYBizException(-1, 'Coupon not enough')

        if couponItem.itemType == CouponItem.TYPE_PHONE_CARD:
            phone = kwargs.get('phone')
            isCtyOk = sdkclient.couponCharge(self.gameId, userId, phone, '', '',
                                             couponItem.couponCount, couponItem.itemCount)
            if isCtyOk:
                mail = couponItem.mailOk
            else:
                mail = couponItem.mailFail
            if mail:
                mail = strutil.replaceParams(mail, {
                    'couponCount': str(couponItem.couponCount),
                    'itemCount': str(couponItem.itemCount),
                    'itemName': couponItem.itemName,
                    'phone': phone,
                    'qqGroup': self._qqGroup
                })
                pkmessage.send(HALL_GAMEID, pkmessage.MESSAGE_TYPE_SYSTEM, userId, mail)
                datachangenotify.sendDataChangeNotify(HALL_GAMEID, userId, 'message')
        elif couponItem.itemType == CouponItem.TYPE_ID_CHIP:
            pkuserchip.incrChip(userId, self.gameId, couponItem.itemCount,
                                pkdaoconst.CHIP_NOT_ENOUGH_OP_MODE_NONE,
                                0, 0, 0)
            mail = couponItem.mailOk
            if mail:
                mail = strutil.replaceParams(mail, {
                    'couponCount': str(couponItem.couponCount),
                    'itemCount': str(couponItem.itemCount),
                    'itemName': couponItem.itemName,
                    'qqGroup': self._qqGroup
                })
                pkmessage.send(HALL_GAMEID, pkmessage.MESSAGE_TYPE_SYSTEM, userId, mail)
                datachangenotify.sendDataChangeNotify(HALL_GAMEID, userId, 'message')
        return trueDelta, final
コード例 #7
0
    def sendSingleOldUserPrize(cls, userId, gameId, chip, coupon):
        ftlog.info("sendSingleOldUserPrize userId=", userId, "gameId=", gameId,
                   "chip=", chip, "coupon=", coupon)
        notify = []
        if chip != 0:
            userchip.incrChip(userId, gameId, chip,
                              daoconst.CHIP_NOT_ENOUGH_OP_MODE_CLEAR_ZERO,
                              'ACTIVITY_REWARD', 0, None)
            notify.append('chip')
            gamedata.incrGameAttr(userId, gameId, cls.attrname_succchip, chip)
            gamedata.incrGameAttr(userId, gameId, cls.attrname_failchip, -chip)
        if coupon != 0:
            userchip.incrCoupon(userId, gameId, coupon,
                                daoconst.CHIP_NOT_ENOUGH_OP_MODE_NONE,
                                'COUPON_DIZHU_NEI_TUI_GUANG', 0, None)
            gamedata.incrGameAttr(userId, gameId, cls.attrname_succcoupon,
                                  coupon)
            gamedata.incrGameAttr(userId, gameId, cls.attrname_failcoupon,
                                  -coupon)
            notify.append('item')

        cls.updateNotify(gameId, userId, notify)
コード例 #8
0
 def doGdssAddUserCoupon(self, userId, gameId, deltaCount, intEventParam):
     mo = MsgPack()
     mo.setResult('userId', userId)
     mo.setResult('gameId', gameId)
     mo.setResult('adjustDelta', deltaCount)
     mo.setResult('trueDelta', 0)
     mo.setResult('final', 0)
     ec, result = self.checkCode()
     if ec == 0:
         if deltaCount > 100000:
             mo.setError(1, 'coupon deltaCount to much !!')
         else:
             if userdata.checkUserData(userId):
                 trueDelta, final = userchip.incrCoupon(userId, gameId, deltaCount,
                                                        daoconst.CHIP_NOT_ENOUGH_OP_MODE_NONE,
                                                        'GM_ADJUST', intEventParam, configure.CLIENTID_SYSCMD)
                 mo.setResult('trueDelta', trueDelta)
                 mo.setResult('final', final)
             else:
                 mo.setError(2, 'userId error !!')
     if ec != 0:
         mo.setError(ec, result)
     return mo
コード例 #9
0
def fixCoupon():
    ls = [{
        "userId": 10130,
        "target": 640
    }, {
        "userId": 10061,
        "target": 740
    }, {
        "userId": 10003,
        "target": 740
    }, {
        "userId": 10093,
        "target": 640
    }, {
        "userId": 10133,
        "target": 640
    }, {
        "userId": 11434,
        "target": 640
    }, {
        "userId": 11426,
        "target": 640
    }, {
        "userId": 11395,
        "target": 640
    }, {
        "userId": 11146,
        "target": 640
    }, {
        "userId": 11345,
        "target": 640
    }, {
        "userId": 10831,
        "target": 640
    }, {
        "userId": 11252,
        "target": 640
    }, {
        "userId": 11370,
        "target": 640
    }, {
        "userId": 11359,
        "target": 640
    }, {
        "userId": 11316,
        "target": 640
    }, {
        "userId": 11302,
        "target": 640
    }, {
        "userId": 10968,
        "target": 980
    }, {
        "userId": 11292,
        "target": 640
    }, {
        "userId": 11258,
        "target": 640
    }, {
        "userId": 10186,
        "target": 640
    }, {
        "userId": 11251,
        "target": 640
    }, {
        "userId": 10064,
        "target": 980
    }, {
        "userId": 10071,
        "target": 1420
    }, {
        "userId": 10121,
        "target": 640
    }, {
        "userId": 10271,
        "target": 870
    }, {
        "userId": 10151,
        "target": 870
    }, {
        "userId": 10571,
        "target": 740
    }, {
        "userId": 10330,
        "target": 640
    }, {
        "userId": 11010,
        "target": 640
    }, {
        "userId": 10369,
        "target": 870
    }, {
        "userId": 10552,
        "target": 640
    }, {
        "userId": 10058,
        "target": 870
    }, {
        "userId": 10340,
        "target": 640
    }, {
        "userId": 10305,
        "target": 750
    }, {
        "userId": 11180,
        "target": 640
    }, {
        "userId": 10359,
        "target": 640
    }, {
        "userId": 11170,
        "target": 640
    }, {
        "userId": 11167,
        "target": 640
    }, {
        "userId": 12367,
        "target": 530
    }, {
        "userId": 12156,
        "target": 530
    }, {
        "userId": 12670,
        "target": 530
    }, {
        "userId": 12433,
        "target": 530
    }, {
        "userId": 12583,
        "target": 530
    }, {
        "userId": 12635,
        "target": 530
    }, {
        "userId": 12492,
        "target": 530
    }, {
        "userId": 12463,
        "target": 530
    }, {
        "userId": 12434,
        "target": 530
    }, {
        "userId": 12394,
        "target": 530
    }, {
        "userId": 12197,
        "target": 530
    }, {
        "userId": 12291,
        "target": 530
    }, {
        "userId": 12177,
        "target": 530
    }, {
        "userId": 11974,
        "target": 760
    }, {
        "userId": 12466,
        "target": 530
    }, {
        "userId": 12134,
        "target": 530
    }, {
        "userId": 12306,
        "target": 530
    }, {
        "userId": 12339,
        "target": 530
    }, {
        "userId": 12178,
        "target": 530
    }, {
        "userId": 12152,
        "target": 530
    }, {
        "userId": 11730,
        "target": 530
    }, {
        "userId": 12135,
        "target": 530
    }, {
        "userId": 12135,
        "target": 530
    }, {
        "userId": 11835,
        "target": 760
    }, {
        "userId": 11709,
        "target": 760
    }, {
        "userId": 10110,
        "target": 760
    }, {
        "userId": 11508,
        "target": 760
    }, {
        "userId": 10154,
        "target": 530
    }, {
        "userId": 11932,
        "target": 530
    }, {
        "userId": 11877,
        "target": 530
    }, {
        "userId": 11463,
        "target": 530
    }, {
        "userId": 11787,
        "target": 530
    }, {
        "userId": 11765,
        "target": 530
    }, {
        "userId": 11776,
        "target": 530
    }, {
        "userId": 10500,
        "target": 760
    }, {
        "userId": 11387,
        "target": 760
    }, {
        "userId": 10583,
        "target": 530
    }, {
        "userId": 11668,
        "target": 530
    }, {
        "userId": 11607,
        "target": 530
    }, {
        "userId": 11641,
        "target": 530
    }, {
        "userId": 11666,
        "target": 530
    }, {
        "userId": 11483,
        "target": 530
    }, {
        "userId": 11627,
        "target": 530
    }, {
        "userId": 10286,
        "target": 530
    }, {
        "userId": 11270,
        "target": 530
    }, {
        "userId": 10949,
        "target": 530
    }, {
        "userId": 10398,
        "target": 530
    }]

    for lNode in ls:
        userId = lNode['userId']
        target = lNode['target']
        nowCount = userchip.getCoupon(userId)
        if target > nowCount:
            continue

        userchip.incrCoupon(userId, HALL_GAMEID, target - nowCount,
                            ChipNotEnoughOpMode.NOOP,
                            'HALL_INVITEE_TASK_REWARD', 0, None)
        userdata.setAttr(userId, 'exchangedCoupon', 0)
コード例 #10
0
def fixCoupon():
    hUsers = [
        {'userId': 19274, 'count':926},
        {'userId': 29874, 'count':926},
        {'userId': 24844, 'count':926},
        {'userId': 28158, 'count':926},
        {'userId': 29593, 'count':926},
        {'userId': 24489, 'count':926},
        {'userId': 22459, 'count':926},
        {'userId': 20389, 'count':926},
        {'userId': 24155, 'count':926},
        {'userId': 29755, 'count':926},
        
        {'userId': 10138, 'count':926},
        {'userId': 12715, 'count':926},
        {'userId': 19313, 'count':926},
        {'userId': 22414, 'count':926},
        {'userId': 26982, 'count':926},
        {'userId': 15842, 'count':926},
        {'userId': 21920, 'count':926},
        {'userId': 28971, 'count':926},
        {'userId': 29533, 'count':926},
        {'userId': 29116, 'count':926},
        
        {'userId': 26033, 'count':926},
        {'userId': 24790, 'count':926},
        {'userId': 17400, 'count':926},
        {'userId': 29862, 'count':926},
        {'userId': 10271, 'count':926},
        {'userId': 14800, 'count':926},
        {'userId': 29835, 'count':926},
        {'userId': 25583, 'count':926},
        {'userId': 20964, 'count':926},
        {'userId': 26306, 'count':926},
        
        {'userId': 15786, 'count':926},
        {'userId': 20102, 'count':926},
        {'userId': 24844, 'count':926},
        {'userId': 15031, 'count':926},
        {'userId': 20906, 'count':926},
        {'userId': 24653, 'count':926},
        {'userId': 20420, 'count':926},
        {'userId': 23383, 'count':926},
        {'userId': 28964, 'count':926},
        {'userId': 15369, 'count':926},
        
        {'userId': 10626, 'count':926},
        {'userId': 29590, 'count':926},
        {'userId': 12537, 'count':926},
        {'userId': 21340, 'count':926},
        {'userId': 29740, 'count':926},
        {'userId': 10095, 'count':926},
        {'userId': 16038, 'count':926},
        {'userId': 20445, 'count':926},
        {'userId': 27527, 'count':926},
        {'userId': 29503, 'count':926},
        
        {'userId': 22447, 'count':926},
        {'userId': 29207, 'count':926},
        {'userId': 25352, 'count':926},
        {'userId': 10275, 'count':926},
        {'userId': 23383, 'count':926},
        {'userId': 22522, 'count':926},
        {'userId': 21620, 'count':926},
        {'userId': 28027, 'count':926},
        {'userId': 29149, 'count':926},
        {'userId': 15769, 'count':926},
        
        {'userId': 22286, 'count':926},
        {'userId': 29686, 'count':926},
        {'userId': 10260, 'count':926},
        {'userId': 10783, 'count':926},
        {'userId': 10684, 'count':926},
        {'userId': 29637, 'count':926},
        {'userId': 22319, 'count':926},
        {'userId': 20389, 'count':926},
        {'userId': 25763, 'count':926},
        {'userId': 18587, 'count':926},
        
        {'userId': 29286, 'count':926},
        {'userId': 22980, 'count':926},
        {'userId': 15643, 'count':926},
        {'userId': 25926, 'count':926},
        {'userId': 24011, 'count':926},
        {'userId': 11441, 'count':926},
        {'userId': 11169, 'count':926},
        {'userId': 22709, 'count':926},
        {'userId': 29639, 'count':926}
    ]
    
    for user in hUsers:
        userId = user['userId']
        count = user['count']
        
        userchip.incrCoupon(userId, HALL_GAMEID, count, ChipNotEnoughOpMode.NOOP,
                    'HALL_INVITEE_TASK_REWARD',
                    0,
                    None)
コード例 #11
0
ファイル: pcxqusers.py プロジェクト: luningcowboy/tuyoo
def do_xq_creat_new_user(snsId, chessExp, totalNum, winNum, loseNum, drawNum):
    
    uid = daobase.executeMixCmd('incrby', 'global.userid', 1)
    #assert(uid > 148670897)
    ct = datetime.now().strftime('%Y-%m-%d %H:%M:%S.%f')
    datas = {
             'password' : 'ty' + str(random.randint(100000, 999999)),
             'mdevid' : '',
             'isbind' : 1,
             'snsId' : snsId,
             'name' : '',
             'source' : '',
             'purl' : 'http://ddz.image.tuyoo.com/avatar/head_china.png',
             'address' : '',
             'sex' : 0,
             'state' : 0,
             'payCount' : 0,
             'snsinfo' : '',
             'vip' : 0,
             'dayang' : 0,
             'idcardno' : '',
             'phonenumber' : '',
             'truename' : '',
             'detect_phonenumber' : '',
             'email' : '',
             'createTime' : ct,
             'userAccount' : '',
             'clientId' : PCCLIENTID,
             'appId' : 9999,
             'bindMobile' : '',
             'mac' : '',
             'idfa' : '',
             'imei' : '',
             'androidId' : '',
             'uuid' : '',
             'userId' : uid,
             "lang" : '',
             "country" : "",
             "signature" : "",
             "agreeAddFriend" : 1,
#              "aliveTime" :  ct,
#              "exp" : 0,
#              "charm" : 0,
#              "diamond" : 0,
#              "chip" : 3000,
#              "coin" : 0
             }
#     attrlist = []
#     valuelist = []
#     for k, v in datas.items() :
#         attrlist.append(k)
#         valuelist.append(v)

    ftlog.info('PCXQ_USER', 'creat new user of->', uid, snsId)
    # userdata._setAttrsForce(uid, datas)
    userdata.setAttrs(uid, datas)
    userchip.incrChip(uid, 3, 3000, daoconst.CHIP_NOT_ENOUGH_OP_MODE_CLEAR_ZERO, 'SYSTEM_REPAIR', 0, PCCLIENTID)
    userchip.incrCoin(uid, 3, 0, daoconst.CHIP_NOT_ENOUGH_OP_MODE_CLEAR_ZERO, 'SYSTEM_REPAIR', 0, PCCLIENTID)
    userchip.incrDiamond(uid, 3, 0, daoconst.CHIP_NOT_ENOUGH_OP_MODE_CLEAR_ZERO, 'SYSTEM_REPAIR', 0, PCCLIENTID)
    userchip.incrCoupon(uid, 3, 0, daoconst.CHIP_NOT_ENOUGH_OP_MODE_CLEAR_ZERO, 'SYSTEM_REPAIR', 0, PCCLIENTID)
    userdata.incrCharm(uid, 0)
    userdata.incrExp(uid, 0)
    
    ikey = 'item2:9999:' + str(uid)
    for k, v in itemdatas.items() :
        daobase.executeUserCmd(uid, 'hset', ikey, k, v)
    daobase._executeKeyMapCmd('set', 'snsidmap:' + str(snsId), uid)
    
    creat_gamedata(uid, chessExp, totalNum, winNum, loseNum, drawNum)