From 285129506509321686aeea3e34ad255d0db7a22b Mon Sep 17 00:00:00 2001 From: unknown <3457259728@qq.com> Date: 星期四, 03 七月 2025 17:54:57 +0800 Subject: [PATCH] Merge branch 'master' of ssh://115.28.86.8:29418/~admin/智能网联_25-0305_617_v1 --- Client/于文龙/code/project_client_permission_management.rar | 0 Client/杨高权/document/项目总结_杨高权.doc | 0 Client/Qt_ZNWL_0702_Client.7z | 0 Client/王国壮/log/日志_王国壮_0701.doc | 0 Client/王国壮/document/项目总结.md | 33 ++++ Server/徐逸凡/document/项目总结.doc | 0 Server/王鹏哲/log/日志_王鹏哲_20250701.doc | 0 Client/寇百盛/document/5-项目总结2.docx | 0 Client/于文龙/document/项目总结.txt | 21 +++ Server/林余杰/document/项目总结.docx | 0 Server/王鹏哲/log/日志_王鹏哲_20250630.doc | 0 Client/牛彦江/document/蚂蚁智能网联项目总结.docx | 0 Server/王鹏哲/code/logger.h | 334 +++++++++++++++++++++++++++++++++++++++++++++++ Client/于文龙/log/日志-于文龙-250702.doc | 0 Server/林余杰/log/日志_林余杰_20250701.doc | 0 Server/梁博/document/项目总结.docx | 0 Server/王鹏哲/document/项目总结.docx | 0 Client/徐蔓云/log/日志_徐蔓云_0701.doc | 0 Server/王鹏哲/log/日志_王鹏哲_20250629.doc | 0 Server/段延冲/log/项目总结.docx | 0 Server/胡重阳/document/数据模型预处理--项目总结.docx | 0 Client/陈豪/document/项目总结.txt | 24 +++ 22 files changed, 412 insertions(+), 0 deletions(-) diff --git a/Client/Qt_ZNWL_0702_Client.7z b/Client/Qt_ZNWL_0702_Client.7z new file mode 100644 index 0000000..5102ad0 --- /dev/null +++ b/Client/Qt_ZNWL_0702_Client.7z Binary files differ diff --git "a/Client/\344\272\216\346\226\207\351\276\231/code/project_client_permission_management.rar" "b/Client/\344\272\216\346\226\207\351\276\231/code/project_client_permission_management.rar" new file mode 100644 index 0000000..a011c02 --- /dev/null +++ "b/Client/\344\272\216\346\226\207\351\276\231/code/project_client_permission_management.rar" Binary files differ diff --git "a/Client/\344\272\216\346\226\207\351\276\231/document/\351\241\271\347\233\256\346\200\273\347\273\223.txt" "b/Client/\344\272\216\346\226\207\351\276\231/document/\351\241\271\347\233\256\346\200\273\347\273\223.txt" new file mode 100644 index 0000000..c7acc55 --- /dev/null +++ "b/Client/\344\272\216\346\226\207\351\276\231/document/\351\241\271\347\233\256\346\200\273\347\273\223.txt" @@ -0,0 +1,21 @@ +1.璐熻矗鐨勬ā鍧楀強瀹炵幇 + 鎴戞墍瀹屾垚鐨勯」鐩ā鍧椾负鏉冮檺绠$悊妯″潡鍜屽鎴风鏇存柊妯″潡锛� + + 鏉冮檺绠$悊妯″潡锛氭槸瀵规暣涓櫤鑳藉伐鍦版墍鏈夌敤鎴风殑绠$悊鍛樸�佹姤琛ㄥ鍑恒�佹棩蹇楁煡璇㈢瓑9澶ф潈闄愮殑绠$悊锛涢渶瑕佺敤鍒颁袱涓暟鎹簱琛紙瑙掕壊鏉冮檺琛ㄣ�佺敤鎴锋敞鍐岃〃锛夛紝 + 鍦║i鐣岄潰涓婏紝鍒嗕负3閮ㄥ垎锛岀涓�閮ㄥ垎涓烘煡璇紝鐢ㄦ埛鍚嶃�佸伐鍙枫�佹敞鍐屾椂闂存銆侀儴闂ㄧ瓑鐩稿叧淇℃伅鍦ㄥ搴攍ineEdit涓婅緭鍏ュ畬鎴愬悗锛岀偣鍑绘煡璇㈡寜閽紝灏嗚緭鍏ョ殑鏂囨湰淇℃伅閫氳繃socket缃� + 缁滈�氫俊鍙戦�佺粰鏈嶅姟绔紝鏈嶅姟绔�氳繃涓庣敤鎴锋敞鍐岃〃涓殑鐩稿叧鏁版嵁杩涜姣旇緝锛屽畬鎴愬悗灏嗙浉鍏虫暟鎹紙鍖呭惈瑙掕壊鏉冮檺琛ㄤ腑鐨勮鑹插搴旀潈闄愶級鎵撳寘鍙戦�佸洖瀹㈡埛绔紝瀹㈡埛绔畬鎴愯В鍖呮搷浣滐紝 + 灏嗕俊鎭湪Ui鐣岄潰鐨則ableView涓婂睍绀猴紱ui鐣岄潰鐨勭涓変釜閮ㄥ垎灏辨槸鏄叿浣撶殑鏉冮檺绠$悊閮ㄥ垎锛屼娇鐢╟heckBox閫夋嫨瀵瑰簲鐨勬潈闄愶紝鍚屾椂瑙掕壊鎷ユ湁鐨勬潈闄愬湪鏌ヨ鎴愬姛鍚庝篃浼氬搴旂殑灞� + 绀哄嚭鏉ワ紱褰撲慨鏀规潈闄愬悗锛岀偣鍑讳繚瀛樻寜閽紝浼氬皢checkBox瀵瑰簲鐨勬瘡涓�涓潈闄愮殑鐘舵�佸彂閫佸洖鏈嶅姟绔紝灏嗙敤鎴锋潈闄愯〃杩涜鏇存柊锛屼互淇濊瘉涓嬫閲嶆柊杩涘叆鏉冮檺绠$悊妯″潡锛岀敤鎴风殑鏉冮檺鏄� + 鏈�鏂扮殑鏉冮檺鐘舵�併�� + 瀹㈡埛绔洿鏂版ā鍧楋細鏄墦寮�鏇存柊鐣岄潰锛岀偣鍑籾i鐣岄潰璁剧疆鐨勬鏌ユ洿鏂颁細杩炴帴鍒版湇鍔$灏嗗綋鍓嶇増鏈殑鐗堟湰鍙峰彂閫佺粰鏈嶅姟绔紱鏈嶅姟绔搷搴旓紝瀵圭増鏈彿杩涜姣旇緝锛屽垽鏂槸鍚︽洿鏂帮紝濡傛灉闇� + 瑕佹洿鏂帮紝瀹㈡埛绔脊鍑哄搴旂殑Box瀵硅瘽妗嗚鐢ㄦ埛閫夋嫨瀵瑰簲鐨勬洿鏂版柟寮忥紙鍏ㄩ噺鏇存柊銆佸閲忔洿鏂帮級锛屼娇鐢╬rocessBar杩涘害鏉″拰鏍囩锛坸x%锛夋潵鏌ョ湅鏇存柊杩涘害锛屼笅鏂圭殑TextEdit鐢ㄦ潵 + 鏌ョ湅璇︾粏鐨勬棩蹇椾俊鎭紙鏇存柊杩囩▼涓殑鎿嶄綔鍜岀姸鎬佸彉鍖栫瓑锛夛紱鍚屾牱鏈夋暟鎹簱琛紙鐗堟湰淇℃伅琛級锛岀敤鏉ュ瓨鍌ㄧ浉鍏充俊鎭紱鍏朵腑鐨勬柇鐐归噸浼犳槸鍦ㄦ瘡娆℃洿鏂板墠閮借鍏堣繘琛岀殑涓�涓鏌ワ紝鏍规嵁 + 璧峰浣嶇疆鏉ュ垽鏂杩涜鏂偣閲嶄紶杩樻槸涓嬭浇锛屽湪瀹屾垚鏂數閲嶄紶鍚庯紝瑕佸皢涔嬪墠鐨勬柇鐐硅褰曟竻妤氫互淇濊瘉涓嶅奖鍝嶅悗缁殑鏇存柊涓嬭浇 + + 鍦ㄨ繃绋嬮亣鍒扮殑闂锛� + 鏉冮檺绠$悊妯″潡涓庝笌瀹㈡埛绔洿鏂版ā鍧楅兘鏈夋�庝箞鍘诲拰鏈嶅姟绔缓绔嬬綉缁滈�氫俊浠ュ畬鎴愭暟鎹殑鏀跺彂鐩稿叧鎿嶄綔锛屽皢鏁版嵁鎴栬�呯浉鍏崇殑閰嶇疆鏂囦欢瀹屾垚鍒板鎴风涓� + 鍔熻兘鐨勭浉鍏冲疄鐜扮敱鐩稿叧澶фā鍨嬬殑甯姪锛岃兘鏋勫疄鐜扮悊瑙o紝浣嗚繕闇�浼樺寲锛屼笌甯傞潰涓婄殑鐩稿叧搴旂敤鐨勫姛鑳界粏鑺備笂宸窛寰堝ぇ + + + + \ No newline at end of file diff --git "a/Client/\346\235\250\351\253\230\346\235\203/document/\346\227\245\345\277\227_\346\235\250\351\253\230\346\235\203_250625 .doc" "b/Client/\344\272\216\346\226\207\351\276\231/log/\346\227\245\345\277\227-\344\272\216\346\226\207\351\276\231-250702.doc" similarity index 68% rename from "Client/\346\235\250\351\253\230\346\235\203/document/\346\227\245\345\277\227_\346\235\250\351\253\230\346\235\203_250625 .doc" rename to "Client/\344\272\216\346\226\207\351\276\231/log/\346\227\245\345\277\227-\344\272\216\346\226\207\351\276\231-250702.doc" index c5c09ee..6cc925c 100644 --- "a/Client/\346\235\250\351\253\230\346\235\203/document/\346\227\245\345\277\227_\346\235\250\351\253\230\346\235\203_250625 .doc" +++ "b/Client/\344\272\216\346\226\207\351\276\231/log/\346\227\245\345\277\227-\344\272\216\346\226\207\351\276\231-250702.doc" Binary files differ diff --git "a/Client/\345\257\207\347\231\276\347\233\233/document/5-\351\241\271\347\233\256\346\200\273\347\273\2232.docx" "b/Client/\345\257\207\347\231\276\347\233\233/document/5-\351\241\271\347\233\256\346\200\273\347\273\2232.docx" new file mode 100644 index 0000000..0e4afc3 --- /dev/null +++ "b/Client/\345\257\207\347\231\276\347\233\233/document/5-\351\241\271\347\233\256\346\200\273\347\273\2232.docx" Binary files differ diff --git "a/Client/\345\276\220\350\224\223\344\272\221/log/\346\227\245\345\277\227_\345\276\220\350\224\223\344\272\221_0701.doc" "b/Client/\345\276\220\350\224\223\344\272\221/log/\346\227\245\345\277\227_\345\276\220\350\224\223\344\272\221_0701.doc" new file mode 100644 index 0000000..4231518 --- /dev/null +++ "b/Client/\345\276\220\350\224\223\344\272\221/log/\346\227\245\345\277\227_\345\276\220\350\224\223\344\272\221_0701.doc" Binary files differ diff --git "a/Client/\346\235\250\351\253\230\346\235\203/document/\351\241\271\347\233\256\346\200\273\347\273\223_\346\235\250\351\253\230\346\235\203.doc" "b/Client/\346\235\250\351\253\230\346\235\203/document/\351\241\271\347\233\256\346\200\273\347\273\223_\346\235\250\351\253\230\346\235\203.doc" new file mode 100644 index 0000000..7894242 --- /dev/null +++ "b/Client/\346\235\250\351\253\230\346\235\203/document/\351\241\271\347\233\256\346\200\273\347\273\223_\346\235\250\351\253\230\346\235\203.doc" Binary files differ diff --git "a/Client/\347\211\233\345\275\246\346\261\237/document/\350\232\202\350\232\201\346\231\272\350\203\275\347\275\221\350\201\224\351\241\271\347\233\256\346\200\273\347\273\223.docx" "b/Client/\347\211\233\345\275\246\346\261\237/document/\350\232\202\350\232\201\346\231\272\350\203\275\347\275\221\350\201\224\351\241\271\347\233\256\346\200\273\347\273\223.docx" new file mode 100644 index 0000000..188f360 --- /dev/null +++ "b/Client/\347\211\233\345\275\246\346\261\237/document/\350\232\202\350\232\201\346\231\272\350\203\275\347\275\221\350\201\224\351\241\271\347\233\256\346\200\273\347\273\223.docx" Binary files differ diff --git "a/Client/\347\216\213\345\233\275\345\243\256/document/\351\241\271\347\233\256\346\200\273\347\273\223.md" "b/Client/\347\216\213\345\233\275\345\243\256/document/\351\241\271\347\233\256\346\200\273\347\273\223.md" new file mode 100644 index 0000000..55c581e --- /dev/null +++ "b/Client/\347\216\213\345\233\275\345\243\256/document/\351\241\271\347\233\256\346\200\273\347\273\223.md" @@ -0,0 +1,33 @@ +### 1. **瀹炴椂鐜淇℃伅灞曠ず妯″潡** + +#### **瀹炵幇鏂瑰紡锛�** + +- **纭欢涓庢暟鎹敹闆嗭細** 閫氳繃鐜板満浼犳劅鍣紙濡傛俯搴︺�佹箍搴︺�佺矇灏樻祿搴︾瓑锛夊疄鏃堕噰闆嗙幆澧冩暟鎹�傝繖浜涙暟鎹紶杈撳埌鏈嶅姟鍣ㄧ锛岄�氳繃鎺ュ彛杩涜杞彂銆� +- **澶у睆灞曠ず锛�** 鏁版嵁閫氳繃鍓嶇鐣岄潰灞曠ず鍦ㄥぇ灞忎笂锛屽尯鍩熷垝鍒嗘樉绀轰笉鍚屼俊鎭紝鍖呮嫭鐜淇℃伅銆佹柦宸ヨ繘搴︺�佸皬鍦板浘銆佽�冨嫟鎯呭喌鍜岀洃鎺ф憚鍍忓ご鐨勫姩鎬佽疆鎾�� +- **鏁版嵁浼犺緭锛�** 鏁版嵁涓婁紶鍚庨�氳繃鏈嶅姟绔浆鍙戠粰鎵�鏈夊湪绾垮鎴风锛屽疄鐜板疄鏃跺悓姝ャ�� + +#### **瑙e喅闂锛�** + +- **鏁版嵁鍑嗙‘鎬э細** 鐢变簬浼犳劅鍣ㄦ湰韬殑璇樊锛屽疄鏃舵暟鎹彲鑳戒細鍑虹幇娉㈠姩锛屽鑷村睍绀轰笉绋冲畾銆傞�氳繃绠楁硶浼樺寲銆� + +- **寮傛鏇存柊锛�** 灏嗘暟鎹洿鏂扮殑鎿嶄綔涓庣晫闈㈡覆鏌撹В鑰︼紝閬垮厤闃诲涓荤嚎绋嬶紝纭繚澶у睆灞曠ず娴佺晠銆� +- **MSVC2015涓嶹indows SDK鐗堟湰鍏煎闂**锛氬皬鍦板浘闇�瑕佷娇鐢╳ebenginewidgets妯″潡锛屾墍浠ュ垏鎹㈠埌MSVC2015缂栬瘧鍣紝鍙堜骇鐢熷吋瀹归棶棰橈紝 閫氳繃**浠呭崌绾t Creator**瑙e喅锛屾柊鐗圦t Creator鍙寚瀹歋DK鐗堟湰銆� + +------ + +### 2. **璀︽姤绠$悊妯″潡** + +#### **瀹炵幇鏂瑰紡锛�** + +- **璀︽姤鍒ゆ柇锛�** 閽堝鐜鏁版嵁涓殑娓╁害銆佹箍搴︺�佺矇灏樻祿搴︾瓑璁剧疆闃堝�硷紝瓒呭嚭鑼冨洿鏃惰Е鍙戣鎶ャ�� +- **闃堝�肩鐞嗭細** 绯荤粺鍏佽绠$悊鍛樺姩鎬佽皟鏁撮槇鍊硷紝纭繚绯荤粺鍦ㄤ笉鍚屾儏鍐典笅浠嶈兘鏈夋晥鎶ヨ銆� +- **璀︽姤鍝嶅簲锛�** 褰撹鎶ヨЕ鍙戞椂锛岀‖浠剁浼氬彂鍑哄0鍏夎鎶ワ紝杞欢绔細閫氳繃鏈嶅姟绔帹閫佽鎶ヤ俊鎭埌鎵�鏈夊湪绾垮鎴风銆傝嫢闂鏈В鍐筹紝鑷姩娲惧崟鍒板�肩彮瀹ゅ鐞嗐�� +- **璀︽姤鏁版嵁搴擄細** 璁剧疆鈥滈槇鍊间俊鎭〃鈥濆拰鈥滆鎶ヤ俊鎭〃鈥濓紝鍒嗗埆瀛樺偍姣忎釜璀︽姤椤圭殑闃堝�间互鍙婂彂鐢熺殑鍏蜂綋璀︽姤璁板綍銆� + +#### **瑙e喅闂锛�** + +- **瀹炴椂鎬т笌绋冲畾鎬э細** 璀︽姤闇�瑕佸湪鍙戠敓寮傚父鐨勭灛闂磋Е鍙戯紝濡傛灉绯荤粺鍝嶅簲寤惰繜鎴栧彂鐢熼敊璇紝鍙兘閿欒繃鏈�浣冲鐞嗘椂鏈恒�� +- **鐣岄潰璁捐锛�** 纭繚璀︽姤淇℃伅鑳藉瀹炴椂銆佹竻鏅板湴灞曠ず缁欑鐞嗗憳锛岄伩鍏嶄俊鎭繃杞藉拰鏄剧ず涓嶄竴鑷淬�� + +- **骞跺彂澶勭悊锛�** 閫氳繃骞跺彂鍜屽紓姝ユ妧鏈紝淇濊瘉璀︽姤澶勭悊鍜屾暟鎹洿鏂拌兘澶熷悓鏃惰繘琛岋紝鎻愰珮鍝嶅簲閫熷害銆� +- **鍔ㄦ�佺晫闈紭鍖栵細** 璀︽姤淇℃伅搴斿湪涓荤晫闈㈢獊鍑烘樉绀猴紝骞剁‘淇濈晫闈㈣兘澶熷揩閫熸洿鏂帮紝閬垮厤鍥犱俊鎭繃杞藉鑷寸鐞嗕汉鍛橀仐婕忛噸瑕佷俊鎭�� \ No newline at end of file diff --git "a/Client/\347\216\213\345\233\275\345\243\256/log/\346\227\245\345\277\227_\347\216\213\345\233\275\345\243\256_0701.doc" "b/Client/\347\216\213\345\233\275\345\243\256/log/\346\227\245\345\277\227_\347\216\213\345\233\275\345\243\256_0701.doc" new file mode 100644 index 0000000..ee1838d --- /dev/null +++ "b/Client/\347\216\213\345\233\275\345\243\256/log/\346\227\245\345\277\227_\347\216\213\345\233\275\345\243\256_0701.doc" Binary files differ diff --git "a/Client/\351\231\210\350\261\252/document/\351\241\271\347\233\256\346\200\273\347\273\223.txt" "b/Client/\351\231\210\350\261\252/document/\351\241\271\347\233\256\346\200\273\347\273\223.txt" new file mode 100644 index 0000000..acb4447 --- /dev/null +++ "b/Client/\351\231\210\350\261\252/document/\351\241\271\347\233\256\346\200\273\347\273\223.txt" @@ -0,0 +1,24 @@ +涓�銆佹ā鍧楀疄鐜拌鏄� + +1銆佸湴鍥炬樉绀烘ā鍧� +鍩轰簬 QWebEngineView 瀹炵幇鍦板浘鏄剧ず锛岄�氳繃鏈湴 HTML 鏂囦欢鍔犺浇鐧惧害鍦板浘 JavaScript API锛� +浣跨敤 WebChannel 瀹炵幇 Qt 涓� JavaScript 閫氫俊锛屽疄鐜板湴鍥惧垵濮嬪寲鍜岄厤缃鐞嗐�� + +2銆佽澶囩鐞嗘ā鍧� +瀹氫箟 DeviceInfo 缁撴瀯浣撴潵瀛樺偍璁惧鐨勫熀鏈俊鎭紝鍖呮嫭璁惧 ID銆佸悕绉般�佺粡绾害鍜岀姸鎬佺瓑銆� +浣跨敤 QMap 鏁版嵁缁撴瀯瀛樺偍璁惧鏁版嵁锛屾柟渚胯繘琛岃澶囩殑澧炲垹鏀规煡鎿嶄綔銆� +閫氳繃鐘舵�佹灇涓惧璁惧鐨勪笉鍚岀姸鎬侊紙濡傚湪绾裤�佺绾裤�佹晠闅滐級杩涜绠$悊銆� + +3銆� 鏁版嵁鍚屾妯″潡 +鎻愪緵璁惧淇℃伅鐨勬湰鍦颁繚瀛樺姛鑳斤紝纭繚鏁版嵁鍦ㄦ湰鍦扮殑鎸佷箙鍖栧瓨鍌ㄣ�� +璁捐鏁版嵁瀵煎叆瀵煎嚭鎺ュ彛锛屾柟渚挎暟鎹殑杩佺Щ鍜屽浠姐�� +鏀寔璁惧淇℃伅鐨勫疄鏃舵洿鏂帮紝褰撴暟鎹彂鐢熷彉鏇存椂锛岀郴缁熻嚜鍔ㄥ悓姝ユ暟鎹�� + +浜屻�侀亣鍒扮殑闂鍙婅В鍐虫柟妗� + +1銆佸湴鍥炬棤娉曞姞杞斤細澧炲姞椤甸潰鍔犺浇瓒呮椂鏃堕棿鐨勮缃紝鍚屾椂瀹炵幇鑷姩閲嶈瘯鏈哄埗銆備紭鍖� WebEngine 鐨勫叏灞�閰嶇疆锛� +娣诲姞鍔犺浇鐘舵�佹彁绀猴紝璁╃敤鎴蜂簡瑙e姞杞借繘搴︺�� + +2銆佽澶囩姸鎬佹洿鏂颁笉鍙婃椂锛屾樉绀轰笉鍑嗙‘锛氬疄鐜扮姸鎬佹洿鏂伴槦鍒楋紝纭繚鐘舵�佹寜椤哄簭鏇存柊銆� +娣诲姞鐘舵�佸彉鏇撮獙璇佹満鍒讹紝淇濊瘉鐘舵�佺殑鍑嗙‘鎬с�備娇鐢ㄧ姸鎬佺紦瀛樻満鍒讹紝鍑忓皯棰戠箒鐨勬暟鎹氦浜掋�� + diff --git "a/Server/\345\276\220\351\200\270\345\207\241/document/\351\241\271\347\233\256\346\200\273\347\273\223.doc" "b/Server/\345\276\220\351\200\270\345\207\241/document/\351\241\271\347\233\256\346\200\273\347\273\223.doc" new file mode 100644 index 0000000..48a0318 --- /dev/null +++ "b/Server/\345\276\220\351\200\270\345\207\241/document/\351\241\271\347\233\256\346\200\273\347\273\223.doc" Binary files differ diff --git "a/Server/\346\236\227\344\275\231\346\235\260/document/\351\241\271\347\233\256\346\200\273\347\273\223.docx" "b/Server/\346\236\227\344\275\231\346\235\260/document/\351\241\271\347\233\256\346\200\273\347\273\223.docx" new file mode 100644 index 0000000..7631763 --- /dev/null +++ "b/Server/\346\236\227\344\275\231\346\235\260/document/\351\241\271\347\233\256\346\200\273\347\273\223.docx" Binary files differ diff --git "a/Server/\346\236\227\344\275\231\346\235\260/log/\346\227\245\345\277\227_\346\236\227\344\275\231\346\235\260_20250701.doc" "b/Server/\346\236\227\344\275\231\346\235\260/log/\346\227\245\345\277\227_\346\236\227\344\275\231\346\235\260_20250701.doc" new file mode 100644 index 0000000..61a95c1 --- /dev/null +++ "b/Server/\346\236\227\344\275\231\346\235\260/log/\346\227\245\345\277\227_\346\236\227\344\275\231\346\235\260_20250701.doc" Binary files differ diff --git "a/Server/\346\242\201\345\215\232/document/\351\241\271\347\233\256\346\200\273\347\273\223.docx" "b/Server/\346\242\201\345\215\232/document/\351\241\271\347\233\256\346\200\273\347\273\223.docx" new file mode 100644 index 0000000..e0cf8c7 --- /dev/null +++ "b/Server/\346\242\201\345\215\232/document/\351\241\271\347\233\256\346\200\273\347\273\223.docx" Binary files differ diff --git "a/Server/\346\256\265\345\273\266\345\206\262/log/\351\241\271\347\233\256\346\200\273\347\273\223.docx" "b/Server/\346\256\265\345\273\266\345\206\262/log/\351\241\271\347\233\256\346\200\273\347\273\223.docx" new file mode 100644 index 0000000..aec870d --- /dev/null +++ "b/Server/\346\256\265\345\273\266\345\206\262/log/\351\241\271\347\233\256\346\200\273\347\273\223.docx" Binary files differ diff --git "a/Server/\347\216\213\351\271\217\345\223\262/code/logger.h" "b/Server/\347\216\213\351\271\217\345\223\262/code/logger.h" new file mode 100644 index 0000000..10cf437 --- /dev/null +++ "b/Server/\347\216\213\351\271\217\345\223\262/code/logger.h" @@ -0,0 +1,334 @@ +#pragma once +#include "common.h" +#include <cstring> // 用于strerror +#include <cstdio> // 用于std::rename, std::remove +#include <utility> // 用于std::forward +// 日志级别枚举 +enum class LogLevel { + TRACE, // 最详细的跟踪信息 + DEBUG, // 调试信息 + INFO, // 常规信息 + WARNING, // 警告信息 + ERRORL, // 错误信息 + FATAL // 严重错误 +}; + +// 将日志级别转换为字符串 +inline const char* levelToString(LogLevel level) { + switch (level) { + case LogLevel::TRACE: return "TRACE"; + case LogLevel::DEBUG: return "DEBUG"; + case LogLevel::INFO: return "INFO"; + case LogLevel::WARNING: return "WARNING"; + case LogLevel::ERRORL: return "ERROR"; + case LogLevel::FATAL: return "FATAL"; + default: return "UNKNOWN"; + } +} + +// 日志配置结构 +struct LogConfig { + LogLevel minLevel = LogLevel::INFO; // 最小日志级别 + bool consoleOutput = true; // 是否输出到控制台 + bool fileOutput = false; // 是否输出到文件 + std::string logFilePath = "temp.log";// 日志文件路径 + bool includeTimestamp = true; // 是否包含时间戳 + bool includeThreadId = false; // 是否包含线程ID + size_t maxFileSize = 10 * 1024 * 1024; // 最大文件大小 (10MB) + int maxBackupFiles = 5; // 最大备份文件数 +}; + +class Logger { +public: + // 获取日志实例 + static Logger& instance() { + static Logger instance; + return instance; + } + + // 配置日志系统 + void configure(const LogConfig& config) { + std::lock_guard<std::mutex> lock(configMutex_); + config_ = config; + + // 如果启用文件输出,确保文件已打开 + if (config.fileOutput) { + openLogFile(); + } + } + + // 记录日志 (模板方法,支持任何可流式输出的类型) + template<typename... Args> + void log(LogLevel level, Args&&... args) { + if (shutdown_) return; + + // 复制配置以最小化锁范围 + LogConfig currentConfig; + { + std::lock_guard<std::mutex> lock(configMutex_); + if (level < config_.minLevel) return; + currentConfig = config_; + } + + // 构造日志消息 + std::ostringstream oss; + formatLogPrefix(oss, level, currentConfig); + + using expander = int[]; + (void)expander { + 0, (void(oss << std::forward<Args>(args)), 0)... + }; + + // 添加换行符 + oss << '\n'; + std::string message = oss.str(); + + // 直接写入日志 + /*writeLog(message);*/ + + // 将日志消息加入队列 + { + std::lock_guard<std::mutex> lock(queueMutex_); + logQueue_.push(std::move(message)); + } + + // 通知日志线程有新消息 + queueCond_.notify_one(); + } + // 便捷日志方法 + template<typename... Args> void trace(Args&&... args) { + log(LogLevel::TRACE, std::forward<Args>(args)...); + } + + template<typename... Args> void debug(Args&&... args) { + log(LogLevel::DEBUG, std::forward<Args>(args)...); + } + + template<typename... Args> void info(Args&&... args) { + log(LogLevel::INFO, std::forward<Args>(args)...); + } + + template<typename... Args> void warning(Args&&... args) { + log(LogLevel::WARNING, std::forward<Args>(args)...); + } + + template<typename... Args> void error(Args&&... args) { + log(LogLevel::ERRORL, std::forward<Args>(args)...); + } + + template<typename... Args> void fatal(Args&&... args) { + log(LogLevel::FATAL, std::forward<Args>(args)...); + flush(); + std::exit(EXIT_FAILURE); + } + + // 刷新日志缓冲区 + void flush() { + std::lock_guard<std::mutex> lock(fileMutex_); + if (logFile_.is_open()) { + logFile_.flush(); + } + } + + // 析构函数 + ~Logger() { + shutdown(); + flush(); + } + // 安全关闭日志系统 + void shutdown() { + if (shutdown_) return; + + shutdown_ = true; + queueCond_.notify_all(); // 唤醒线程以处理退出 + + if (workerThread_.joinable()) { + workerThread_.join(); // 等待线程结束 + } + + flush(); // 最终刷新 + } + // 删除拷贝构造函数和赋值运算符 + Logger(const Logger&) = delete; + Logger& operator=(const Logger&) = delete; + +private: + LogConfig config_; // 日志配置 + std::ofstream logFile_; // 日志文件流 + std::mutex configMutex_; // 配置互斥锁 + std::mutex fileMutex_; // 文件操作互斥锁 + std::atomic<bool> shutdown_{ false }; // 关闭标志 + // 新增线程安全队列相关成员 + std::queue<std::string> logQueue_; // 日志消息队列 + std::mutex queueMutex_; // 队列互斥锁 + std::condition_variable queueCond_; // 队列条件变量 + std::thread workerThread_; // 日志写入线程 + + // 私有构造函数 + Logger() { + // 启动日志写入线程 + workerThread_ = std::thread(&Logger::processLogs, this); + }; + // 日志处理线程函数 + void processLogs() { + while (true) { + std::unique_lock<std::mutex> lock(queueMutex_); + + // 等待新日志或关闭信号 + queueCond_.wait(lock, [this] { + return !logQueue_.empty() || shutdown_; + }); + + // 处理关闭信号 + if (shutdown_ && logQueue_.empty()) { + break; + } + + // 取出所有待处理日志 + std::queue<std::string> tempQueue; + std::swap(logQueue_, tempQueue); + lock.unlock(); + + // 处理所有取出的日志 + while (!tempQueue.empty()) { + writeLog(tempQueue.front()); + tempQueue.pop(); + } + } + } + + // 格式化日志前缀 + void formatLogPrefix(std::ostringstream& oss, LogLevel level, const LogConfig& config) { + // 日志级别标签 + oss << "[" << levelToString(level) << "] "; + + // 时间戳 + if (config.includeTimestamp) { + auto now = std::chrono::system_clock::now(); + auto in_time_t = std::chrono::system_clock::to_time_t(now); + auto ms = std::chrono::duration_cast<std::chrono::milliseconds>( + now.time_since_epoch()) % 1000; + + std::tm tm; +#ifdef _WIN32 + localtime_s(&tm, &in_time_t); +#else + localtime_r(&in_time_t, &tm); +#endif + + oss << std::put_time(&tm, "%Y-%m-%d %H:%M:%S"); + oss << '.' << std::setfill('0') << std::setw(3) << ms.count() << " "; + } + + // 线程ID + if (config.includeThreadId) { + oss << "[Thread:" << std::this_thread::get_id() << "] "; + } + } + + // 打开日志文件 + void openLogFile() { + // 关闭当前文件(如果已打开) + if (logFile_.is_open()) { + logFile_.close(); + } + + // 检查文件大小,必要时轮转 + std::ifstream in(config_.logFilePath, std::ios::binary | std::ios::ate); + if (in) { + auto size = in.tellg(); + if (static_cast<size_t>(size) >= config_.maxFileSize) { + rotateLogFiles(); + } + } + in.close(); + + // 打开新日志文件 + logFile_.open(config_.logFilePath, std::ios::out | std::ios::app); + if (!logFile_.is_open()) { + std::cerr << "Failed to open log file: " + << config_.logFilePath << " - " + << errno << std::endl; + } + } + + // 轮转日志文件 + void rotateLogFiles() { + // 删除最旧的备份文件 + if (config_.maxBackupFiles > 0) { + std::string oldestFile = config_.logFilePath + "." + std::to_string(config_.maxBackupFiles); + std::remove(oldestFile.c_str()); + + // 重命名现有备份文件 + for (int i = config_.maxBackupFiles - 1; i >= 1; i--) { + std::string oldName = config_.logFilePath + "." + std::to_string(i); + std::string newName = config_.logFilePath + "." + std::to_string(i + 1); + + if (fileExists(oldName)) { + std::rename(oldName.c_str(), newName.c_str()); + } + } + + // 重命名当前日志文件为备份1 + if (fileExists(config_.logFilePath)) { + std::string newName = config_.logFilePath + ".1"; + std::rename(config_.logFilePath.c_str(), newName.c_str()); + } + } + } + + // 检查文件是否存在 + bool fileExists(const std::string& path) { + std::ifstream f(path); + return f.good(); + } + + // 实际写入日志 + void writeLog(const std::string& message) { + LogConfig currentConfig; + { + std::lock_guard<std::mutex> configLock(configMutex_); + currentConfig = config_; + } + + // 输出到控制台 + if (currentConfig.consoleOutput) { + if (message.find("[ERROR]") != std::string::npos || + message.find("[FATAL]") != std::string::npos) { + std::cerr << message; + } + else { + std::cout << message; + } + } + + // 输出到文件 + if (currentConfig.fileOutput) { + std::lock_guard<std::mutex> fileLock(fileMutex_); + if (!logFile_.is_open() || !logFile_.good()) { + openLogFile(); + } + + if (logFile_.good()) { + logFile_ << message; + logFile_.flush(); // 实时刷新到磁盘 + + // 检查文件大小 + auto pos = logFile_.tellp(); + if (static_cast<size_t>(pos) >= currentConfig.maxFileSize) { + logFile_.close(); + rotateLogFiles(); + logFile_.open(currentConfig.logFilePath, std::ios::out | std::ios::app); + } + } + } + } +}; + +// 日志宏定义 - 提供文件名和行号信息 +#define LOG_TRACE(...) Logger::instance().trace("(", __FILE__, ":", __LINE__, ") ", __VA_ARGS__) +#define LOG_DEBUG(...) Logger::instance().debug("(", __FILE__, ":", __LINE__, ") ", __VA_ARGS__) +#define LOG_INFO(...) Logger::instance().info(__VA_ARGS__) +#define LOG_WARN(...) Logger::instance().warning("(", __FILE__, ":", __LINE__, ") ", __VA_ARGS__) +#define LOG_ERROR(...) Logger::instance().error("(", __FILE__, ":", __LINE__, ") ", __VA_ARGS__) +#define LOG_FATAL(...) Logger::instance().fatal("(", __FILE__, ":", __LINE__, ") ", __VA_ARGS__) \ No newline at end of file diff --git "a/Server/\347\216\213\351\271\217\345\223\262/document/\351\241\271\347\233\256\346\200\273\347\273\223.docx" "b/Server/\347\216\213\351\271\217\345\223\262/document/\351\241\271\347\233\256\346\200\273\347\273\223.docx" new file mode 100644 index 0000000..625faff --- /dev/null +++ "b/Server/\347\216\213\351\271\217\345\223\262/document/\351\241\271\347\233\256\346\200\273\347\273\223.docx" Binary files differ diff --git "a/Server/\347\216\213\351\271\217\345\223\262/log/\346\227\245\345\277\227_\347\216\213\351\271\217\345\223\262_20250629.doc" "b/Server/\347\216\213\351\271\217\345\223\262/log/\346\227\245\345\277\227_\347\216\213\351\271\217\345\223\262_20250629.doc" new file mode 100644 index 0000000..25b1c97 --- /dev/null +++ "b/Server/\347\216\213\351\271\217\345\223\262/log/\346\227\245\345\277\227_\347\216\213\351\271\217\345\223\262_20250629.doc" Binary files differ diff --git "a/Server/\347\216\213\351\271\217\345\223\262/log/\346\227\245\345\277\227_\347\216\213\351\271\217\345\223\262_20250630.doc" "b/Server/\347\216\213\351\271\217\345\223\262/log/\346\227\245\345\277\227_\347\216\213\351\271\217\345\223\262_20250630.doc" new file mode 100644 index 0000000..78def34 --- /dev/null +++ "b/Server/\347\216\213\351\271\217\345\223\262/log/\346\227\245\345\277\227_\347\216\213\351\271\217\345\223\262_20250630.doc" Binary files differ diff --git "a/Server/\347\216\213\351\271\217\345\223\262/log/\346\227\245\345\277\227_\347\216\213\351\271\217\345\223\262_20250701.doc" "b/Server/\347\216\213\351\271\217\345\223\262/log/\346\227\245\345\277\227_\347\216\213\351\271\217\345\223\262_20250701.doc" new file mode 100644 index 0000000..61462ad --- /dev/null +++ "b/Server/\347\216\213\351\271\217\345\223\262/log/\346\227\245\345\277\227_\347\216\213\351\271\217\345\223\262_20250701.doc" Binary files differ diff --git "a/Server/\350\203\241\351\207\215\351\230\263/document/\346\225\260\346\215\256\346\250\241\345\236\213\351\242\204\345\244\204\347\220\206--\351\241\271\347\233\256\346\200\273\347\273\223.docx" "b/Server/\350\203\241\351\207\215\351\230\263/document/\346\225\260\346\215\256\346\250\241\345\236\213\351\242\204\345\244\204\347\220\206--\351\241\271\347\233\256\346\200\273\347\273\223.docx" new file mode 100644 index 0000000..25f3432 --- /dev/null +++ "b/Server/\350\203\241\351\207\215\351\230\263/document/\346\225\260\346\215\256\346\250\241\345\236\213\351\242\204\345\244\204\347\220\206--\351\241\271\347\233\256\346\200\273\347\273\223.docx" Binary files differ -- Gitblit v1.8.0