1
This commit is contained in:
parent
9c71885dab
commit
729e7934a7
@ -197,6 +197,30 @@ void DBHelper::ConfirmGuild(Player* hum, long long guild_id)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DBHelper::UpdateUserGuild(const std::string& account_id, long long guild_id, int guild_job)
|
||||||
|
{
|
||||||
|
unsigned int crc32_code = a8::openssl::Crc32
|
||||||
|
(
|
||||||
|
(unsigned char*)account_id.data(),
|
||||||
|
account_id.size()
|
||||||
|
);
|
||||||
|
a8::XObject conn_info = DBEngine::Instance()->GetConnInfo(crc32_code);
|
||||||
|
DBEngine::Instance()->ExecAsyncScript
|
||||||
|
(
|
||||||
|
conn_info,
|
||||||
|
"UPDATE `user` SET guild_id=%d WHERE guild_job='%d' WHERE account_id='%s';",
|
||||||
|
{
|
||||||
|
guild_id,
|
||||||
|
guild_job,
|
||||||
|
account_id
|
||||||
|
},
|
||||||
|
a8::XParams(),
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
crc32_code
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void DBHelper::AddFriendApply(Player* hum, const std::string& target_id)
|
void DBHelper::AddFriendApply(Player* hum, const std::string& target_id)
|
||||||
{
|
{
|
||||||
auto on_ok =
|
auto on_ok =
|
||||||
|
@ -38,6 +38,7 @@ class DBHelper : public a8::Singleton<DBHelper>
|
|||||||
long long guild_id,
|
long long guild_id,
|
||||||
int status);
|
int status);
|
||||||
void ConfirmGuild(Player* hum, long long guild_id);
|
void ConfirmGuild(Player* hum, long long guild_id);
|
||||||
|
void UpdateUserGuild(const std::string& account_id, long long guild_id, int guild_job);
|
||||||
void AddFriendApply(Player* hum, const std::string& target_id);
|
void AddFriendApply(Player* hum, const std::string& target_id);
|
||||||
void AddGuildApply(Guild* guild, const cs::MFUserInfo& user_info);
|
void AddGuildApply(Guild* guild, const cs::MFUserInfo& user_info);
|
||||||
void AddEvent(const std::string& sender_id,
|
void AddEvent(const std::string& sender_id,
|
||||||
|
@ -319,7 +319,7 @@ void Guild::_CMGuildAgree(f8::MsgHdr& hdr, const cs::CMGuildAgree& msg)
|
|||||||
DBEngine::Instance()->ExecAsyncQuery
|
DBEngine::Instance()->ExecAsyncQuery
|
||||||
(
|
(
|
||||||
conn_info,
|
conn_info,
|
||||||
"SELECT guild_id, guild_job WHERE account_id='%s' AND guild_id != 0;",
|
"SELECT guild_id, guild_job FROM `user` WHERE account_id='%s' AND guild_id != 0;",
|
||||||
{
|
{
|
||||||
msg.apply().base_data().account_id()
|
msg.apply().base_data().account_id()
|
||||||
},
|
},
|
||||||
@ -1488,4 +1488,9 @@ void Guild::GuildAgreeCb(int socket_handle, const ss::MFIMMsgConext& context, co
|
|||||||
kGuildApplyAgree
|
kGuildApplyAgree
|
||||||
);
|
);
|
||||||
ClearApplyBySenderId(msg.apply().base_data().account_id());
|
ClearApplyBySenderId(msg.apply().base_data().account_id());
|
||||||
|
SaveToDB();
|
||||||
|
DBHelper::Instance()->UpdateUserGuild(member->account_id,
|
||||||
|
GuildId(),
|
||||||
|
GetMemberJob(member->account_id)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user