Jelajahi Sumber

修改 module_site

daiyueteng 6 tahun lalu
induk
melakukan
83cc764aca
2 mengubah file dengan 70 tambahan dan 65 penghapusan
  1. 67 0
      module_service/module_site.cpp
  2. 3 65
      module_service/module_site.h

+ 67 - 0
module_service/module_site.cpp

@@ -0,0 +1,67 @@
+#include "module_site.h"
+
+#include<card.h>
+#include"module_attendance_person.h"
+#include"common_tool.h"
+#include"ant.h"
+#include"log.h"
+
+
+void module_site::enter_site(uint32_t card_id,int enter_site,int32_t type)
+{
+    auto card_ptr=card_list::instance()->get(tool_other::type_id_to_u64(type, card_id));
+    if(!card_ptr)
+    {
+        log_error("卡不存在card_id=%ld, type=%ld", card_id, type);
+        return;
+    }
+
+    auto site_ptr=sit_list::instance()->get(enter_site);
+    if(!site_ptr)
+    {
+        log_error("[enter site]%d,%d在分站列表中找不到分站,分站id=%d",card_id, type,enter_site);
+        return;
+    }
+
+    if(card_ptr->is_person())
+    {
+        module_attendance_person::instance()->enter_site(card_ptr, site_ptr);
+    }
+
+    if(card_ptr->is_vehicle())
+    {
+
+    }
+}
+
+/**
+ * @brief 离开现有分站处理,记录现有分站的进出时间和地点
+ * @param card_id
+ * @param enter_site
+ */
+void module_site::leave_site(uint32_t card_id,int enter_site, int32_t type)
+{
+    auto card_ptr=card_list::instance()->get(tool_other::type_id_to_u64(type, card_id));
+    if(!card_ptr)
+    {
+        log_error("卡不存在card_id=%ld, type=%ld", card_id, type);
+        return;
+    }
+
+    auto site_ptr=sit_list::instance()->get(enter_site);
+    if(!site_ptr)
+    {
+        log_error("[leave site]%d,%d在分站列表中找不到分站,分站id=%d",card_id,type, enter_site);
+        return;
+    }
+
+    if(card_ptr->is_person())
+    {
+
+    }
+
+    if(card_ptr->is_vehicle())
+    {
+
+    }
+}

+ 3 - 65
module_service/module_site.h

@@ -1,19 +1,7 @@
 #ifndef MODULE_SITE_H
 #define MODULE_SITE_H
 
-#include"math.h"
-#include <memory>
-#include <mutex>
-#include <map>
-#include <string>
-#include <chrono>
-#include <vector>
-#include<card.h>
-#include"ant.h"
-#include"area.h"
-#include"site_area.h"
-#include"module_const.h"
-#include"module_attendance_person.h"
+#include"module_singleton_base.h"
 
 class module_site : public singleton_base<module_site>
 {
@@ -29,64 +17,14 @@ public:
      * @param card_id
      * @param enter_site
      */
-    static void enter_site(uint32_t card_id,int enter_site,int32_t type)
-    {
-        auto card_ptr=card_list::instance()->get(tool_other::type_id_to_u64(type, card_id));
-        if(!card_ptr)
-        {
-            log_error("卡不存在card_id=%ld, type=%ld", card_id, type);
-            return;
-        }
-
-        auto site_ptr=sit_list::instance()->get(enter_site);
-        if(!site_ptr)
-        {
-            log_error("[enter site]%d,%d在分站列表中找不到分站,分站id=%d",card_id, type,enter_site);
-            return;
-        }
-
-        if(card_ptr->is_person())
-        {
-            module_attendance_person::instance()->enter_site(card_ptr, site_ptr);
-        }
-
-        if(card_ptr->is_vehicle())
-        {
-
-        }
-    }
+    static void enter_site(uint32_t card_id,int enter_site,int32_t type);
 
     /**
      * @brief 离开现有分站处理,记录现有分站的进出时间和地点
      * @param card_id
      * @param enter_site
      */
-    static void leave_site(uint32_t card_id,int enter_site, int32_t type)
-    {
-        auto card_ptr=card_list::instance()->get(tool_other::type_id_to_u64(type, card_id));
-        if(!card_ptr)
-        {
-            log_error("卡不存在card_id=%ld, type=%ld", card_id, type);
-            return;
-        }
-
-        auto site_ptr=sit_list::instance()->get(enter_site);
-        if(!site_ptr)
-        {
-            log_error("[leave site]%d,%d在分站列表中找不到分站,分站id=%d",card_id,type, enter_site);
-            return;
-        }
-
-        if(card_ptr->is_person())
-        {
-
-        }
-
-        if(card_ptr->is_vehicle())
-        {
-
-        }
-    }
+    static void leave_site(uint32_t card_id,int enter_site, int32_t type);
 };
 
 #endif // MODULE_SITE_H