Beispiel #1
0
def getCharacterIdByNickName(nickname):
    """根据昵称获取角色的id
    @param nickname: string 角色的昵称
    """
    sql = "select id from `tb_character` where nickname ='%s'"%nickname
    dbpool.fetchOne(sql)
    return result
Beispiel #2
0
def getCharacterIdByNickName(nickname):
    """根据昵称获取角色的id
    @param nickname: string 角色的昵称
    """
    sql = "select id from `tb_character` where nickname ='%s'" % nickname
    dbpool.fetchOne(sql)
    return result
Beispiel #3
0
def getPlayerSavMailCnd(characterId):
    """获取保存邮件的数量"""
    sql = "SELECT COUNT(id) FROM tb_mail WHERE receiverId = %d AND `isSaved`=1" % characterId
    result = dbpool.fetchOne(sql)

    conn.close()
    return result[0]
Beispiel #4
0
def getPlayerSavMailCnd(characterId):
    """获取保存邮件的数量"""
    sql = "SELECT COUNT(id) FROM tb_mail WHERE receiverId = %d AND `isSaved`=1"%characterId
    result = dbpool.fetchOne(sql)

    conn.close()
    return result[0]
Beispiel #5
0
def getCharacterArenaRank(characterId):
    """获取角色的排名
    """
    sql = "SELECT ranking from tb_arena where characterId = %d;"%(characterId)
    result = dbpool.fetchOne(sql)

    if result:
        return result[0]
    else:
        return 0
Beispiel #6
0
def checkMail(mailId,characterId):
    """检测邮件是否属于characterId
    @param characterId: int 角色的ID
    @param mailId: int 邮件的ID
    """
    sql = "SELECT `id` FROM tb_mail WHERE id = %d AND receiverId=%d"%(mailId,characterId)
    result = dbpool.fetchOne(sql)

    if result:
        return True
    return False
Beispiel #7
0
def getCharacterArenaRank(characterId):
    """获取角色的排名
    """
    sql = "SELECT ranking from tb_arena where characterId = %d;" % (
        characterId)
    result = dbpool.fetchOne(sql)

    if result:
        return result[0]
    else:
        return 0
Beispiel #8
0
def checkMail(mailId, characterId):
    """检测邮件是否属于characterId
    @param characterId: int 角色的ID
    @param mailId: int 邮件的ID
    """
    sql = "SELECT `id` FROM tb_mail WHERE id = %d AND receiverId=%d" % (
        mailId, characterId)
    result = dbpool.fetchOne(sql)

    if result:
        return True
    return False
Beispiel #9
0
def getCharacterArenaInfo(characterId):
    """获取角色竞技场信息
    @param characterId: int 角色的ID
    """
    sql = "SELECT * FROM tb_arena where characterId =%d"%characterId
    result = dbpool.fetchOne(sql, 1)

    if not result:
        insertCharacterArenaInfo(characterId)
        result = {'characterId':characterId,'score':0,'liansheng':0,
                  'lastresult':0,'lasttime':datetime.datetime(2012,6,20,12),
                  'ranking':0,'surplustimes':15,'buytimes':0,'receive':0,
                  'recorddate':datetime.date.today()}
    return result
Beispiel #10
0
def getCharacterArenaInfo(characterId):
    """获取角色竞技场信息
    @param characterId: int 角色的ID
    """
    sql = "SELECT * FROM tb_arena where characterId =%d" % characterId
    result = dbpool.fetchOne(sql, 1)

    if not result:
        insertCharacterArenaInfo(characterId)
        result = {
            'characterId': characterId,
            'score': 0,
            'liansheng': 0,
            'lastresult': 0,
            'lasttime': datetime.datetime(2012, 6, 20, 12),
            'ranking': 0,
            'surplustimes': 15,
            'buytimes': 0,
            'receive': 0,
            'recorddate': datetime.date.today()
        }
    return result
Beispiel #11
0
def getPlayerAllMailCnd(characterId):
    """获取玩家所有邮件的数量"""
    sql = "SELECT COUNT(`id`) FROM tb_mail WHERE receiverId = %d and isSaved = 0" % characterId
    result = dbpool.fetchOne(sql)

    return result[0]
Beispiel #12
0
def getPlayerAllMailCnd(characterId):
    """获取玩家所有邮件的数量"""
    sql = "SELECT COUNT(`id`) FROM tb_mail WHERE receiverId = %d and isSaved = 0"%characterId
    result = dbpool.fetchOne(sql)

    return result[0]
Beispiel #13
0
def getPlayerSysMailCnd(characterId):
    """获取角色系统邮件数量"""
    sql = "SELECT COUNT(id) FROM tb_mail WHERE receiverId = %d AND `type`=0  and isSaved = 0"%characterId
    result = dbpool.fetchOne(sql)

    return result[0]
Beispiel #14
0
def getMailInfo(mailId):
    """获取邮件详细信息"""
    sql = "select * from `tb_mail` where id = %d"%(mailId)
    result = dbpool.fetchOne(sql, 1)

    return result
Beispiel #15
0
def getSkillEffectByID(skillEffectID):
    """获取技能效果ID"""
    sql = "SELECT * FROM tb_skill_effect where effectId=%d"%skillEffectID
    result = dbpool.fetchOne(sql, 1)

    return result
Beispiel #16
0
def getBuffEffect(buffEffectID):
    """获取buff效果"""
    sql = "SELECT * FROM tb_buff_effect where buffEffectID = %d"%buffEffectID
    result = dbpool.fetchOne(sql, 1)

    return result
Beispiel #17
0
def getMailInfo(mailId):
    """获取邮件详细信息"""
    sql = "select * from `tb_mail` where id = %d" % (mailId)
    result = dbpool.fetchOne(sql, 1)

    return result
Beispiel #18
0
def getPlayerSysMailCnd(characterId):
    """获取角色系统邮件数量"""
    sql = "SELECT COUNT(id) FROM tb_mail WHERE receiverId = %d AND `type`=0  and isSaved = 0" % characterId
    result = dbpool.fetchOne(sql)

    return result[0]