240717班级,工业化控制系统,煤矿相关行业,昆仑系统
kog
MYH
2024-11-04 200b6cf540f507bd70bdebdcb79443372a393a28
kog
1个文件已修改
9个文件已添加
1037 ■■■■ 已修改文件
Server/马渝杭/code/common.h 277 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Server/马渝杭/code/server_version.pro 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Server/马渝杭/code/server_version.pro.user 318 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Server/马渝杭/code/type.h.autosave 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Server/马渝杭/code/versionmanage.cpp 251 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Server/马渝杭/code/versionmanage.h 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Server/马渝杭/code/versionmanage.ui 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Server/马渝杭/code/versionmanage_main.cpp 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Server/马渝杭/log/20241104昆仑日报.doc 补丁 | 查看 | 原始文档 | blame | 历史
Server/马渝杭/log/日志_马渝杭_20241104.doc 补丁 | 查看 | 原始文档 | blame | 历史
Server/ÂíÓ庼/code/common.h
@@ -1,162 +1,195 @@
#ifndef COMMON_H
#define COMMON_H
#include  <string.h>
//私有协议封装
//请求响应结构体有数据头+数据体
//使用枚举来统一各种功能类型】
#include <string.h>
enum TypeInfo{
    LOGIN_REQ,  //登录请求
    LOGIN_RES,
    VERSIONUPDATA_REQ,  // ç‰ˆæœ¬æ›´æ–°è¯·æ±‚
    VERSIONUPDATA_RES,
    VERSIONNUM_REQ,     //版本号请求
    VERSIONNUM_RES,
    UPLOAD_FILE_REQ,
    UPLOAD_FILE_RES,
    VERSIONINFOENTRY_REQ,    //版本信息条目
    VERSIONINFOENTRY_RES
    //自动升级
    VERSION_NUM_REQ,  // ç‰ˆæœ¬å·è¯·æ±‚
    VERSION_NUM_RES,   // ç‰ˆæœ¬å·å“åº”
    UPLOAD_FILE_REQ, // ä¸Šä¼ æ–‡ä»¶çš„请求
    UPLOAD_FILE_RES, // ä¸Šä¼ æ–‡ä»¶çš„响应
    VERSION_INFOENTRY_REQ,       // ç‰ˆæœ¬ä¿¡æ¯å½•入请求
    VERSION_INFOENTRY_RES,       //版本信息录入响应
    VERSION_UPDATE_REQ, // ç‰ˆæœ¬æ›´æ–°è¯·æ±‚
    VERSION_UPDATE_RES, // ç‰ˆæœ¬æ›´æ–°å“åº”
    FILE_DOWNLOADS_REQ, // ç‰ˆæœ¬æ›´æ–°æ–‡ä»¶ä¸‹è½½è¯·æ±‚
    FILE_DOWNLOADS_RES, // ç‰ˆæœ¬æ›´æ–°æ–‡ä»¶ä¸‹è½½å“åº”
    DOWNLOAD_SUCCESSFULLY_RES,       // æ›´æ–°æ–‡ä»¶ä¸‹è½½æˆåŠŸçš„å“åº”
};
struct Head
{
    int type;   // åŠŸèƒ½ç±»åž‹ï¼Œè§£å†³æ¯ä¸ªåŒ…çš„å…·ä½“ä½œç”¨ï¼ŒåŒºåˆ†ä¸šåŠ¡
    int len;    //封包长度
};
// ç™»å½•业务
// ç™»å½•请求
struct LoginReq
{
    Head head;
    char user_name[32];
    char password[32];
    LoginReq(){
        head.type=LOGIN_REQ;
        head.len=sizeof(LoginReq);
    }
};
//登录权限结构体
struct PermissionInfo
{
    int admin;  //管理员
    int history; //历史查看
    int version_manager;//版本管理
    int log_search; //日志查看
    int flaw_mark ; //缺陷标记
struct Head{
    int type;
    int len;
};
//登录响应
struct LoginRes
//自动升级
struct VersionNumReq        // ç‰ˆæœ¬å·è¯·æ±‚
{
    Head head;
    char user_name[32];
    int state; // ç™»å½•状态
    PermissionInfo per;
    LoginRes(){
        head.type=LOGIN_RES;
        head.len=sizeof(LoginRes);
    VersionNumReq() {
        head.type = VERSION_NUM_REQ;
        head.len = sizeof(VersionNumReq);
    }
};
struct VersionUpdataReq //版本更新请求的结构体
struct VersionNumRes        // ç‰ˆæœ¬å·å“åº”
{
    Head head;
    VersionUpdataReq(){
        head.type=VERSIONUPDATA_REQ;
        head.len=sizeof(VersionUpdataReq);
    char versionId[64]; // ç‰ˆæœ¬å·
    VersionNumRes() {
        head.type = VERSION_NUM_RES;
        head.len = sizeof(VersionNumRes);
    }
};
struct VersionUpdataRes //版本更新响应的结构体
{
    Head head;
    char version_id[64];    // ç‰ˆæœ¬å·
    char update_date[32];   //更新时间
    char file_path[128];   //服务端提供最新版本的本地路径
    VersionUpdataRes(){
        head.type=VERSIONUPDATA_REQ;
        head.len=sizeof(VersionUpdataReq);
    }
};
struct VersionNumReq    //版本号请求
{
    Head head;
    VersionNumReq(){
        head.type=VERSIONNUM_REQ;
        head.len=sizeof(VersionNumReq);
    }
};
struct VersionNumRes
{
    Head head;
    char version_id[64];
    VersionNumRes(){
        head.type=VERSIONNUM_RES;
        head.len=sizeof(VersionNumRes);
    }
};
//文件传输功能
// æ–‡ä»¶ä¼ è¾“
struct FileInfo
{
    char file_name[256];
    long long file_size;
    char s_filepath[32];
    char content[0];    //柔性数组结构体
    char fileName[256];
    long long fileSize;
    char s_filepath[128];
    char content[0];
};
struct UploadFileReq
struct UploadFileReq        // ä¸Šä¼ æ–‡ä»¶çš„请求
{
    Head head;
    FileInfo fileInfo;
    UploadFileReq(){
        head.type=UPLOAD_FILE_REQ;
        head.len=sizeof(UploadFileReq);
    UploadFileReq() {
        head.type = UPLOAD_FILE_REQ;
        head.len = sizeof(UploadFileReq);
    }
};
struct UploadFileRes
{
    Head head;
   int status;
   long long file_size;     //总大小
   long long file_cuesize;  //文件已传大小
    UploadFileRes(){
        head.type=UPLOAD_FILE_RES;
        head.len=sizeof(UploadFileRes);
    }
};
//版本信息录入---版本信息条目
struct VersionInfoEntryReq
{
   Head head;
   char version_id[64];
   char version_id_old[64];
   char s_filepath[32];     //服务器放最新版本的路径
   char version_description[256];   //更新描述
   char version_creattime[32];  //更新时间
   char filename[16][128];      //支持多文件上传
   long long filesize[16];      //文件组的大小
   char c_filepath[16][128];    //客户端的安装路径
   int filenum;     //一次版本更新所需文件个数
   VersionInfoEntryReq(){
        head.type=VERSIONINFOENTRY_REQ;
        head.len=sizeof(VersionInfoEntryReq);
struct UploadFileRes {      // ä¸Šä¼ æ–‡ä»¶çš„响应
    Head head;
    bool state = false;
    char fileName[256];
    long long file_size;
    UploadFileRes()
    {
        head.type = UPLOAD_FILE_RES;
        head.len = sizeof(UploadFileRes);
    }
};
//响应
// ç‰ˆæœ¬ä¿¡æ¯å½•å…¥
// è¯·æ±‚
//struct VersionInfoEntryReq {
//    Head head;
//    char version_id[64]; // ç‰ˆæœ¬å·
//    char version_id_old[64]; // ä¸Šä¸€ä¸ªç‰ˆæœ¬å·
//    char s_filepath[32];    //服务器放最新版本的路径
//    char version_description[256]; //更新内容
//    char version_creattime[32]; // æ›´æ–°æ—¶é—´
//    char filename[16][128];
//    long long filesize[16];
//    char c_filepath[16][128];
//    int fileNum;
//    VersionInfoEntryReq()
//    {
//        head.type = VERSIONINFOENTRY_REQ;
//        head.len = sizeof(VersionInfoEntryReq);
//    }
//};
struct VersionInfoEntryReq {
    Head head;
    char versionId[64]; // ç‰ˆæœ¬å·
    char versionIdOld[64]; // ä¸Šä¸€ä¸ªç‰ˆæœ¬å·
    int fileNum;
    char context[0];        //包含下载文件信息
    VersionInfoEntryReq()
    {
        head.type = VERSION_INFOENTRY_REQ;
        head.len = sizeof(VersionInfoEntryReq);
    }
};
// ç‰ˆæœ¬ä¿¡æ¯å½•入响应
struct VersionInfoEntryRes {
    Head head;
    char version_id_old[64]; // ç‰ˆæœ¬å·
    bool state = false;
    VersionInfoEntryRes()
    {
        head.type = VERSIONINFOENTRY_RES;
        head.type = VERSION_INFOENTRY_RES;
        head.len = sizeof(VersionInfoEntryRes);
    }
};
// ç‰ˆæœ¬æ›´æ–°è¯·æ±‚
struct VersionUpdateReq {
    Head head;
    char curVersionId[64]; // ç‰ˆæœ¬å·
    VersionUpdateReq()
    {
        head.type = VERSION_UPDATE_REQ;
        head.len = sizeof(VersionUpdateReq);
    }
};
// ç‰ˆæœ¬æ›´æ–°å“åº”
struct VersionUpdateRes {
    Head head;
    bool state = false;
    char versionId[64]; // ç‰ˆæœ¬å·
    char updateDate[32]; // æ›´æ–°æ—¶é—´
    char versionDescription[1024]; //更新描述
    VersionUpdateRes()
    {
        head.type = VERSION_UPDATE_RES;
        head.len = sizeof(VersionUpdateRes);
    }
};
// ç‰ˆæœ¬æ›´æ–°æ–‡ä»¶ä¸‹è½½è¯·æ±‚
struct FileDownloadsReq {
    Head head;
    char versionId[64]; // ç‰ˆæœ¬å·
    FileDownloadsReq()
    {
        head.type = FILE_DOWNLOADS_REQ;
        head.len = sizeof(FileDownloadsReq);
    }
};
// ç‰ˆæœ¬æ›´æ–°æ–‡ä»¶ä¸‹è½½å“åº”
struct FileDownloadsRes {
    Head head;
    char versionId[64]; // ç‰ˆæœ¬å·
    char filename[128]; //文件名
    long long filesize; //文件大小
    char c_filepath[128];    //客户端放最新版本的本地路径
    int fileNum; // æ–‡ä»¶æ•°é‡
    long long allFileSize; // æ–‡ä»¶æ€»å¤§å°
    char content[0];
    FileDownloadsRes()
    {
        head.type = FILE_DOWNLOADS_RES;
        head.len = sizeof(FileDownloadsRes);
    }
};
// æ›´æ–°æ–‡ä»¶ä¸‹è½½æˆåŠŸçš„å“åº”
struct DownloadSuccessfullyRes {
    Head head;
    bool state = false;
    char fileName[256];
    long long fileSize;
    DownloadSuccessfullyRes()
    {
        head.type = DOWNLOAD_SUCCESSFULLY_RES;
        head.len = sizeof(DownloadSuccessfullyRes);
    }
};
Server/ÂíÓ庼/code/server_version.pro
New file
@@ -0,0 +1,29 @@
QT       += core gui
QT       += network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++17
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
HEADERS += \
    versionmanage.h \
    common.h \
SOURCES += \
    versionmanage_main.cpp \
    versionmanage.cpp \
FORMS += \
    versionmanage.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
DISTFILES +=
Server/ÂíÓ庼/code/server_version.pro.user
New file
@@ -0,0 +1,318 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.5.0, 2024-11-02T23:00:40. -->
<qtcreator>
 <data>
  <variable>EnvironmentId</variable>
  <value type="QByteArray">{7612f2ce-8739-48f9-bb70-81cdc706b9e5}</value>
 </data>
 <data>
  <variable>ProjectExplorer.Project.ActiveTarget</variable>
  <value type="int">0</value>
 </data>
 <data>
  <variable>ProjectExplorer.Project.EditorSettings</variable>
  <valuemap type="QVariantMap">
   <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
   <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
   <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
    <value type="QString" key="language">Cpp</value>
    <valuemap type="QVariantMap" key="value">
     <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
    </valuemap>
   </valuemap>
   <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
    <value type="QString" key="language">QmlJS</value>
    <valuemap type="QVariantMap" key="value">
     <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
    </valuemap>
   </valuemap>
   <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
   <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
   <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
   <value type="int" key="EditorConfiguration.IndentSize">4</value>
   <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
   <value type="int" key="EditorConfiguration.MarginColumn">80</value>
   <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
   <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
   <value type="int" key="EditorConfiguration.PaddingMode">1</value>
   <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
   <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
   <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
   <value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
   <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
   <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
   <value type="int" key="EditorConfiguration.TabSize">8</value>
   <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
   <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
   <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
   <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
   <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
   <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
  </valuemap>
 </data>
 <data>
  <variable>ProjectExplorer.Project.PluginSettings</variable>
  <valuemap type="QVariantMap"/>
 </data>
 <data>
  <variable>ProjectExplorer.Project.Target.0</variable>
  <valuemap type="QVariantMap">
   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.9.4 MinGW 32bit</value>
   <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.9.4 MinGW 32bit</value>
   <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.594.win32_mingw53_kit</value>
   <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
   <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
   <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/QtProject/build-server_version-Desktop_Qt_5_9_4_MinGW_32bit-Debug</value>
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
     </valuemap>
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
     </valuemap>
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
    </valuemap>
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
     </valuemap>
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
    </valuemap>
    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
   </valuemap>
   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/QtProject/build-server_version-Desktop_Qt_5_9_4_MinGW_32bit-Release</value>
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
     </valuemap>
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
     </valuemap>
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
    </valuemap>
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
     </valuemap>
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
    </valuemap>
    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
   </valuemap>
   <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
    <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/QtProject/build-server_version-Desktop_Qt_5_9_4_MinGW_32bit-Profile</value>
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
      <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
      <value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
     </valuemap>
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
     </valuemap>
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">构建</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
    </valuemap>
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
     <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
      <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
      <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
      <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
      <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
      <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
     </valuemap>
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">清理</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
    </valuemap>
    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
    <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
    <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Profile</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
    <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
    <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
   </valuemap>
   <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
   <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
    <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
     <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">部署</value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
     <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
    </valuemap>
    <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">在本地部署</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
   </valuemap>
   <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
   <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
   <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
    <value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
    <value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
    <value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
    <value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
    <value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
    <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
    <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
    <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
    <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
    <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
    <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
    <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
    <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
    <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
    <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
    <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
    <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
    <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
    <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
    <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
     <value type="int">0</value>
     <value type="int">1</value>
     <value type="int">2</value>
     <value type="int">3</value>
     <value type="int">4</value>
     <value type="int">5</value>
     <value type="int">6</value>
     <value type="int">7</value>
     <value type="int">8</value>
     <value type="int">9</value>
     <value type="int">10</value>
     <value type="int">11</value>
     <value type="int">12</value>
     <value type="int">13</value>
     <value type="int">14</value>
    </valuelist>
    <value type="int" key="PE.EnvironmentAspect.Base">2</value>
    <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">server_version</value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
    <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/QtProject/server_version/server_version.pro</value>
    <value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">server_version.pro</value>
    <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
    <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">D:/QtProject/build-server_version-Desktop_Qt_5_9_4_MinGW_32bit-Debug</value>
    <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
    <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
    <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
    <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
    <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
    <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
   </valuemap>
   <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
  </valuemap>
 </data>
 <data>
  <variable>ProjectExplorer.Project.TargetCount</variable>
  <value type="int">1</value>
 </data>
 <data>
  <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
  <value type="int">18</value>
 </data>
 <data>
  <variable>Version</variable>
  <value type="int">18</value>
 </data>
</qtcreator>
Server/ÂíÓ庼/code/type.h.autosave
New file
@@ -0,0 +1,69 @@
#ifndef TYPE_H
#define TYPE_H
#include  <string.h>
//私有协议封装
//请求响应结构体有数据头+数据体
//使用枚举来统一各种功能类型】
enum TypeInfo{
    LOGIN_REQ,  //登录请求
    LOGIN_RES,
    VERSIONUPDATA_REQ,  // ç‰ˆæœ¬æ›´æ–°è¯·æ±‚
    VERSIONUPDATA_RES,
    VEESIONNUM_REQ,     //版本号请求
    VERSIONNUM_RES,
    UPLOAD_FILE_REQ,
    UPLOAD_FILE_RES,
    VERSIONINFOENTRY_REQ,    //版本信息条目
    VERSIONINFOENTRY_RES
};
struct Head
{
    int type;   // åŠŸèƒ½ç±»åž‹ï¼Œè§£å†³æ¯ä¸ªåŒ…çš„å…·ä½“ä½œç”¨ï¼ŒåŒºåˆ†ä¸šåŠ¡
    int len;    //封包长度
};
// ç™»å½•业务
// ç™»å½•请求
struct LoginReq
{
    Head head;
    char user_name[32];
    char password[32];
    LoginReq(){
        head.type=LOGIN_REQ;
        head.len=sizeof(LoginReq);
    }
};
//登录权限结构体
struct PermissionInfo
{
    int admin;  //管理员
    int history; //历史查看
    int version_manager;//版本管理
    int log_search; //日志查看
    int flaw_mark ; //缺陷标记
};
//登录响应
struct LoginRes
{
    Head head;
    char user_name[32];
    int state; // ç™»å½•状态
    PermissionInfo per;
    LoginRes(){
        head.type=
    }
};
#endif // TYPE_H
Server/ÂíÓ庼/code/versionmanage.cpp
New file
@@ -0,0 +1,251 @@
#include "versionmanage.h"
#include "ui_versionmanage.h"
#include<QDateTime>
#include<QThread>
VersionManage::VersionManage(QWidget *parent)
    :QMainWindow(parent)
{
    //Tcp链接
    m_client=new QTcpSocket(this);
    m_client->connectToHost("127.0.0.1",16888);
    if(m_client->waitForConnected()){
        qDebug()<<"conn ok!";
        connect(m_client,SIGNAL(readyRead()),this,SLOT(myRead()));
    }else{
         qDebug()<<"conn fail or waiting for conn";
    }
    //向客户端发送版本号请求
    sendVersionNumReq();
    /*创建一个中央窗口部件 centralWidget,并将其作为当前窗口的子控件。
    è®¾ç½®ä¸€ä¸ªåž‚直布局 layout åˆ° centralWidget ä¸Šï¼Œ
    ä½¿å¾—任何添加到 layout çš„子控件都会在 centralWidget ä¸­ä»Žä¸Šåˆ°ä¸‹æŽ’列。*/
    QWidget *centralWidget=new QWidget(this);
    QVBoxLayout *layout=new QVBoxLayout(centralWidget);
    //获取当前工作目录
    QString currentPath=QDir::currentPath();
    qDebug()<<"当前工作路径:"<<currentPath;
    //文件导入按钮和文件名标签创建
    QPushButton *importButton=new QPushButton(tr("导入文件"),this);
    connect(importButton,&QPushButton::clicked,this,&VersionManage::importFile);
    fileNameLabel=new QLabel(tr("未选择文件"),this);
    orignalPathLabel=new QLabel(tr("未选择文件路径"),this);
    //版本号和路径编辑框初始化
    currVersionEdit=new QLineEdit(this);
    clientPathEdit=new QLineEdit(this);
    serverPathEdit=new QLineEdit(this);
    versionDescriptionEdit = new QTextEdit(this);
    //prevVersionEdit=new QLineEdit(this);
    //老版本组合下拉框,各种占位符设计
    prevVersionComboBox=new QComboBox(this);
    prevVersionComboBox->addItem(tr("上一个版本号"));
    //prevVersionEdit->setPlaceholderText(tr("上一个版本号"));
    currVersionEdit->setPlaceholderText(tr("当前版本号"));
    clientPathEdit->setPlaceholderText(tr("客户端路劲"));
    serverPathEdit->setPlaceholderText(tr("服务器路径"));
    versionDescriptionEdit->setPlaceholderText(tr("请输入新版本描述"));
    //添加版本的按钮,到表格
    QPushButton *addButton =new QPushButton(tr("添加"),this);
    connect(addButton,&QPushButton::clicked,this,&VersionManage::addFileInfo);
    //布局上半部分
    layout->addWidget(prevVersionComboBox);
    prevVersionComboBox->setStyleSheet("font-size: 22px;");
    layout->addWidget(currVersionEdit);
    currVersionEdit->setStyleSheet("font-family: 'Microsoft YaHei'; font-size: 22px;");
    layout->addWidget(serverPathEdit);
    serverPathEdit->setStyleSheet("font-family: 'Microsoft YaHei'; font-size: 22px;");
    layout->addWidget(versionDescriptionEdit);
    versionDescriptionEdit->setStyleSheet("font-family: 'Microsoft YaHei'; font-size: 22px;");
    //自动填写服务端路径
    connect(currVersionEdit,&QLineEdit::textChanged,
            this,[this](const QString &text){
        serverPathEdit->setText("./version/"+text);
    });
    layout->addWidget(importButton);
    importButton->setStyleSheet("font-family: 'Microsoft YaHei'; font-size: 22px;");
    layout->addWidget(fileNameLabel);
    fileNameLabel->setStyleSheet("font-family: 'Microsoft YaHei'; font-size: 22px;");
    layout->addWidget(orignalPathLabel);
    orignalPathLabel->setStyleSheet("font-family: 'Microsoft YaHei'; font-size: 22px;");
    layout->addWidget(clientPathEdit);
    clientPathEdit->setStyleSheet("font-family: 'Microsoft YaHei'; font-size: 22px;");
    layout->addWidget(addButton);
    addButton->setStyleSheet("font-family: 'Microsoft YaHei'; font-size: 22px;");
    //下半部分表格创建
    fileTable=new QTableWidget(0,7,this);
    fileTable->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
    fileTable->setHorizontalHeaderLabels({tr("文件名"), tr("文件大小"), tr("上一个版本号"), tr("当前版本号"), tr("文件原始路径"), tr("客户端路径"), tr("服务器路径")});
    QPushButton *savebutton=new QPushButton(tr("保存至数据库"),this);
    connect(savebutton,&QPushButton::clicked,this,&VersionManage::saveToDisk);
    layout->addWidget(fileTable);
    fileTable->setStyleSheet("font-family: 'Microsoft YaHei'; font-size: 22px;");
    layout->addWidget(savebutton);
    savebutton->setStyleSheet("font-family: 'Microsoft YaHei'; font-size: 22px;");
    QPushButton* deleteButton=new QPushButton(tr("删除一个文件"),this);
    deleteButton->setStyleSheet("font-family: 'Microsoft YaHei'; font-size: 22px");
    connect(deleteButton,&QPushButton::clicked,this,[&](){
        int currrow=fileTable->currentRow();
        if(currrow!=-1){
            fileTable->removeRow(currrow);
        }
    });
    layout->addWidget(deleteButton);
    //窗口
    resize(1500, 800);
    setCentralWidget(centralWidget);
}
// å‘送版本号请求
void VersionManage::sendVersionNumReq()
{
    VersionNumReq req;
    int len = m_client->write((char*)&req,req.head.len);
    qDebug()<<"len:"<<len;
}
//导入文件功能
void VersionManage::importFile()
{   //打开文件对话框
    importedFilePath=QFileDialog::getOpenFileName(this,
              tr("选择文件"),"",tr("所有文件(*)"));
    if(!importedFilePath.isEmpty()){
        QFileInfo fileInfo(importedFilePath);
        fileNameLabel->setText(fileInfo.fileName());    //显示文件名+路径
        orignalPathLabel->setText(importedFilePath);
        clientPathEdit->setText(importedFilePath);
        serverPathEdit->setText(importedFilePath);
    }
}
void VersionManage::addFileInfo()
{
    if(importedFilePath.isEmpty()){
        return ;
    }
    int rowCount=fileTable->rowCount();
    fileTable->insertRow(rowCount);
    QFileInfo fileInfo(importedFilePath);
    fileTable->setItem(rowCount,0,new QTableWidgetItem(fileInfo.fileName()));
    qDebug()<<fileInfo.size();
    fileTable->setItem(rowCount,1,new QTableWidgetItem(QString::number(fileInfo.size())));
    fileTable->setItem(rowCount,2,new QTableWidgetItem(prevVersionComboBox->currentText()));//**
    fileTable->setItem(rowCount,3,new QTableWidgetItem(currVersionEdit->text()));
    fileTable->setItem(rowCount,4,new QTableWidgetItem(orignalPathLabel->text()));
    fileTable->setItem(rowCount,5,new QTableWidgetItem(clientPathEdit->text()));
    fileTable->setItem(rowCount,6,new QTableWidgetItem(serverPathEdit->text()));
    //添加到表格,清空内容
    //prevVersionComboBox->clear();
    //currVersionEdit->clear();
    //serverPathEdit->clear();
    clientPathEdit->clear();
    fileNameLabel->clear();
    orignalPathLabel->clear();
    importedFilePath.clear();
}
//将表格中的文件另存为指定地点
void VersionManage::saveToDisk()
{
    if(fileTable->rowCount()!=0){
        for(int row=0;row<fileTable->rowCount();++row){
            QString saveDirectory = fileTable->item(row, 6)->text();//服务器地址
            QString fileName = fileTable->item(row, 0)->text();
            QString sourceFilePath = fileTable->item(row, 4)->text();  //客户文件原路径
//          QString destinationFilePath = saveDirectory + "/" + fileName;
            QFile fl(sourceFilePath);   //打开本地文件(版本跟信号的文件)
            qDebug()<< "打开前";
            qDebug()<< sourceFilePath;
            if(fl.open(QIODevice::ReadOnly)){
                //QFile::copy(sourceFilePath,destinationFilePath);
                qDebug()<< "打开前";
                long long all_size = fl.size() + sizeof(UploadFileReq);//总大小把控info了
                UploadFileReq *req=(UploadFileReq*) (new char[all_size]);
                req->head.type=UPLOAD_FILE_REQ;
                req->head.len==all_size;
                req->fileInfo.fileSize=fl.size();
                strcpy(req->fileInfo.s_filepath,saveDirectory.toLocal8Bit().data());
                qDebug()<<"s_filepath:"<< req->fileInfo.s_filepath;
                strcpy(req->fileInfo.fileName,fileName.toLocal8Bit().data());
                memcpy(req->fileInfo.content,fl.readAll().data(),fl.size());
                //组包完成,发包
                qDebug()<<m_client->write((char*)req,req->head.len);
                m_client->flush();  //立即发送
                m_client->waitForBytesWritten(); //同步等待数据写入完成
                delete req;
                qDebug()<<"发送数据库成功!";
                fl.close();
                //等待回应
                qDebug()<<"waiting for 8 seconds...";
                QThread::sleep(8);
                qDebug()<<"Done waiting";
                //数据库信息录入,版本信息条目
               VersionInfoEntryReq *req_2=new VersionInfoEntryReq;
               strcpy_s(req_2->versionId,currVersionEdit->text().toLocal8Bit().data());
               strcpy_s(req_2->versionIdOld,prevVersionComboBox->currentText().toLocal8Bit().data());
               req_2->fileNum=fileTable->rowCount();
               QString str=serverPathEdit->text()+versionDescriptionEdit->toPlainText()
                       +QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss");
               for(int i=0;i<fileTable->rowCount();++i){
                   str+=fileTable->item(i,0)->text()+fileTable->item(i,1)->text()+fileTable->item(i,5)->text();
               }
               strcpy(req_2->context,str.toLocal8Bit().data());//_s ä¿æŠ¤
               qDebug()<<"len:"<<m_client->write((char*)req_2,req_2->head.len);
               fileTable->setRowCount(0);
            }
        }
    }
}
void VersionManage::myRead()
{
    QByteArray buffer=m_client->readAll();
    qDebug()<<"buffer:"<<buffer;
    //心跳检查
    //解包
    int type=((Head*)buffer.data())->type;
    if(type==VERSION_NUM_RES){
        //版本号相应
    }
    else if(type==UPLOAD_FILE_RES){}
}
Server/ÂíÓ庼/code/versionmanage.h
New file
@@ -0,0 +1,60 @@
#ifndef VERSIONMANAGE_H
#define VERSIONMANAGE_H
#include<QMainWindow>
#include<QWidget>
#include<QVBoxLayout>
#include<QPushButton>
#include<QLineEdit>
#include<QTableWidget>
#include<QFileDialog>   //选择文本或目录
#include<QLabel>
#include<QFile>
#include<QTextStream>   //用于文本格式的读写操作,写入内存
#include<QComboBox>
#include<QTcpSocket>
#include<qstring.h>
#include<qstringlist.h>
#include<QVector>
#include<QTextEdit>
#include "common.h"
class VersionManage: public QMainWindow
{
    Q_OBJECT
public:
    VersionManage(QWidget *parent = nullptr);
    void sendVersionNumReq();
private slots:
    void importFile();
    void addFileInfo();
    void saveToDisk();   //文件保存到数据库
    void myRead();  //收包槽
private:
    QTcpSocket *m_client;
    QComboBox *prevVersionComboBox;
    QLineEdit *currVersionEdit;
    QLineEdit *clientPathEdit;  //客户端路径输入
    QLineEdit *serverPathEdit;
    //QLineEdit *prevVersionEdit;
    QLabel *fileNameLabel;  //显示文件
    QLabel *orignalPathLabel;
    QTableWidget *fileTable;
    QString importedFilePath;   //存储导入文件路径
    QTextEdit *versionDescriptionEdit;
    /*原始:/my_project/src/main.cpp
     * å®¢æˆ·ç«¯w:C:\Users\Username\Documents\my_project\src\main.cpp
     * æœåŠ¡ç«¯ï¼š/var/git/my_project.git/refs/heads/main
*/
};
#endif // VERSIONMANAGE_H
Server/ÂíÓ庼/code/versionmanage.ui
New file
@@ -0,0 +1,24 @@
<ui version="4.0">
 <author/>
 <comment/>
 <exportmacro/>
 <class>versionmanage</class>
 <widget class="QMainWindow" name="versionmanage">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>600</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QMenuBar" name="menubar"/>
  <widget class="QWidget" name="centralwidget"/>
  <widget class="QStatusBar" name="statusbar"/>
 </widget>
 <pixmapfunction/>
 <connections/>
</ui>
Server/ÂíÓ庼/code/versionmanage_main.cpp
New file
@@ -0,0 +1,9 @@
#include"versionmanage.h"
#include<QApplication>
int main(int argc,char* argv[]){
    QApplication a(argc,argv);
    VersionManage w;
    w.show();
    return a.exec();
}
Server/ÂíÓ庼/log/20241104À¥ÂØÈÕ±¨.doc
Binary files differ
Server/ÂíÓ庼/log/ÈÕÖ¾_ÂíÓ庼_20241104.doc
Binary files differ