예제 #1
0
        try:
            channel_id = str(Channel.objects.get(channel_key=channel_id).id)
        except Exception, e:
            print 'get_channel_id error(%s) : %s ' % (channel_id, str(e))

    validate_card = ''
    print 'card_no', card_no
    print 'server_id', server_id
    print 'player_id', player_id
    print 'channel_id', channel_id
    print 'level', level
    try:
        if server_id != '' and card_no != '' and player_id != '' and re.match(
                '^\d+$', server_id):
            key = card_no[0:3]
            validate_card = Card.check_card(card_no)
            print 'validate_card', validate_card
            if validate_card and CardBatch.check_card_key(key):
                player_id = int(player_id)

                Card._meta.db_table = Card.get_card_table_name(key)
                the_card = Card.objects.using('card').extra(where=[
                    "number = '%s' and (status <> -1 ) or status IS NULL " %
                    card_no
                ])

                if the_card:
                    the_card = the_card[0]
                    the_card.use_count = the_card.get_use_count()
                    batch_id = the_card.batch.id
                    card_batch = CardBatch.objects.using('card').get(