1
This commit is contained in:
parent
5975b21b5c
commit
143483634b
@ -233,7 +233,97 @@ void Guild::_CMGuildMemberList(f8::MsgHdr& hdr, const cs::CMGuildMemberList& msg
|
|||||||
|
|
||||||
void Guild::_CMGuildApplyList(f8::MsgHdr& hdr, const cs::CMGuildApplyList& msg)
|
void Guild::_CMGuildApplyList(f8::MsgHdr& hdr, const cs::CMGuildApplyList& msg)
|
||||||
{
|
{
|
||||||
cs::SMGuildApplyList respmsg;
|
auto on_ok =
|
||||||
|
[] (a8::XParams& param, const f8::DataSet* data_set)
|
||||||
|
{
|
||||||
|
cs::MFPaging* paging = (cs::MFPaging*)param.param2.GetUserData();
|
||||||
|
#if 0
|
||||||
|
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(param.sender.GetString());
|
||||||
|
if (hum && hum->socket_handle == param.param1.GetInt()) {
|
||||||
|
for (auto& row : *data_set) {
|
||||||
|
FriendApply* apply = new FriendApply;
|
||||||
|
apply->idx = a8::XValue(row[0]);
|
||||||
|
apply->applyid = a8::XValue(row[1]);
|
||||||
|
apply->target_id = row[2];
|
||||||
|
apply->base_data.account_id = row[3];
|
||||||
|
apply->base_data.nickname = row[4];
|
||||||
|
apply->base_data.avatar_url = row[5];
|
||||||
|
apply->base_data.sex = a8::XValue(row[6]);
|
||||||
|
apply->base_data.base_data_version = a8::XValue(row[7]);
|
||||||
|
apply->base_data.user_value1 = a8::XValue(row[8]);
|
||||||
|
apply->base_data.user_value2 = a8::XValue(row[9]);
|
||||||
|
apply->base_data.user_value3 = a8::XValue(row[10]);
|
||||||
|
hum->apply_hash_[apply->idx] = apply;
|
||||||
|
if (apply->idx > hum->last_apply_idx_) {
|
||||||
|
hum->last_apply_idx_ = apply->idx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cs::SMFriendApplyList respmsg;
|
||||||
|
hum->FillApplyList(*paging, respmsg);
|
||||||
|
hum->SendMsg(respmsg);
|
||||||
|
a8::UnSetBitFlag(hum->red_point_flags_, RPF_Apply);
|
||||||
|
hum->SyncRedPoint();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
delete paging;
|
||||||
|
};
|
||||||
|
auto on_error =
|
||||||
|
[] (a8::XParams& param, int error_code, const std::string& error_msg)
|
||||||
|
{
|
||||||
|
cs::MFPaging* paging = (cs::MFPaging*)param.param2.GetUserData();
|
||||||
|
#if 0
|
||||||
|
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(param.sender.GetString());
|
||||||
|
if (hum && hum->socket_handle == param.param1.GetInt()) {
|
||||||
|
cs::SMFriendApplyList respmsg;
|
||||||
|
hum->FillApplyList(*paging, respmsg);
|
||||||
|
hum->SendMsg(respmsg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
delete paging;
|
||||||
|
};
|
||||||
|
|
||||||
|
ss::SS_IM_ForwardGuildCMMsg *forward_msg = (ss::SS_IM_ForwardGuildCMMsg*)hdr.user_data;
|
||||||
|
|
||||||
|
cs::MFPaging* paging_copy = new cs::MFPaging;
|
||||||
|
*paging_copy = msg.paging();
|
||||||
|
#if 1
|
||||||
|
paging_copy->set_curr_page(0);
|
||||||
|
paging_copy->set_page_size(20);
|
||||||
|
#endif
|
||||||
|
a8::XObject conn_info = DBEngine::Instance()->GetConnInfo(guild_id);
|
||||||
|
std::string fmtstr = "SELECT '' AS account_id";
|
||||||
|
std::vector<a8::XValue> sql_params;
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
for (auto& pair : black_hash_) {
|
||||||
|
fmtstr += " UNION SELECT '%s'";
|
||||||
|
sql_params.push_back(a8::XValue(pair.second->base_data.account_id));
|
||||||
|
}
|
||||||
|
sql_params.push_back(a8::XValue(last_apply_idx_));
|
||||||
|
sql_params.push_back(a8::XValue(myself.base_data.account_id));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
DBEngine::Instance()->ExecAsyncQuery
|
||||||
|
(
|
||||||
|
conn_info,
|
||||||
|
(
|
||||||
|
"SELECT A.idx, A.applyid, A.target_id, A.sender_id, A.sender_nickname, "
|
||||||
|
" A.sender_avatar_url, A.sender_sex, A.sender_data_version1, "
|
||||||
|
" A.sender_user_value1, A.sender_user_value2, A.sender_user_value3, A.status "
|
||||||
|
"FROM guild_apply A "
|
||||||
|
" LEFT JOIN (" + fmtstr + ") AS B ON B.account_id = A.sender_id "
|
||||||
|
"WHERE A.idx > %d AND A.target_id='%s' AND A.status=0 AND "
|
||||||
|
" B.account_id IS NULL;"
|
||||||
|
).c_str(),
|
||||||
|
sql_params,
|
||||||
|
a8::XParams()
|
||||||
|
.SetSender(guild_id)
|
||||||
|
.SetParam1(0)
|
||||||
|
.SetParam2(paging_copy),
|
||||||
|
on_ok,
|
||||||
|
on_error,
|
||||||
|
guild_id
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::_CMGuildLog(f8::MsgHdr& hdr, const cs::CMGuildLog& msg)
|
void Guild::_CMGuildLog(f8::MsgHdr& hdr, const cs::CMGuildLog& msg)
|
||||||
|
@ -45,7 +45,8 @@ enum CMMessageId_e
|
|||||||
_CMGuildSearch = 239;
|
_CMGuildSearch = 239;
|
||||||
_CMGuildRank = 240;
|
_CMGuildRank = 240;
|
||||||
_CMGuildMemberList = 241;
|
_CMGuildMemberList = 241;
|
||||||
_CMGuildLog = 242;
|
_CMGuildApplyList = 242;
|
||||||
|
_CMGuildLog = 243;
|
||||||
_CMGuildMsgEnd = 270;
|
_CMGuildMsgEnd = 270;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +90,8 @@ enum SMMessageId_e
|
|||||||
_SMGuildSearch = 239;
|
_SMGuildSearch = 239;
|
||||||
_SMGuildRank = 240;
|
_SMGuildRank = 240;
|
||||||
_SMGuildMemberList = 241;
|
_SMGuildMemberList = 241;
|
||||||
_SMGuildLog = 242;
|
_SMGuildApplyList = 242;
|
||||||
|
_SMGuildLog = 243;
|
||||||
_SMGuildMsgEnd = 270;
|
_SMGuildMsgEnd = 270;
|
||||||
|
|
||||||
_SMUserStatusNotify = 501;
|
_SMUserStatusNotify = 501;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user