1
This commit is contained in:
parent
bc1d54efaa
commit
b71480bacf
@ -838,10 +838,26 @@ void Player::SyncOtherFriend()
|
|||||||
|
|
||||||
void Player::ProcessEventTimerFunc()
|
void Player::ProcessEventTimerFunc()
|
||||||
{
|
{
|
||||||
|
if (curr_max_event_idx_ >= DBEngine::Instance()->GetEventCurrIdx(myself.crc32_code)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (last_event_idx_ >= curr_max_event_idx_) {
|
||||||
|
curr_max_event_idx_ = DBEngine::Instance()->GetEventCurrIdx(myself.crc32_code);
|
||||||
|
}
|
||||||
|
if (last_event_idx_ >= curr_max_event_idx_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto on_ok =
|
auto on_ok =
|
||||||
[] (a8::XParams& param, const f8::DataSet* data_set)
|
[] (a8::XParams& param, const f8::DataSet* data_set)
|
||||||
{
|
{
|
||||||
|
std::string account_id = param.sender.GetString();
|
||||||
|
long long curr_max_event_idx = param.param1;
|
||||||
|
long long last_event_idx = param.param2;
|
||||||
|
Player* hum = PlayerMgr::Instance()->GetPlayerByAccountId(account_id);
|
||||||
|
if (hum) {
|
||||||
|
hum->ProcessEvent(curr_max_event_idx, data_set);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
auto on_error =
|
auto on_error =
|
||||||
[] (a8::XParams& param, int error_code, const std::string& error_msg)
|
[] (a8::XParams& param, int error_code, const std::string& error_msg)
|
||||||
@ -854,16 +870,26 @@ void Player::ProcessEventTimerFunc()
|
|||||||
(
|
(
|
||||||
conn_info,
|
conn_info,
|
||||||
"SELECT idx, sender_id, target_id, event_name, param1, param2, "
|
"SELECT idx, sender_id, target_id, event_name, param1, param2, "
|
||||||
" param3, event_data, status, createtime"
|
" param3, event_data, status, createtime "
|
||||||
"FROM `event' WHERE idx > %d AND target_id='%s' AND status=0;",
|
"FROM `event' WHERE idx > %d AND target_id='%s' AND status=0;",
|
||||||
{
|
{
|
||||||
last_event_idx_,
|
last_event_idx_,
|
||||||
myself.base_data.account_id
|
myself.base_data.account_id
|
||||||
},
|
},
|
||||||
a8::XParams()
|
a8::XParams()
|
||||||
.SetSender(myself.base_data.account_id),
|
.SetSender(myself.base_data.account_id)
|
||||||
|
.SetParam1(curr_max_event_idx_)
|
||||||
|
.SetParam1(last_event_idx_),
|
||||||
on_ok,
|
on_ok,
|
||||||
on_error,
|
on_error,
|
||||||
myself.crc32_code
|
myself.crc32_code
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::ProcessEvent(long long max_event_idx, const f8::DataSet* data_set)
|
||||||
|
{
|
||||||
|
curr_max_event_idx_ = max_event_idx;
|
||||||
|
if (data_set) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -120,6 +120,7 @@ private:
|
|||||||
void PushFriendList();
|
void PushFriendList();
|
||||||
void SyncOtherFriend();
|
void SyncOtherFriend();
|
||||||
void ProcessEventTimerFunc();
|
void ProcessEventTimerFunc();
|
||||||
|
void ProcessEvent(long long max_event_idx, const f8::DataSet* data_set);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool dirty_ = false;
|
bool dirty_ = false;
|
||||||
@ -127,6 +128,7 @@ private:
|
|||||||
timer_list* update_user_info_timer_ = nullptr;
|
timer_list* update_user_info_timer_ = nullptr;
|
||||||
long long last_apply_idx_ = 0;
|
long long last_apply_idx_ = 0;
|
||||||
long long last_event_idx_ = 0;
|
long long last_event_idx_ = 0;
|
||||||
|
long long curr_max_event_idx_ = 0;
|
||||||
|
|
||||||
std::map<std::string, Friend*> friend_hash_;
|
std::map<std::string, Friend*> friend_hash_;
|
||||||
std::map<long long, FriendApply*> apply_hash_;
|
std::map<long long, FriendApply*> apply_hash_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user