Bladeren bron

修改 his_localtion_area

zzj 6 jaren geleden
bovenliggende
commit
1ed4cfd0c7
1 gewijzigde bestanden met toevoegingen van 11 en 5 verwijderingen
  1. 11 5
      module_service/area_business_card_enter_or_leave.cpp

+ 11 - 5
module_service/area_business_card_enter_or_leave.cpp

@@ -19,10 +19,12 @@ void area_business_card_enter_or_leave::on_enter(const std::shared_ptr<area_hove
 {
     char sql[LENGTH_SQL]{0};
     std::string start_time = tool_time::to_str_ex(a->m_enter_time);
-    std::string card_id = tool_other::type_id_to_str(c->m_type,c->m_id);
+//    std::string card_id = tool_other::type_id_to_str(c->m_type,c->m_id);
     const auto &p=a->m_enter_point;
-    snprintf(sql,LENGTH_SQL,"INSERT INTO his_location_area (card_id,area_id,map_id,enter_time,start_point)VALUES ('%s',%d,%d,'%s','%.2f,%.2f');",
-                card_id.c_str(),a->id(),a->mapid(),start_time.c_str(),p.x,p.y);
+    snprintf(sql,LENGTH_SQL,"INSERT INTO his_location_area (obj_id,card_type_id,ident,area_id,map_id,enter_time,start_point) \
+	                         VALUES ('%lld','%d','%lld',%d,%d,'%s','%.2f,%.2f');",
+				c->m_cid,c->m_type,c->m_id, a->id(),a->mapid(),start_time.c_str(),p.x,p.y);
+
     db_tool::PushAsync(sql);
 }
 
@@ -40,8 +42,12 @@ void area_business_card_enter_or_leave::on_leave(const std::shared_ptr<area_hove
     std::string end_time = tool_time::to_str_ex(a->m_last_time);
     std::string card_id = tool_other::type_id_to_str(c->m_type,c->m_id);
     const auto &ep=a->m_last_point;
-    snprintf(sql,LENGTH_SQL,"UPDATE his_location_area SET leave_time='%s',end_point='%.2f,%.2f' WHERE card_id = '%s' AND area_id=%d AND enter_time='%s';",
-                end_time.c_str(),ep.x,ep.y,card_id.c_str(),a->id(),start_time.c_str());
+    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 AND area_id=%d;",
+                end_time.c_str(),ep.x,ep.y,
+				start_time.c_str(),c->m_cid,a->id());
+
     log_info("card_enter_leave:%s",sql);
     db_tool::PushAsync(sql);
 }
+