module_site.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #include "module_site.h"
  2. #include<card.h>
  3. #include"module_attendance_person.h"
  4. #include"common_tool.h"
  5. #include"ant.h"
  6. #include"log.h"
  7. void module_site::enter_site(uint32_t card_id,int enter_site,int32_t type)
  8. {
  9. auto card_ptr=card_list::instance()->get(tool_other::type_id_to_u64(type, card_id));
  10. if(!card_ptr)
  11. {
  12. log_error("卡不存在card_id=%ld, type=%ld", card_id, type);
  13. return;
  14. }
  15. auto site_ptr=sit_list::instance()->get(enter_site);
  16. if(!site_ptr)
  17. {
  18. log_error("[enter site]%d,%d在分站列表中找不到分站,分站id=%d",card_id, type,enter_site);
  19. return;
  20. }
  21. if(card_ptr->is_person())
  22. {
  23. module_attendance_person::instance()->enter_site(card_ptr, site_ptr);
  24. }
  25. if(card_ptr->is_vehicle())
  26. {
  27. }
  28. }
  29. /**
  30. * @brief 离开现有分站处理,记录现有分站的进出时间和地点
  31. * @param card_id
  32. * @param enter_site
  33. */
  34. void module_site::leave_site(uint32_t card_id,int enter_site, int32_t type)
  35. {
  36. auto card_ptr=card_list::instance()->get(tool_other::type_id_to_u64(type, card_id));
  37. if(!card_ptr)
  38. {
  39. log_error("卡不存在card_id=%ld, type=%ld", card_id, type);
  40. return;
  41. }
  42. auto site_ptr=sit_list::instance()->get(enter_site);
  43. if(!site_ptr)
  44. {
  45. log_error("[leave site]%d,%d在分站列表中找不到分站,分站id=%d",card_id,type, enter_site);
  46. return;
  47. }
  48. if(card_ptr->is_person())
  49. {
  50. }
  51. if(card_ptr->is_vehicle())
  52. {
  53. }
  54. }