فهرست منبع

Merge branch 'master' of chensongchao/ya-serv into master

liheting 5 سال پیش
والد
کامیت
650280a02c
1فایلهای تغییر یافته به همراه15 افزوده شده و 0 حذف شده
  1. 15 0
      module_service/area_business_card_enter_or_leave.cpp

+ 15 - 0
module_service/area_business_card_enter_or_leave.cpp

@@ -40,7 +40,21 @@ void area_business_card_enter_or_leave::on_enter(const std::shared_ptr<area_hove
 void area_business_card_enter_or_leave::on_hover(const std::shared_ptr<area_hover>&a,
                                                  const std::shared_ptr<card_location_base>&c,std::shared_ptr<business_data> ptr)
 {
+    // 根据区域无法区分是否井上分站[分站创建的区域没有代入区域类型-导致都是井上区域] 只能通过分站区分
+    if (nullptr != c->get_area_tool()->m_site && c->get_area_tool()->m_site->is_up_site())
+    {
+        // 井上分站时,员工在行走过程中更新时间
+        char sql[LENGTH_SQL]{0};
+        std::string start_time = tool_time::to_str(a->m_enter_time/1000);
+        std::string end_time = tool_time::to_str(tool_time::now_to_seconds());
+        const auto &ep=a->m_last_point;
+        snprintf(sql,LENGTH_SQL,"UPDATE his_location_area SET leave_time='%s',end_point='%.2f,%.2f' \
+	                         WHERE  enter_time='%s' AND obj_id=%d AND area_id=%d;",
+                 end_time.c_str(),ep.x,ep.y,
+                 start_time.c_str(),c->m_cid,a->id());
 
+        db_tool::PushAsync(sql);
+    }
 }
 //出区域则入库
 void area_business_card_enter_or_leave::on_leave(const std::shared_ptr<area_hover>&a,
@@ -57,6 +71,7 @@ void area_business_card_enter_or_leave::on_leave(const std::shared_ptr<area_hove
 				start_time.c_str(),c->m_cid,a->id());
 
     log_info("card_enter_leave:%s",sql);
+
     db_tool::PushAsync(sql);
 }