From da5249bf529d2d5e0f89aed5775b76a56d50dd8c Mon Sep 17 00:00:00 2001
From: wpz <1249632539@qq.com>
Date: 星期三, 02 七月 2025 15:30:59 +0800
Subject: [PATCH] Merge branch 'master' of ssh://115.28.86.8:29418/~admin/智能网联_25-0305_617_v1

---
 Server/common_type.h |  104 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 69 insertions(+), 35 deletions(-)

diff --git a/Server/common_type.h b/Server/common_type.h
index f9524ae..22b8098 100644
--- a/Server/common_type.h
+++ b/Server/common_type.h
@@ -1,31 +1,44 @@
 #ifndef TCPDATATYPE_H
 #define TCPDATATYPE_H
-/*        */
+
+/*
+ * 瀹㈡埛绔笌鏈嶅姟鍣ㄤ氦浜掔殑鍔ㄤ綔绫诲瀷鏋氫妇
+ * 娉ㄦ剰锛氫娇鐢� enum class 閬垮厤鍛藉悕鍐茬獊锛圕++11鐗规�э級
+ */
 enum class ActionType
 {
-    HeartCheck = 100,
-    Login = 110,
-    Register = 120,
-    Msg = 200,
-    Download = 300
+    HeartCheck = 100,  // 蹇冭烦妫�娴嬶紙淇濇寔杩炴帴娲绘�э級
+    Login = 110,       // 鐧诲綍璇锋眰
+    Register = 120,    // 娉ㄥ唽璇锋眰
+    Msg = 200,        // 鏅�氭秷鎭紶杈�
+    Download = 300     // 鏂囦欢涓嬭浇璇锋眰
 };
-/* 慰 HTTP    应  */
+
+/*
+ * HTTP椋庢牸鍝嶅簲鐘舵�佺爜锛堢畝鍖栫増锛�
+ * 鐢ㄤ簬鏈嶅姟鍣ㄥ悜瀹㈡埛绔繑鍥炴搷浣滅粨鏋滅姸鎬�
+ */
 enum class ResponseCode
 {
-    ResponseOK = 200,      //     晒   
-    BadRequest = 400,      //  突             螅      薹    
-    Unauthorized = 401,    //     要   没        证
-    Forbidden = 403,       //              突  说    螅  蔷芫 执 写     
-    NotFound = 404,        //        薹  业        源
-    MethodNotAllowed = 405 //  突        械姆       止
-
+    ResponseOK = 200,      // 鎴愬姛锛圤K锛�
+    BadRequest = 400,      // 閿欒璇锋眰锛堝鎴风璇锋眰璇硶閿欒锛�
+    Unauthorized = 401,    // 鏈巿鏉冿紙闇�瑕佽韩浠介獙璇侊級
+    Forbidden = 403,       // 绂佹璁块棶锛堟潈闄愪笉瓒筹級
+    NotFound = 404,        // 鏈壘鍒帮紙璇锋眰璧勬簮涓嶅瓨鍦級
+    MethodNotAllowed = 405 // 鏂规硶涓嶅厑璁革紙濡傜敤GET璇锋眰POST鎺ュ彛锛�
 };
-/*  息  */
+
+/*
+ * 閫氱敤娑堟伅澶寸粨鏋勶紙鎵�鏈夋暟鎹寘蹇呴』鍖呭惈锛�
+ * 浣滅敤锛氭爣璇嗘秷鎭被鍨嬪拰鍩烘湰淇℃伅
+ */
 struct Head
 {
-    ActionType type;
-    int len;
-    int version;
+    ActionType type;    // 娑堟伅绫诲瀷锛堝搴擜ctionType鏋氫妇锛�
+    int len;           // 鏁翠釜鏁版嵁鍖呯殑闀垮害锛堝瓧鑺傛暟锛�
+    int version;       // 鍗忚鐗堟湰鍙凤紙鐢ㄤ簬鍏煎鎬ф帶鍒讹級
+
+    // 鏋勯�犲嚱鏁帮紙鍒濆鍖栨椂蹇呴』鎻愪緵涓変釜鍙傛暟锛�
     Head(ActionType ptype, int plen, int pversion)
     {
         len = plen;
@@ -33,40 +46,61 @@
         version = pversion;
     }
 };
-struct HeartCheckReq //          
+
+/*
+ * 蹇冭烦妫�娴嬭姹傜粨鏋�
+ * 鐗圭偣锛氬浐瀹氱被鍨嬪拰闀垮害锛堜笉闇�瑕侀澶栨暟鎹級
+ */
+struct HeartCheckReq
 {
-    ActionType type;
-    int len;
+    ActionType type;  // 鍥哄畾涓篈ctionType::HeartCheck
+    int len;         // 缁撴瀯浣撹嚜韬ぇ灏�
+
     HeartCheckReq()
     {
         type = ActionType::HeartCheck;
-        len = sizeof(HeartCheckReq);
+        len = sizeof(HeartCheckReq);  // 鑷姩璁$畻缁撴瀯浣撳ぇ灏�
     }
 };
 
-struct HeartCheckRes //       应  
+/*
+ * 蹇冭烦妫�娴嬪搷搴旂粨鏋�
+ * 娉ㄦ剰锛氫笌璇锋眰缁撴瀯鐩稿悓锛堝疄闄呭彲鑳藉寘鍚湇鍔″櫒鐘舵�佷俊鎭級
+ */
+struct HeartCheckRes
 {
-    ActionType type;
-    int len;
+    ActionType type;  // 鍥哄畾涓篈ctionType::HeartCheck
+    int len;         // 缁撴瀯浣撹嚜韬ぇ灏�
+
     HeartCheckRes()
     {
         type = ActionType::HeartCheck;
         len = sizeof(HeartCheckRes);
     }
 };
+
+/*
+ * 鐢ㄦ埛娉ㄥ唽璇锋眰缁撴瀯
+ * 缁勬垚锛氭秷鎭ご + 鐢ㄦ埛淇℃伅瀛楁
+ */
 struct RegisterRequest
 {
-    Head head;
-    char name[64];
-    char password[64];
-    char email[32];
-    char phone[32];
+    Head head;        // 蹇呴』鍖呭惈鐨勬秷鎭ご
+    char name[64];    // 鐢ㄦ埛鍚嶏紙鍥哄畾闀垮害64瀛楄妭锛�
+    char password[64];// 瀵嗙爜锛堝缓璁姞瀵嗗瓨鍌級
+    char email[32];   // 閭锛堢敤浜庢壘鍥炲瘑鐮侊級
+    char phone[32];   // 鎵嬫満鍙凤紙鍙�夐獙璇侊級
 };
+
+/*
+ * 鐢ㄦ埛鐧诲綍璇锋眰缁撴瀯
+ * 娉ㄦ剰锛氭瘮娉ㄥ唽璇锋眰灏戦偖绠卞拰鎵嬫満瀛楁
+ */
 struct LoginRequest
 {
-
-    Head head;
-    char name[64];
-    char password[64];
+    Head head;        // 娑堟伅澶达紙type搴斾负ActionType::Login锛�
+    char name[64];    // 鐢ㄦ埛鍚�
+    char password[64];// 瀵嗙爜锛堝缓璁姞瀵嗕紶杈擄級
 };
-#endif
+
+#endif // TCPDATATYPE_H
\ No newline at end of file

--
Gitblit v1.8.0