From c7221a23c147067d0a75cc6f8f747d78b49f1ce3 Mon Sep 17 00:00:00 2001
From: zhuhang <729713003@qq.com>
Date: 星期五, 01 十一月 2024 15:54:05 +0800
Subject: [PATCH] 1

---
 common.h |   73 +++++++++++++++---------------------
 1 files changed, 31 insertions(+), 42 deletions(-)

diff --git a/common.h b/common.h
index a93c4bd..5693dd0 100644
--- a/common.h
+++ b/common.h
@@ -658,57 +658,46 @@
     }
 };
 
+//鏃ュ織鏌ヨ
 
-struct LogQueryRequest {
-    Head header;                // 鏁版嵁澶�
-    std::string* keywords;      // 瀛樺偍澶氫釜鍏抽敭瀛楃殑鏌旀�ф暟缁�
-    size_t keywordCount;         // 鍏抽敭瀛楁暟閲�
-    std::string startDate;       // 寮�濮嬫棩鏈� (鏍煎紡: YYYY-MM-DD)
-    std::string endDate;         // 缁撴潫鏃ユ湡 (鏍煎紡: YYYY-MM-DD)
-    int pageNumber;              // 褰撳墠椤电爜
-    int pageSize;                // 姣忛〉鏉$洰鏁�
+enum Typeinfo{
+	LOGSEARCH_REQ,//鏃ュ織鏌ヨ璇锋眰
+	LOGSEARCH_RES,//鏃ュ織鏌ヨ鍝嶅簲
 
-    // 鏋勯�犲嚱鏁�
-    LogQueryRequest(int type, int len, std::string* keywords, size_t keywordCount, const std::string& startDate, const std::string& endDate, int pageNumber, int pageSize)
-        : header{type, len}, keywords(keywords), keywordCount(keywordCount), startDate(startDate), endDate(endDate), pageNumber(pageNumber), pageSize(pageSize) {}
+};
 
-    // 鏋愭瀯鍑芥暟
-    ~LogQueryRequest() {
-        delete[] keywords; // 閲婃斁鍔ㄦ�佸垎閰嶇殑鍐呭瓨
+struct Head
+{
+    int type;   // 鍔熻兘绫诲瀷
+    int len;    //灏佸寘闀垮害
+
+};
+// 鏃ュ織鏌ヨ璇锋眰缁撴瀯浣�
+struct LogQueryReq {
+    Head heade;                 // 鏁版嵁澶�
+    char keyWords[0];            // 瀛樺偍澶氫釜鍏抽敭瀛楃殑鏌旀�ф暟缁�
+    // 鏃犲弬鏋勯�犲嚱鏁�
+    LogQueryReq() {
+        head.type = LOGSEARCH_REQ;
+	    head.len = sizeof(LogQueryReq);
     }
 };
 
-//鏃ュ織鏌ヨ鍝嶅簲
-// 瀹氫箟鏃ュ織鏉$洰缁撴瀯浣�
-struct LogEntry {
-    int id;                  // 鏃ュ織鏉$洰 ID
-    string entryTime;       // 涓嬩簳鏃堕棿
-    string name;            // 濮撳悕
-    string exitTime;        // 鍗囦簳鏃堕棿
-    string department;       // 閮ㄩ棬
-    string position;        // 宀椾綅
-    //string workingTime;     // 宸ヤ綔鏃堕棿 鏁版嵁搴撹嚜鍔ㄧ敓鎴�
-
-      // 鏋勯�犲嚱鏁�
-    LogEntry(int id, const string& entryTime, const string& name, 
-              const string& exitTime, const string& department, 
-              const string& position)
-        : id(id), entryTime(entryTime), name(name), 
-          exitTime(exitTime), department(department), position(position) {}
-};
-
-// 瀹氫箟鏃ュ織鏌ヨ鍝嶅簲缁撴瀯浣�
-struct LogQueryResponse {
+// 鏃ュ織鏌ヨ鍝嶅簲缁撴瀯浣�
+struct LogQueryRes {
+    Head heade;  
     int status;                    // 鍝嶅簲鐘舵�� (濡� 0 琛ㄧず鎴愬姛锛岄潪 0 琛ㄧず澶辫触)
-    string errorMessage;           // 閿欒淇℃伅锛堝鏋滄湁锛�
-    vector<LogEntry> logEntries;   // 鏃ュ織鏉$洰
-
-    // 鏋勯�犲嚱鏁�
-    LogQueryResponse(int status, const string& errorMessage, const vector<LogEntry>& logEntries)
-        : status(status), errorMessage(errorMessage), logEntries(logEntries) {}
+    char errorMessage[256];        // 閿欒淇℃伅锛堝鏋滄湁锛�
+    
+    // 鏃犲弬鏋勯�犲嚱鏁�
+    LogQueryRes() {
+        head.type = LOGSEARCH_RES;
+	    head.len = sizeof(LogQueryRes);
+    }
 };
 
 
 
 
-#endif // COMMON_H
\ No newline at end of file
+#endif // COMMON_H
+

--
Gitblit v1.8.0