1
This commit is contained in:
parent
04bd31d0d5
commit
ccae0f7299
@ -4,8 +4,6 @@
|
|||||||
#include <a8/mutable_xobject.h>
|
#include <a8/mutable_xobject.h>
|
||||||
|
|
||||||
#include "guild.h"
|
#include "guild.h"
|
||||||
#include "cs_proto.pb.h"
|
|
||||||
#include "ss_proto.pb.h"
|
|
||||||
#include "dbengine.h"
|
#include "dbengine.h"
|
||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "guildmgr.h"
|
#include "guildmgr.h"
|
||||||
@ -156,7 +154,7 @@ void Guild::_CMGuildAgree(f8::MsgHdr& hdr, const cs::CMGuildAgree& msg)
|
|||||||
DBHelper::Instance()->SetGuildApplyStatus
|
DBHelper::Instance()->SetGuildApplyStatus
|
||||||
(
|
(
|
||||||
msg.apply().base_data().account_id(),
|
msg.apply().base_data().account_id(),
|
||||||
guild_id,
|
guild_id_,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@ -197,7 +195,7 @@ void Guild::_CMGuildAgree(f8::MsgHdr& hdr, const cs::CMGuildAgree& msg)
|
|||||||
DBHelper::Instance()->SetGuildApplyStatus
|
DBHelper::Instance()->SetGuildApplyStatus
|
||||||
(
|
(
|
||||||
msg.apply().base_data().account_id(),
|
msg.apply().base_data().account_id(),
|
||||||
guild_id,
|
guild_id_,
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
ClearApplyBySenderId(msg.apply().base_data().account_id());
|
ClearApplyBySenderId(msg.apply().base_data().account_id());
|
||||||
@ -283,13 +281,13 @@ void Guild::_CMGuildDismiss(f8::MsgHdr& hdr, const cs::CMGuildDismiss& msg)
|
|||||||
pair.second->account_id,
|
pair.second->account_id,
|
||||||
kGuildDismisss);
|
kGuildDismisss);
|
||||||
}
|
}
|
||||||
guild_status = kGuildDismissed;
|
guild_status_ = kGuildDismissed;
|
||||||
SaveToDB();
|
SaveToDB();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::_CMGuildRename(f8::MsgHdr& hdr, const cs::CMGuildRename& msg)
|
void Guild::_CMGuildRename(f8::MsgHdr& hdr, const cs::CMGuildRename& msg)
|
||||||
{
|
{
|
||||||
guild_name = msg.new_name();
|
guild_name_ = msg.new_name();
|
||||||
cs::SMGuildRename respmsg;
|
cs::SMGuildRename respmsg;
|
||||||
#if 0
|
#if 0
|
||||||
GuildMgr::Instance()->ForwardGuildSMMsg(socket_handle, context, respmsg);
|
GuildMgr::Instance()->ForwardGuildSMMsg(socket_handle, context, respmsg);
|
||||||
@ -381,12 +379,12 @@ void Guild::_CMGuildApplyList(f8::MsgHdr& hdr, const cs::CMGuildApplyList& msg)
|
|||||||
*paging_copy = msg.paging();
|
*paging_copy = msg.paging();
|
||||||
paging_copy->set_curr_page(0);
|
paging_copy->set_curr_page(0);
|
||||||
paging_copy->set_page_size(20);
|
paging_copy->set_page_size(20);
|
||||||
a8::XObject conn_info = DBEngine::Instance()->GetConnInfo(guild_id);
|
a8::XObject conn_info = DBEngine::Instance()->GetConnInfo(guild_id_);
|
||||||
std::string fmtstr = "SELECT '' AS account_id";
|
std::string fmtstr = "SELECT '' AS account_id";
|
||||||
std::vector<a8::XValue> sql_params;
|
std::vector<a8::XValue> sql_params;
|
||||||
{
|
{
|
||||||
sql_params.push_back(a8::XValue(last_apply_idx_));
|
sql_params.push_back(a8::XValue(last_apply_idx_));
|
||||||
sql_params.push_back(a8::XValue(guild_id));
|
sql_params.push_back(a8::XValue(guild_id_));
|
||||||
}
|
}
|
||||||
DBEngine::Instance()->ExecAsyncQuery
|
DBEngine::Instance()->ExecAsyncQuery
|
||||||
(
|
(
|
||||||
@ -402,13 +400,13 @@ void Guild::_CMGuildApplyList(f8::MsgHdr& hdr, const cs::CMGuildApplyList& msg)
|
|||||||
).c_str(),
|
).c_str(),
|
||||||
sql_params,
|
sql_params,
|
||||||
a8::XParams()
|
a8::XParams()
|
||||||
.SetSender(guild_id)
|
.SetSender(guild_id_)
|
||||||
.SetParam1(hdr.socket_handle)
|
.SetParam1(hdr.socket_handle)
|
||||||
.SetParam2(paging_copy)
|
.SetParam2(paging_copy)
|
||||||
.SetParam3(forward_msg_copy),
|
.SetParam3(forward_msg_copy),
|
||||||
on_ok,
|
on_ok,
|
||||||
on_error,
|
on_error,
|
||||||
guild_id
|
guild_id_
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,16 +433,16 @@ void Guild::_CMGuildLog(f8::MsgHdr& hdr, const cs::CMGuildLog& msg)
|
|||||||
|
|
||||||
void Guild::FillGuildBasic(cs::MFGuildBasic* guild_basic)
|
void Guild::FillGuildBasic(cs::MFGuildBasic* guild_basic)
|
||||||
{
|
{
|
||||||
guild_basic->set_guild_id(guild_id);
|
guild_basic->set_guild_id(guild_id_);
|
||||||
guild_basic->set_guild_name(guild_name);
|
guild_basic->set_guild_name(guild_name_);
|
||||||
guild_basic->set_guild_lv(guild_lv);
|
guild_basic->set_guild_lv(guild_lv_);
|
||||||
guild_basic->set_guild_exp(guild_exp);
|
guild_basic->set_guild_exp(guild_exp_);
|
||||||
guild_basic->set_guild_badge(guild_badge);
|
guild_basic->set_guild_badge(guild_badge_);
|
||||||
guild_basic->set_member_num(member_hash_.size());
|
guild_basic->set_member_num(member_hash_.size());
|
||||||
guild_basic->set_guild_declaration(guild_declaration);
|
guild_basic->set_guild_declaration(guild_declaration_);
|
||||||
guild_basic->set_guild_owner_id(owner_id);
|
guild_basic->set_guild_owner_id(owner_id_);
|
||||||
guild_basic->set_guild_owner_name(owner_name);
|
guild_basic->set_guild_owner_name(owner_name_);
|
||||||
guild_basic->set_guild_owner_avatar_url(owner_avatar_url);
|
guild_basic->set_guild_owner_avatar_url(owner_avatar_url_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::FillGuildDB(ss::MFGuildDB& guild_pb)
|
void Guild::FillGuildDB(ss::MFGuildDB& guild_pb)
|
||||||
@ -496,7 +494,7 @@ void Guild::SaveToDB()
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
a8::XObject conn_info = DBEngine::Instance()->GetConnInfo(guild_id);
|
a8::XObject conn_info = DBEngine::Instance()->GetConnInfo(guild_id_);
|
||||||
DBEngine::Instance()->ExecAsyncScript
|
DBEngine::Instance()->ExecAsyncScript
|
||||||
(
|
(
|
||||||
conn_info,
|
conn_info,
|
||||||
@ -507,30 +505,30 @@ void Guild::SaveToDB()
|
|||||||
" modifytime=%d "
|
" modifytime=%d "
|
||||||
"WHERE guild_id=%d;",
|
"WHERE guild_id=%d;",
|
||||||
{
|
{
|
||||||
guild_name,
|
guild_name_,
|
||||||
guild_lv,
|
guild_lv_,
|
||||||
guild_exp,
|
guild_exp_,
|
||||||
guild_badge,
|
guild_badge_,
|
||||||
guild_apply_num,
|
guild_apply_num_,
|
||||||
guild_members,
|
guild_members,
|
||||||
guild_notice,
|
guild_notice_,
|
||||||
guild_declaration,
|
guild_declaration_,
|
||||||
guild_log,
|
guild_log,
|
||||||
owner_id,
|
owner_id_,
|
||||||
owner_name,
|
owner_name_,
|
||||||
owner_avatar_url,
|
owner_avatar_url_,
|
||||||
creator_id,
|
creator_id_,
|
||||||
creator_name,
|
creator_name_,
|
||||||
creator_avatar_url,
|
creator_avatar_url_,
|
||||||
guild_data,
|
guild_data,
|
||||||
guild_status,
|
guild_status_,
|
||||||
App::Instance()->nowtime,
|
App::Instance()->nowtime,
|
||||||
guild_id
|
guild_id_
|
||||||
},
|
},
|
||||||
a8::XParams(),
|
a8::XParams(),
|
||||||
on_ok,
|
on_ok,
|
||||||
on_error,
|
on_error,
|
||||||
guild_id
|
guild_id_
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,33 +2,8 @@
|
|||||||
|
|
||||||
#include <a8/timer_attacher.h>
|
#include <a8/timer_attacher.h>
|
||||||
|
|
||||||
namespace cs
|
#include "cs_proto.pb.h"
|
||||||
{
|
#include "ss_proto.pb.h"
|
||||||
class MFPaging;
|
|
||||||
class MFGuildBasic;
|
|
||||||
class CMGuildInfo;
|
|
||||||
class CMGuildJoin;
|
|
||||||
class CMGuildAgree;
|
|
||||||
class CMGuildKick;
|
|
||||||
class CMGuildQuit;
|
|
||||||
class CMGuildDismiss;
|
|
||||||
class CMGuildRename;
|
|
||||||
class CMGuildMemberList;
|
|
||||||
class CMGuildApplyList;
|
|
||||||
class CMGuildLog;
|
|
||||||
class SMGuildApplyList;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ss
|
|
||||||
{
|
|
||||||
class MFIMMsgConext;
|
|
||||||
class MFGuildLogDB;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ss
|
|
||||||
{
|
|
||||||
class MFGuildDB;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct timer_list;
|
struct timer_list;
|
||||||
class Guild
|
class Guild
|
||||||
@ -52,7 +27,7 @@ public:
|
|||||||
void _CMGuildApplyList(f8::MsgHdr& hdr, const cs::CMGuildApplyList& msg);
|
void _CMGuildApplyList(f8::MsgHdr& hdr, const cs::CMGuildApplyList& msg);
|
||||||
void _CMGuildLog(f8::MsgHdr& hdr, const cs::CMGuildLog& msg);
|
void _CMGuildLog(f8::MsgHdr& hdr, const cs::CMGuildLog& msg);
|
||||||
|
|
||||||
long long GuildId() { return guild_id; }
|
long long GuildId() { return guild_id_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool IsFull();
|
bool IsFull();
|
||||||
@ -82,23 +57,23 @@ private:
|
|||||||
ss::MFGuildLogDB* logdb_ = nullptr;
|
ss::MFGuildLogDB* logdb_ = nullptr;
|
||||||
std::map<long long, GuildApply*> apply_hash_;
|
std::map<long long, GuildApply*> apply_hash_;
|
||||||
|
|
||||||
int gameid = 0;
|
int gameid_ = 0;
|
||||||
long long guild_id = 0;
|
long long guild_id_ = 0;
|
||||||
std::string guild_name;
|
std::string guild_name_;
|
||||||
int guild_lv = 0;
|
int guild_lv_ = 0;
|
||||||
int guild_exp = 0;
|
int guild_exp_ = 0;
|
||||||
int guild_badge = 0;
|
int guild_badge_ = 0;
|
||||||
int guild_apply_num = 0;
|
int guild_apply_num_ = 0;
|
||||||
std::string guild_notice;
|
std::string guild_notice_;
|
||||||
std::string guild_declaration;
|
std::string guild_declaration_;
|
||||||
std::string owner_id;
|
std::string owner_id_;
|
||||||
std::string owner_name;
|
std::string owner_name_;
|
||||||
std::string owner_avatar_url;
|
std::string owner_avatar_url_;
|
||||||
std::string creator_id;
|
std::string creator_id_;
|
||||||
std::string creator_name;
|
std::string creator_name_;
|
||||||
std::string creator_avatar_url;
|
std::string creator_avatar_url_;
|
||||||
int guild_status = 0;
|
int guild_status_ = 0;
|
||||||
int createtime = 0;
|
int createtime_ = 0;
|
||||||
|
|
||||||
a8::TimerAttacher timer_attacher_;
|
a8::TimerAttacher timer_attacher_;
|
||||||
|
|
||||||
|
@ -233,23 +233,23 @@ void GuildMgr::CreateGuild(int gameid,
|
|||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
Guild* guild = new Guild;
|
Guild* guild = new Guild;
|
||||||
guild->gameid = gameid;
|
guild->gameid_ = gameid;
|
||||||
guild->guild_id = guild_id;
|
guild->guild_id_ = guild_id;
|
||||||
guild->guild_name = guild_name;
|
guild->guild_name_ = guild_name;
|
||||||
guild->guild_lv = guild_lv;
|
guild->guild_lv_ = guild_lv;
|
||||||
guild->guild_exp = guild_exp;
|
guild->guild_exp_ = guild_exp;
|
||||||
guild->guild_badge = guild_badge;
|
guild->guild_badge_ = guild_badge;
|
||||||
guild->guild_apply_num = guild_apply_num;
|
guild->guild_apply_num_ = guild_apply_num;
|
||||||
guild->guild_notice = guild_notice;
|
guild->guild_notice_ = guild_notice;
|
||||||
guild->guild_declaration = guild_declaration;
|
guild->guild_declaration_ = guild_declaration;
|
||||||
guild->owner_id = owner_id;
|
guild->owner_id_ = owner_id;
|
||||||
guild->owner_name = owner_name;
|
guild->owner_name_ = owner_name;
|
||||||
guild->owner_avatar_url = owner_avatar_url;
|
guild->owner_avatar_url_ = owner_avatar_url;
|
||||||
guild->creator_id = creator_id;
|
guild->creator_id_ = creator_id;
|
||||||
guild->creator_name = creator_name;
|
guild->creator_name_ = creator_name;
|
||||||
guild->creator_avatar_url = creator_avatar_url;
|
guild->creator_avatar_url_ = creator_avatar_url;
|
||||||
guild->guild_status = guild_status;
|
guild->guild_status_ = guild_status;
|
||||||
guild->createtime = createtime;
|
guild->createtime_ = createtime;
|
||||||
//guild_members
|
//guild_members
|
||||||
guild->Deserialize(guild_data, guild_log);
|
guild->Deserialize(guild_data, guild_log);
|
||||||
id_hash_[guild_id] = guild;
|
id_hash_[guild_id] = guild;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user