From bb11cc624ab058fc3a6541f91f37985b8caae9b6 Mon Sep 17 00:00:00 2001 From: jhc <2991879965@qq.com> Date: 星期五, 01 十一月 2024 15:53:36 +0800 Subject: [PATCH] Merge branch 'master' of ssh://115.28.86.8:29418/~admin/昆仑_1025 Please enter a commit message to explain why this merge is necessary, --- Server/马渝杭/log/日志_马渝杭_20241031.doc | 0 /dev/null | 67 --------------------------------- Server/王琨元/log/日志模板_王琨元_1031 .doc | 0 Server/马渝杭/log/日志_马渝杭_20241101.doc | 0 Client/黎弘霖/log/设备管理_黎弘霖_1101.doc | 0 Server/王琨元/document/表.docx | 0 Server/马渝杭/log/20241101昆仑日报.doc | 0 Server/王琨元/document/~$表.docx | 0 Client/黎弘霖/code/Devices_Management_Struct.h | 48 +++++++++++++++-------- common.h | 4 - 10 files changed, 32 insertions(+), 87 deletions(-) diff --git "a/Client/\351\273\216\345\274\230\351\234\226/code/Devices_Management_Struct.h" "b/Client/\351\273\216\345\274\230\351\234\226/code/Devices_Management_Struct.h" index 70ae3d4..67b38a2 100644 --- "a/Client/\351\273\216\345\274\230\351\234\226/code/Devices_Management_Struct.h" +++ "b/Client/\351\273\216\345\274\230\351\234\226/code/Devices_Management_Struct.h" @@ -3,8 +3,8 @@ { AD_Req,//添加设备请求 AD_Res,//添加设备响应 - DD_Req,//关闭设备请求 - DD_Res,//关闭设备请求 + CD_Req,//关闭设备请求 + CD_Res,//关闭设备请求 PD_Req,//暂停设备请求 PD_Res,//暂停设备请求 }; @@ -29,15 +29,22 @@ { char Device_Name[32]; char Device_Status[32]; - char Start_Time[32]; - char Work_Time[32]; char Manufacturer[100]; char Devices_Type[32]; + double Longitude; + double Latitude; }; struct ADRes { Head head; - + char Device_Name[32]; + char Device_Status[32]; + char Start_Time[32]; + char Work_Time[32]; + char Manufacturer[100]; + char Devices_Type[32]; + double Longitude; + double Latitude; ADPermission per; ADRes() { head.type = AD_Res; @@ -47,16 +54,16 @@ }; //关闭设备 -struct DDReq +struct CDReq { Head head; char Device_Name[32]; - DDReq() { - head.type = DD_Req; - head.len = sizeof(DDReq); + CDReq() { + head.type = CD_Req; + head.len = sizeof(CDReq); } }; -struct DDPermission +struct CDPermission { char Device_Name[32]; char Device_Status[32]; @@ -64,15 +71,18 @@ char Work_Time[32]; char Manufacturer[100]; char Devices_Type[32]; + double Longitude; + double Latitude; }; -struct DDRes +struct CDRes { Head head; - - DDPermission per; - DDRes() { - head.type = DD_Res; - head.len = sizeof(DDRes); + char Device_Status[32]; + int status; + CDPermission per; + CDRes() { + head.type = CD_Res; + head.len = sizeof(CDRes); } }; @@ -94,11 +104,15 @@ char Work_Time[32]; char Manufacturer[100]; char Devices_Type[32]; + double Longitude; + double Latitude; }; struct PDRes { Head head; - + char Device_Status[32]; + char Work_Time[32]; + int status; PDPermission per; PDRes() { head.type = PD_Res; diff --git "a/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1101.doc" "b/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1101.doc" new file mode 100644 index 0000000..c9ef8ff --- /dev/null +++ "b/Client/\351\273\216\345\274\230\351\234\226/log/\350\256\276\345\244\207\347\256\241\347\220\206_\351\273\216\345\274\230\351\234\226_1101.doc" Binary files differ diff --git "a/Server/\347\216\213\347\220\250\345\205\203/document/~$\350\241\250.docx" "b/Server/\347\216\213\347\220\250\345\205\203/document/~$\350\241\250.docx" new file mode 100644 index 0000000..8b245e2 --- /dev/null +++ "b/Server/\347\216\213\347\220\250\345\205\203/document/~$\350\241\250.docx" Binary files differ diff --git "a/Server/\347\216\213\347\220\250\345\205\203/document/\345\244\207\344\273\275\345\257\274\345\207\272.txt" "b/Server/\347\216\213\347\220\250\345\205\203/document/\345\244\207\344\273\275\345\257\274\345\207\272.txt" deleted file mode 100644 index 79c8216..0000000 --- "a/Server/\347\216\213\347\220\250\345\205\203/document/\345\244\207\344\273\275\345\257\274\345\207\272.txt" +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# 鏁版嵁搴撹繛鎺ュ弬鏁� -DB_USER="your_username" -DB_PASS="your_password" -DB_NAME="your_database_name" -BACKUP_DIR="/path/to/backup/directory" - -# 鑾峰彇褰撳墠鏃ユ湡锛岀敤浜庢枃浠跺悕 -DATE=$(date +%Y%m%d%H%M%S) - -# 澶囦唤鏂囦欢鍚� -BACKUP_FILE="${BACKUP_DIR}/backup_${DATE}.sql" - -# 鍒涘缓澶囦唤鐩綍锛堝鏋滀笉瀛樺湪锛� -mkdir -p $BACKUP_DIR - -# 浣跨敤mysqldump杩涜鏁版嵁搴撳浠� -mysqldump -u $DB_USER -p$DB_PASS $DB_NAME > $BACKUP_FILE - -if [ $? -eq 0 ]; then - echo "鏁版嵁搴撳浠芥垚鍔燂細$BACKUP_FILE" -else - echo "鏁版嵁搴撳浠藉け璐�" -fi - -# 娣诲姞瀹氭椂浠诲姟锛堜娇鐢╟rontab -e鏉ョ紪杈戝畾鏃朵换鍔★級 -# 渚嬪锛屾瘡澶╁噷鏅�2鐐规墽琛屽浠� -# 0 2 * * * /path/to/this/script.sh \ No newline at end of file diff --git "a/Server/\347\216\213\347\220\250\345\205\203/document/\345\273\272\350\241\250.docx" "b/Server/\347\216\213\347\220\250\345\205\203/document/\345\273\272\350\241\250.docx" deleted file mode 100644 index ed3cc7a..0000000 --- "a/Server/\347\216\213\347\220\250\345\205\203/document/\345\273\272\350\241\250.docx" +++ /dev/null Binary files differ diff --git "a/Server/\347\216\213\347\220\250\345\205\203/document/\350\241\250.docx" "b/Server/\347\216\213\347\220\250\345\205\203/document/\350\241\250.docx" new file mode 100644 index 0000000..4c098dd --- /dev/null +++ "b/Server/\347\216\213\347\220\250\345\205\203/document/\350\241\250.docx" Binary files differ diff --git "a/Server/\347\216\213\347\220\250\345\205\203/document/\351\230\262\346\263\250\345\205\245.txt" "b/Server/\347\216\213\347\220\250\345\205\203/document/\351\230\262\346\263\250\345\205\245.txt" deleted file mode 100644 index 19a2f6c..0000000 --- "a/Server/\347\216\213\347\220\250\345\205\203/document/\351\230\262\346\263\250\345\205\245.txt" +++ /dev/null @@ -1,67 +0,0 @@ -#include <iostream> -#include <mysql_driver.h> -#include <mysql_connection.h> -#include <cppconn/statement.h> -#include <cppconn/prepared_statement.h> -#include <cppconn/resultset.h> -#include <string> -#include <regex> - -class DatabaseUtils { -public: - // 杩炴帴鏁版嵁搴� - static sql::Connection* connect() { - try { - sql::mysql::MySQL_Driver* driver = sql::mysql::get_mysql_driver_instance(); - sql::Connection* con = driver->connect("tcp://127.0.0.1:3306", "mayi", "123456"); - con->setSchema("your_database"); - return con; - } catch (sql::SQLException& e) { - std::cerr << "鏁版嵁搴撹繛鎺ラ敊璇�: " << e.what() << std::endl; - return nullptr; - } - } - - // 妫�鏌QL璇彞鏄惁瀛樺湪娼滃湪娉ㄥ叆椋庨櫓锛堢畝鍗曟鍒欐牎楠岋級 - static bool isSafeSQL(const std::string& sql) { - // 绠�鍗曠殑姝e垯琛ㄨ揪寮忥紝闃叉甯歌鐨勬敞鍏ュ叧閿瘝 - std::regex injectionRegex("(drop|delete|update|insert|select\\s+\\*\\s+from)", std::regex_constants::icase); - return!std::regex_search(sql, injectionRegex); - } - - // 浣跨敤鍙傛暟鍖栨煡璇㈡墽琛孲QL璇彞 - static sql::ResultSet* executeSafeQuery(sql::Connection* con, const std::string& sql, const std::vector<std::string>& params) { - try { - sql::PreparedStatement* pstmt = con->prepareStatement(sql); - for (size_t i = 0; i < params.size(); ++i) { - pstmt->setString(i + 1, params[i]); - } - return pstmt->executeQuery(); - } catch (sql::SQLException& e) { - std::cerr << "鏌ヨ鎵ц閿欒: " << e.what() << std::endl; - return nullptr; - } - } -}; - -int main() { - sql::Connection* con = DatabaseUtils::connect(); - if (con) { - std::string sql = "SELECT * FROM your_table WHERE column_name =?"; - std::vector<std::string> params = {"test_value"}; - if (DatabaseUtils::isSafeSQL(sql)) { - sql::ResultSet* res = DatabaseUtils::executeSafeQuery(con, sql, params); - if (res) { - while (res->next()) { - // 澶勭悊缁撴灉 - std::cout << res->getString(1) << std::endl; - } - delete res; - } - } else { - std::cerr << "娼滃湪鐨凷QL娉ㄥ叆椋庨櫓" << std::endl; - } - delete con; - } - return 0; -} \ No newline at end of file diff --git "a/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1031 .doc" "b/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1031 .doc" new file mode 100644 index 0000000..45c9110 --- /dev/null +++ "b/Server/\347\216\213\347\220\250\345\205\203/log/\346\227\245\345\277\227\346\250\241\346\235\277_\347\216\213\347\220\250\345\205\203_1031 .doc" Binary files differ diff --git "a/Server/\351\251\254\346\270\235\346\235\255/log/20241101\346\230\206\344\273\221\346\227\245\346\212\245.doc" "b/Server/\351\251\254\346\270\235\346\235\255/log/20241101\346\230\206\344\273\221\346\227\245\346\212\245.doc" new file mode 100644 index 0000000..27eef8f --- /dev/null +++ "b/Server/\351\251\254\346\270\235\346\235\255/log/20241101\346\230\206\344\273\221\346\227\245\346\212\245.doc" Binary files differ diff --git "a/Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241030.doc" "b/Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241031.doc" similarity index 100% rename from "Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241030.doc" rename to "Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241031.doc" Binary files differ diff --git "a/Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241101.doc" "b/Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241101.doc" new file mode 100644 index 0000000..75600f2 --- /dev/null +++ "b/Server/\351\251\254\346\270\235\346\235\255/log/\346\227\245\345\277\227_\351\251\254\346\270\235\346\235\255_20241101.doc" Binary files differ diff --git a/common.h b/common.h index a714e74..182b8e6 100644 --- a/common.h +++ b/common.h @@ -1,9 +1,7 @@ #ifndef COMMON_H #define COMMON_H -#include <iostream> -#include <cstring> -#include <QString> +#include <string.h> enum TypeInfo{ -- Gitblit v1.8.0