bool NFCAccountRedisModule::CreateRole(const std::string & strAccount, const std::string & strRoleName, const NFGUID & id)
{
	std::string strAccountKey = m_pCommonRedisModule->GetAccountCacheKey(strAccount);
	NF_SHARE_PTR<NFINoSqlDriver> xNoSqlDriver = m_pNoSqlModule->GetDriverBySuit(strAccount);
	if (xNoSqlDriver)
	{
		if (xNoSqlDriver->Exists(strAccountKey) && !xNoSqlDriver->Exists(strRoleName))
		{
			xNoSqlDriver->HSet(strAccountKey, NFrame::Player::Name(), strRoleName);
			xNoSqlDriver->HSet(strAccountKey, NFrame::Player::ID(), id.ToString());

            NF_SHARE_PTR<NFINoSqlDriver> xRoleNameNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
            if (xRoleNameNoSqlDriver)
            {
                xRoleNameNoSqlDriver->HSet(strRoleName, NFrame::Player::ID(), id.ToString());
            }
			/*
			std::vector<std::string> vKey;
			std::vector<std::string> vValue;
			xNoSqlDriver->HMSet(m_pCommonRedisModule->GetPropertyCacheKey(id), vKey, vValue);
			xNoSqlDriver->HMSet(m_pCommonRedisModule->GetRecordCacheKey(id), vKey, vValue);
			xNoSqlDriver->HMSet(m_pCommonRedisModule->GetPropertyStorageKey(id), vKey, vValue);
			xNoSqlDriver->HMSet(m_pCommonRedisModule->GetRecordStorageKey(id), vKey, vValue);
			*/
			return true;
		}
	}

	return false;
}
bool NFCAccountRedisModule::AddAccount(const std::string & strAccount, const std::string & strPwd)
{
	std::string strAccountKey = m_pCommonRedisModule->GetAccountCacheKey(strAccount);
	NF_SHARE_PTR<NFINoSqlDriver> xNoSqlDriver = m_pNoSqlModule->GetDriverBySuit(strAccount);
	if (xNoSqlDriver)
	{
		return xNoSqlDriver->HSet(strAccountKey, "Password", strPwd);
	}
	return false;
}
bool NFCPVPMatchRedisModule::SetPlayerRoomID(const NFGUID& self, const NFGUID& xRoomID)
{
	NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
    if (pNoSqlDriver)
    {
        std::string strKey = MakePlayerRoomKey();
        return pNoSqlDriver->HSet(strKey, self.ToString(), xRoomID.ToString());
    }

    return false;
}
bool NFCPVPMatchRedisModule::SetStatusRoomID(const int nPVPMode, const int nGrade, const int nStatus, const NFGUID& xRoomID)
{
	NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
    if (pNoSqlDriver)
    {
        std::string strKey = MakeStatusRoomIDRedisKey(nPVPMode, nGrade, nStatus);
        std::string strData;

        std::vector<std::string> valueVec;
        if (pNoSqlDriver->HSet(strKey, xRoomID.ToString(), xRoomID.ToString()))
        {
            return true;
        }
    }

    return false;
}
bool NFCPVPMatchRedisModule::SetRoomInfo(const NFGUID& xRoomID, NFMsg::PVPRoomInfo& xRoomInfo)
{
	NF_SHARE_PTR<NFINoSqlDriver> pNoSqlDriver = m_pNoSqlModule->GetDriverBySuitConsistent();
    if (pNoSqlDriver)
    {
        std::string strKey = MakePvpRoomRedisKey();
        std::string strData;
        if (xRoomInfo.ParseFromString(strData))
        {
            if (pNoSqlDriver->HSet(strKey, xRoomID.ToString(), strData))
            {
                return true;
            }
        }
    }

    return false;
}