|
@@ -26,6 +26,11 @@ private:
|
|
public:
|
|
public:
|
|
static void on_enter(uint32_t card_id,std::shared_ptr<area_hover>&c, int32_t type)
|
|
static void on_enter(uint32_t card_id,std::shared_ptr<area_hover>&c, int32_t type)
|
|
{
|
|
{
|
|
|
|
+ if(0==c->id() || 0==c->mapid())
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
auto card_ptr=card_list::instance()->get(card_list::to_id64(type, card_id));
|
|
auto card_ptr=card_list::instance()->get(card_list::to_id64(type, card_id));
|
|
if(!card_ptr)
|
|
if(!card_ptr)
|
|
{
|
|
{
|
|
@@ -33,6 +38,8 @@ public:
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ c->m_enter_time = card_ptr->m_time/1000;
|
|
|
|
+
|
|
if(card_ptr->is_person())//统计人卡
|
|
if(card_ptr->is_person())//统计人卡
|
|
{
|
|
{
|
|
c->m_area->m_person_count++;
|
|
c->m_area->m_person_count++;
|
|
@@ -49,10 +56,17 @@ public:
|
|
module_area_over_count::instance()->on_enter(card_ptr, c);
|
|
module_area_over_count::instance()->on_enter(card_ptr, c);
|
|
//区域超时
|
|
//区域超时
|
|
module_area_timeout::instance()->on_enter(card_ptr, c);
|
|
module_area_timeout::instance()->on_enter(card_ptr, c);
|
|
|
|
+
|
|
|
|
+ save_his_area_location_enter(card_ptr);
|
|
}
|
|
}
|
|
|
|
|
|
static void on_hover(uint32_t card_id,std::shared_ptr<area_hover>&c, int32_t type)
|
|
static void on_hover(uint32_t card_id,std::shared_ptr<area_hover>&c, int32_t type)
|
|
{
|
|
{
|
|
|
|
+ if(0==c->id() || 0==c->mapid())
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
auto card_ptr=card_list::instance()->get(card_list::to_id64(type, card_id));
|
|
auto card_ptr=card_list::instance()->get(card_list::to_id64(type, card_id));
|
|
if(!card_ptr)
|
|
if(!card_ptr)
|
|
{
|
|
{
|
|
@@ -60,15 +74,15 @@ public:
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
-// if(card_ptr->is_person())//人卡
|
|
|
|
-// {
|
|
|
|
|
|
+ // if(card_ptr->is_person())//人卡
|
|
|
|
+ // {
|
|
|
|
|
|
-// }
|
|
|
|
|
|
+ // }
|
|
|
|
|
|
-// if(card_ptr->is_vehicle())//车卡
|
|
|
|
-// {
|
|
|
|
|
|
+ // if(card_ptr->is_vehicle())//车卡
|
|
|
|
+ // {
|
|
|
|
|
|
-// }
|
|
|
|
|
|
+ // }
|
|
|
|
|
|
//区域超时
|
|
//区域超时
|
|
module_area_timeout::instance()->on_hover(card_ptr, c);
|
|
module_area_timeout::instance()->on_hover(card_ptr, c);
|
|
@@ -76,6 +90,11 @@ public:
|
|
|
|
|
|
static void on_leave(uint32_t card_id, std::shared_ptr<area_hover>&c, int32_t type)
|
|
static void on_leave(uint32_t card_id, std::shared_ptr<area_hover>&c, int32_t type)
|
|
{
|
|
{
|
|
|
|
+ if(0==c->id() || 0==c->mapid())
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
auto card_ptr=card_list::instance()->get(card_list::to_id64(type, card_id));
|
|
auto card_ptr=card_list::instance()->get(card_list::to_id64(type, card_id));
|
|
if(!card_ptr)
|
|
if(!card_ptr)
|
|
{
|
|
{
|
|
@@ -93,10 +112,57 @@ public:
|
|
c->m_area->m_vehicle_count--;
|
|
c->m_area->m_vehicle_count--;
|
|
}
|
|
}
|
|
|
|
|
|
- //区域人卡超员
|
|
|
|
|
|
+ //区域超员
|
|
module_area_over_count::instance()->on_leave(card_ptr, c);
|
|
module_area_over_count::instance()->on_leave(card_ptr, c);
|
|
- //区域人卡超时
|
|
|
|
|
|
+ //区域超时
|
|
module_area_timeout::instance()->on_leave(card_ptr, c);
|
|
module_area_timeout::instance()->on_leave(card_ptr, c);
|
|
|
|
+
|
|
|
|
+ save_his_area_location_leave(card_ptr);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ///入库
|
|
|
|
+ static void save_his_area_location_enter(const std::shared_ptr<card_location_base> card_ptr)
|
|
|
|
+ {
|
|
|
|
+ auto area_hover_ptr = card_ptr->get_area_hover();
|
|
|
|
+
|
|
|
|
+ char sql[LENGTH_SQL] = {0};
|
|
|
|
+
|
|
|
|
+ std::string call("add_area_staff");
|
|
|
|
+ if(card_ptr->is_vehicle())//车卡
|
|
|
|
+ {
|
|
|
|
+ call="add_area_vehicle";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ std::string start_str = tool_time::to_str_ex(static_cast<uint64_t>(area_hover_ptr->m_enter_time) *1000);
|
|
|
|
+
|
|
|
|
+ sprintf(sql, "CALL %s(%s, %d, %d, %d, '%s','%s');", call.c_str(),
|
|
|
|
+ card_list::to_id64_str(card_ptr->m_type, card_ptr->m_id).c_str(),
|
|
|
|
+ card_ptr->m_id, area_hover_ptr->id(), area_hover_ptr->mapid(), start_str.c_str(), start_str.c_str());
|
|
|
|
+
|
|
|
|
+ tool_db::PushAsync(sql);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ///入库
|
|
|
|
+ static void save_his_area_location_leave(const std::shared_ptr<card_location_base> card_ptr)
|
|
|
|
+ {
|
|
|
|
+ auto area_hover_ptr = card_ptr->get_area_hover();
|
|
|
|
+
|
|
|
|
+ char sql[LENGTH_SQL] = {0};
|
|
|
|
+
|
|
|
|
+ std::string call("add_area_staff");
|
|
|
|
+ if(card_ptr->is_vehicle())//车卡
|
|
|
|
+ {
|
|
|
|
+ call="add_area_vehicle";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ std::string start_str = tool_time::to_str_ex(static_cast<uint64_t>(area_hover_ptr->m_enter_time) *1000);
|
|
|
|
+ std::string end_str = tool_time::to_str_ex(card_ptr->m_time);
|
|
|
|
+
|
|
|
|
+ sprintf(sql, "CALL %s(%s, %d, %d, %d, '%s','%s');", call.c_str(),
|
|
|
|
+ card_list::to_id64_str(card_ptr->m_type, card_ptr->m_id).c_str(),
|
|
|
|
+ card_ptr->m_id, area_hover_ptr->id(), area_hover_ptr->mapid(), start_str.c_str(), end_str.c_str());
|
|
|
|
+
|
|
|
|
+ tool_db::PushAsync(sql);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|