From b27ac996b6d529c8a6cfc052e1767cf0c3cb48ff Mon Sep 17 00:00:00 2001 From: jyd <2117960600@qq.com> Date: 星期二, 09 九月 2025 19:19:01 +0800 Subject: [PATCH] Merge branch 'master' of ssh://115.28.86.8:29418/~admin/FaceLink_AI_250820 --- Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/imitator_FaceLinkServer.cpp | 19 Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/MySQLDB.h | 30 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/clientmainwindow.cpp | 201 +++ Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/main.cpp | 12 Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/ServerSocket.h | 24 Server/薛嘉瑶/log/日志_薛嘉瑶_0908.doc | 0 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/clientmainwindow.h | 45 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/login.ui | 240 ++- Client/王飞智/log/日志_王飞智_250909.doc | 0 Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/imitator_FaceLinkServer.sln | 28 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/FaceLink_client.pro | 26 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/login.h | 52 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/icon_source/左箭头图标_1756307832.png | 0 Server/梁天/log/日志_梁天_20250908.doc | 0 Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/targetver.h | 8 Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/ReadMe.txt | 30 Server/杨佳乐/log/日志250908.doc | 0 Server/占甜甜/log/日志_占甜甜_20250908.doc | 0 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/register.h | 47 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/textvalidator.cpp | 121 ++ Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/Respond.h | 16 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/struct_data.h | 117 ++ Server/张盼/log/日志_张盼_20250908.doc | 0 Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/MySQLDB.cpp | 148 ++ Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/stdafx.cpp | 8 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/register.ui | 477 ++++++++ Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/stdafx.h | 15 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/clientmainwindow.ui | 113 ++ /dev/null | 329 ----- Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/textvalidator.h | 28 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/FaceLink_client.pro.user | 66 Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/login.cpp | 146 ++ Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/icon_s.qrc | 2 Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/imitator_FaceLinkServer.vcxproj.filters | 57 + Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/imitator_FaceLinkServer.vcxproj | 170 +++ Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/Respond.cpp | 165 +++ Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/struct_data.h | 125 ++ Client/王飞智/code/注册登录服务端(含服务端、数据库、操作API)【数据加密待完善】/ServerSocket.cpp | 184 +++ Client/王飞智/code/注册登录客户端【数据加密待完善】/FaceLink_client/register.cpp | 229 ++++ 39 files changed, 2,806 insertions(+), 472 deletions(-) diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/main.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/main.cpp" deleted file mode 100644 index 99467a1..0000000 --- "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/main.cpp" +++ /dev/null @@ -1,11 +0,0 @@ -#include "userauth_mainwindow.h" -#include <QApplication> - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - UserAuth_MainWindow w; - w.show(); - - return a.exec(); -} diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userauth_mainwindow.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userauth_mainwindow.cpp" deleted file mode 100644 index 1f0b467..0000000 --- "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userauth_mainwindow.cpp" +++ /dev/null @@ -1,86 +0,0 @@ -#include "userauth_mainwindow.h" -#include "userregister_mainwindow.h" - -#include "ui_userauth_mainwindow.h" - -UserAuth_MainWindow::UserAuth_MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::UserAuth_MainWindow) -{ - ui->setupUi(this); - register_ui = new UserRegister_MainWindow(); - connect(this,SIGNAL(open_registerUi_signal()),this,SLOT(goto_register_ui())); - connect(register_ui,SIGNAL(open_loginUi_signal()),this,SLOT(goto_login_ui())); - connect(this,SIGNAL(tar_login_signal()),this,SLOT(tar_login_getInfo())); - connect(register_ui,SIGNAL(tar_register_signal()),this,SLOT(tar_register_getInfo())); -} - -UserAuth_MainWindow::~UserAuth_MainWindow() -{ - delete ui; -} - -/* 鐐瑰嚮鎸夐挳路灞曞紑娉ㄥ唽鐣岄潰 */ -void UserAuth_MainWindow::on_RegisterButton_clicked() -{ - emit open_registerUi_signal(); -} - -/* 灞曞紑锛堣烦杞級娉ㄥ唽鐣岄潰 */ -void UserAuth_MainWindow::goto_register_ui() -{ - this->hide(); - register_ui->show(); -} - -/* 灞曞紑锛堣烦杞級鐧诲綍鐣岄潰 */ -void UserAuth_MainWindow::goto_login_ui() -{ - this->show(); - register_ui->hide(); -} - -#include <QDebug> -#include <QString> -/* 灏嗚緭鍏ョ殑鐧诲綍淇℃伅鎵撳寘 */ -void UserAuth_MainWindow::tar_login_getInfo() -{ - //闇�瑕佺粨鏋勪綋 - - //缁冪粌鎵� - QString s1; - QString s2; - s1 = ui->UserNameEdit->text(); - s2 = ui->PasswordEdit->text(); - qDebug()<<"濮撳悕锛�"<<s1; - qDebug()<<"瀵嗙爜锛�"<<s2; -} - -/* 灏嗚緭鍏ョ殑娉ㄥ唽淇℃伅鎵撳寘 */ -void UserAuth_MainWindow::tar_register_getInfo() -{ - //闇�瑕佺粨鏋勪綋 - - //缁冪粌鎵嬄烽渶瑕佹柟娉曚竴锛氱敱娉ㄥ唽鐣岄潰鎻愪緵鍑芥暟璋冪敤锛屾柟娉曚簩锛氶�氳繃淇″彿鍙傛暟浼犻�掍俊鎭� - QString s1; - QString s2; - QString s3; - QString s4; - QString s5; - s1 = register_ui-> - s2 = - s3 = - s4 = - s5 = - qDebug()<<"鐢ㄦ埛鍚嶏細"<<s1; - qDebug()<<"瀵嗙爜锛�"<<s2; - qDebug()<<"纭瀵嗙爜锛�"<<s3; - qDebug()<<"閭鍦板潃锛�"<<s4; - qDebug()<<"鐢佃瘽鍙风爜锛�"<<s5; -} - -/* 鐐瑰嚮鎸夐挳路灏嗚緭鍏ョ殑鐧诲綍淇℃伅鎵撳寘 */ -void UserAuth_MainWindow::on_LoginButton_clicked() -{ - emit tar_login_signal(); -} diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userauth_mainwindow.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userauth_mainwindow.h" deleted file mode 100644 index dff6bec..0000000 --- "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userauth_mainwindow.h" +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef USERAUTH_MAINWINDOW_H -#define USERAUTH_MAINWINDOW_H - -#include <QMainWindow> - -namespace Ui { -class UserAuth_MainWindow; -} - -class UserAuth_MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit UserAuth_MainWindow(QWidget *parent = 0); - ~UserAuth_MainWindow(); - -private slots: - /* 鐐瑰嚮鎸夐挳路灞曞紑锛堣烦杞級娉ㄥ唽鐣岄潰 */ - void on_RegisterButton_clicked(); - - /* 鐐瑰嚮鎸夐挳路灏嗙櫥褰曚俊鎭墦鍖� */ - void on_LoginButton_clicked(); - - /* 灞曞紑锛堣烦杞級娉ㄥ唽鐣岄潰 */ - void goto_register_ui(); - - /* 灞曞紑锛堣烦杞級鐧诲綍鐣岄潰 */ - void goto_login_ui(); - - /* 灏嗙櫥褰曚俊鎭墦鍖� */ - void tar_login_getInfo(); - - /* 灏嗘敞鍐屼俊鎭墦鍖� */ - void tar_register_getInfo(); - -signals: - void open_registerUi_signal(); - void tar_login_signal(); - -private: - Ui::UserAuth_MainWindow *ui; - UserRegister_MainWindow *register_ui; -}; - -#endif // USERAUTH_MAINWINDOW_H diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userregister_mainwindow.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userregister_mainwindow.cpp" deleted file mode 100644 index 6289ea8..0000000 --- "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userregister_mainwindow.cpp" +++ /dev/null @@ -1,27 +0,0 @@ -#include "userregister_mainwindow.h" - -#include "ui_userregister_mainwindow.h" - -UserRegister_MainWindow::UserRegister_MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::UserRegister_MainWindow) -{ - ui->setupUi(this); -} - -UserRegister_MainWindow::~UserRegister_MainWindow() -{ - delete ui; -} - -/* 鐐瑰嚮鎸夐挳路鍙戦�佷俊鍙仿峰睍寮�鐧诲綍鐣岄潰 */ -void UserRegister_MainWindow::on_GoBackButton_clicked() -{ - emit open_loginUi_signal(); -} - -/* 鐐瑰嚮鎸夐挳路灏嗚緭鍏ョ殑娉ㄥ唽淇℃伅鎵撳寘 */ -void UserRegister_MainWindow::on_RegisterButton_clicked() -{ - emit tar_register_signal(); -} diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userregister_mainwindow.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userregister_mainwindow.h" deleted file mode 100644 index ebc1c12..0000000 --- "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userregister_mainwindow.h" +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef USERREGISTER_MAINWINDOW_H -#define USERREGISTER_MAINWINDOW_H - -#include <QMainWindow> - -namespace Ui { -class UserRegister_MainWindow; -} - -class UserRegister_MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit UserRegister_MainWindow(QWidget *parent = 0); - ~UserRegister_MainWindow(); - -private slots: - /* 鐐瑰嚮鎸夐挳路鍙戦�佷俊鍙仿峰睍寮�鐧诲綍鐣岄潰 */ - void on_GoBackButton_clicked(); - - /* 鐐瑰嚮鎸夐挳路灏嗚緭鍏ョ殑娉ㄥ唽淇℃伅鎵撳寘 */ - void on_RegisterButton_clicked(); - -signals: - void open_loginUi_signal(); - void tar_register_signal(); - -private: - Ui::UserRegister_MainWindow *ui; -}; - -#endif // USERREGISTER_MAINWINDOW_H diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userregister_mainwindow.ui" "b/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userregister_mainwindow.ui" deleted file mode 100644 index da66d70..0000000 --- "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userregister_mainwindow.ui" +++ /dev/null @@ -1,329 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ui version="4.0"> - <class>UserRegister_MainWindow</class> - <widget class="QMainWindow" name="UserRegister_MainWindow"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>790</width> - <height>650</height> - </rect> - </property> - <property name="minimumSize"> - <size> - <width>790</width> - <height>650</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>790</width> - <height>650</height> - </size> - </property> - <property name="windowTitle"> - <string>MainWindow</string> - </property> - <widget class="QWidget" name="centralwidget"> - <widget class="QLabel" name="HeadLabel"> - <property name="geometry"> - <rect> - <x>640</x> - <y>30</y> - <width>81</width> - <height>41</height> - </rect> - </property> - <property name="text"> - <string>鐢ㄦ埛娉ㄥ唽</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - <widget class="Line" name="line"> - <property name="geometry"> - <rect> - <x>40</x> - <y>70</y> - <width>711</width> - <height>20</height> - </rect> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - <widget class="QLineEdit" name="UserNameEdit"> - <property name="geometry"> - <rect> - <x>320</x> - <y>120</y> - <width>241</width> - <height>41</height> - </rect> - </property> - <property name="placeholderText"> - <string>璇疯緭鍏ョ敤鎴峰悕</string> - </property> - </widget> - <widget class="QLabel" name="UserName"> - <property name="geometry"> - <rect> - <x>200</x> - <y>130</y> - <width>72</width> - <height>15</height> - </rect> - </property> - <property name="text"> - <string>鐢ㄦ埛鍚�</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - <widget class="QLabel" name="Password"> - <property name="geometry"> - <rect> - <x>200</x> - <y>200</y> - <width>72</width> - <height>15</height> - </rect> - </property> - <property name="text"> - <string>瀵嗙爜</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - <widget class="QLineEdit" name="PasswordEdit"> - <property name="geometry"> - <rect> - <x>320</x> - <y>190</y> - <width>241</width> - <height>41</height> - </rect> - </property> - <property name="placeholderText"> - <string>璇疯緭鍏ュ瘑鐮�</string> - </property> - </widget> - <widget class="QLabel" name="Email"> - <property name="geometry"> - <rect> - <x>200</x> - <y>360</y> - <width>72</width> - <height>15</height> - </rect> - </property> - <property name="text"> - <string>閭鍦板潃</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - <widget class="QLineEdit" name="EmailEdit"> - <property name="geometry"> - <rect> - <x>320</x> - <y>350</y> - <width>241</width> - <height>41</height> - </rect> - </property> - <property name="placeholderText"> - <string>璇疯緭鍏ラ偖绠卞湴鍧�</string> - </property> - </widget> - <widget class="QLabel" name="Telephone"> - <property name="geometry"> - <rect> - <x>200</x> - <y>440</y> - <width>72</width> - <height>15</height> - </rect> - </property> - <property name="text"> - <string>鐢佃瘽鍙风爜</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - <widget class="QLineEdit" name="TelephoneEdit"> - <property name="geometry"> - <rect> - <x>320</x> - <y>430</y> - <width>241</width> - <height>41</height> - </rect> - </property> - <property name="placeholderText"> - <string>璇疯緭鍏ョ數璇濆彿鐮�</string> - </property> - </widget> - <widget class="QLabel" name="Password2"> - <property name="geometry"> - <rect> - <x>200</x> - <y>280</y> - <width>72</width> - <height>15</height> - </rect> - </property> - <property name="text"> - <string>纭瀵嗙爜</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> - <widget class="QLineEdit" name="PasswordEdit2"> - <property name="geometry"> - <rect> - <x>320</x> - <y>270</y> - <width>241</width> - <height>41</height> - </rect> - </property> - <property name="placeholderText"> - <string>璇峰啀娆¤緭鍏ュ瘑鐮�</string> - </property> - </widget> - <widget class="QLabel" name="error1"> - <property name="geometry"> - <rect> - <x>321</x> - <y>170</y> - <width>341</width> - <height>20</height> - </rect> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>[榛樿涓洪殣钘廬杈撳叆閿欒鏃讹紝鏄剧ず鐢ㄦ埛鍚嶅懡鍚嶉敊璇�</string> - </property> - </widget> - <widget class="QLabel" name="error2"> - <property name="geometry"> - <rect> - <x>320</x> - <y>240</y> - <width>341</width> - <height>20</height> - </rect> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>[榛樿涓洪殣钘廬杈撳叆閿欒鏃讹紝鏄剧ず瀵嗙爜鏍煎紡閿欒</string> - </property> - </widget> - <widget class="QLabel" name="error3"> - <property name="geometry"> - <rect> - <x>320</x> - <y>320</y> - <width>341</width> - <height>20</height> - </rect> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>[榛樿涓洪殣钘廬杈撳叆閿欒鏃讹紝鏄剧ず瀵嗙爜涓嶄竴鑷撮敊璇�</string> - </property> - </widget> - <widget class="QLabel" name="error4"> - <property name="geometry"> - <rect> - <x>320</x> - <y>400</y> - <width>341</width> - <height>20</height> - </rect> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>[榛樿涓洪殣钘廬杈撳叆閿欒鏃讹紝鏄剧ず閭鏍煎紡閿欒</string> - </property> - </widget> - <widget class="QLabel" name="error5"> - <property name="geometry"> - <rect> - <x>320</x> - <y>480</y> - <width>341</width> - <height>20</height> - </rect> - </property> - <property name="styleSheet"> - <string notr="true">color: rgb(255, 0, 0);</string> - </property> - <property name="text"> - <string>[榛樿涓洪殣钘廬杈撳叆閿欒鏃讹紝鏄剧ず鐢佃瘽鍙风爜鏍煎紡閿欒</string> - </property> - </widget> - <widget class="QPushButton" name="RegisterButton"> - <property name="geometry"> - <rect> - <x>330</x> - <y>550</y> - <width>131</width> - <height>41</height> - </rect> - </property> - <property name="text"> - <string>娉ㄥ唽</string> - </property> - </widget> - <widget class="Line" name="line_2"> - <property name="geometry"> - <rect> - <x>40</x> - <y>520</y> - <width>711</width> - <height>20</height> - </rect> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - <widget class="QPushButton" name="GoBackButton"> - <property name="geometry"> - <rect> - <x>10</x> - <y>10</y> - <width>60</width> - <height>55</height> - </rect> - </property> - <property name="styleSheet"> - <string notr="true">background-image: url(:/my_icon/icon_source/宸︾澶村浘鏍嘷1756307832.png);</string> - </property> - <property name="text"> - <string/> - </property> - </widget> - </widget> - </widget> - <resources/> - <connections/> -</ui> diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/FaceLink_AI_UserAuth.pro" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/FaceLink_client.pro" similarity index 69% rename from "Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/FaceLink_AI_UserAuth.pro" rename to "Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/FaceLink_client.pro" index 2fa513f..08ff4d8 100644 --- "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/FaceLink_AI_UserAuth.pro" +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/FaceLink_client.pro" @@ -1,14 +1,14 @@ #------------------------------------------------- # -# Project created by QtCreator 2025-08-27T20:35:23 +# Project created by QtCreator 2025-09-03T17:37:12 # #------------------------------------------------- -QT += core gui +QT += core gui network greaterThan(QT_MAJOR_VERSION, 4): QT += widgets -TARGET = FaceLink_AI_Registration_and_Login +TARGET = FaceLink_client TEMPLATE = app # The following define makes your compiler emit warnings if you use @@ -25,16 +25,22 @@ SOURCES += \ main.cpp \ - userauth_mainwindow.cpp \ - userregister_mainwindow.cpp + clientmainwindow.cpp \ + login.cpp \ + register.cpp \ + textvalidator.cpp HEADERS += \ - userauth_mainwindow.h \ - userregister_mainwindow.h + clientmainwindow.h \ + login.h \ + register.h \ + struct_data.h \ + textvalidator.h FORMS += \ - userauth_mainwindow.ui \ - userregister_mainwindow.ui + clientmainwindow.ui \ + login.ui \ + register.ui RESOURCES += \ - my_icon_source.qrc + icon_s.qrc diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/FaceLink_AI_UserAuth.pro.user" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/FaceLink_client.pro.user" similarity index 95% rename from "Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/FaceLink_AI_UserAuth.pro.user" rename to "Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/FaceLink_client.pro.user" index e07f615..cb79e28 100644 --- "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/FaceLink_AI_UserAuth.pro.user" +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/FaceLink_client.pro.user" @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE QtCreatorProject> -<!-- Written by QtCreator 4.5.0, 2025-08-29T17:39:45. --> +<!-- Written by QtCreator 4.5.0, 2025-09-09T13:05:04. --> <qtcreator> <data> <variable>EnvironmentId</variable> @@ -8,7 +8,7 @@ </data> <data> <variable>ProjectExplorer.Project.ActiveTarget</variable> - <value type="int">0</value> + <value type="int">2</value> </data> <data> <variable>ProjectExplorer.Project.EditorSettings</variable> @@ -66,7 +66,7 @@ <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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MinGW_32bit-Debug</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/Qt_project/build-FaceLink_client-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> @@ -120,7 +120,7 @@ <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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MinGW_32bit-Release</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/Qt_project/build-FaceLink_client-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> @@ -174,7 +174,7 @@ <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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MinGW_32bit-Profile</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/Qt_project/build-FaceLink_client-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> @@ -284,15 +284,15 @@ </valuelist> <value type="int" key="PE.EnvironmentAspect.Base">2</value> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">FaceLink_AI_UserAuth</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">FaceLink_client</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:F:/Qt_project/FaceLink_AI_UserAuth/FaceLink_AI_UserAuth.pro</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:F:/Qt_project/FaceLink_client/FaceLink_client.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">FaceLink_AI_UserAuth.pro</value> + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">FaceLink_client.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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MinGW_32bit-Debug</value> + <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">F:/Qt_project/build-FaceLink_client-Desktop_Qt_5_9_4_MSVC2015_64bit-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> @@ -313,7 +313,7 @@ <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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MSVC2015_32bit-Debug</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/Qt_project/build-FaceLink_client-Desktop_Qt_5_9_4_MSVC2015_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> @@ -367,7 +367,7 @@ <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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MSVC2015_32bit-Release</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/Qt_project/build-FaceLink_client-Desktop_Qt_5_9_4_MSVC2015_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> @@ -421,7 +421,7 @@ <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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MSVC2015_32bit-Profile</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/Qt_project/build-FaceLink_client-Desktop_Qt_5_9_4_MSVC2015_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> @@ -529,14 +529,17 @@ <value type="int">13</value> <value type="int">14</value> </valuelist> - <value type="int" key="PE.EnvironmentAspect.Base">-1</value> + <value type="int" key="PE.EnvironmentAspect.Base">2</value> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> - <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> - <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value> - <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">FaceLink_client</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:F:/Qt_project/FaceLink_client/FaceLink_client.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">FaceLink_client.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">F:/Qt_project/build-FaceLink_client-Desktop_Qt_5_9_4_MSVC2015_64bit-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> @@ -557,7 +560,7 @@ <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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MSVC2015_64bit-Debug</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/Qt_project/build-FaceLink_client-Desktop_Qt_5_9_4_MSVC2015_64bit-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> @@ -611,7 +614,7 @@ <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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MSVC2015_64bit-Release</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/Qt_project/build-FaceLink_client-Desktop_Qt_5_9_4_MSVC2015_64bit-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> @@ -665,7 +668,7 @@ <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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MSVC2015_64bit-Profile</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/Qt_project/build-FaceLink_client-Desktop_Qt_5_9_4_MSVC2015_64bit-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> @@ -773,14 +776,17 @@ <value type="int">13</value> <value type="int">14</value> </valuelist> - <value type="int" key="PE.EnvironmentAspect.Base">-1</value> + <value type="int" key="PE.EnvironmentAspect.Base">2</value> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> - <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> - <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value> - <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">FaceLink_client</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> - <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:F:/Qt_project/FaceLink_client/FaceLink_client.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">FaceLink_client.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">F:/Qt_project/build-FaceLink_client-Desktop_Qt_5_9_4_MSVC2015_64bit-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> @@ -801,7 +807,7 @@ <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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MSVC2017_64bit-Debug</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/Qt_project/build-FaceLink_client-Desktop_Qt_5_9_4_MSVC2017_64bit-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> @@ -855,7 +861,7 @@ <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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MSVC2017_64bit-Release</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/Qt_project/build-FaceLink_client-Desktop_Qt_5_9_4_MSVC2017_64bit-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> @@ -909,7 +915,7 @@ <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">F:/Qt_project/build-FaceLink_AI_Registration_and_Login-Desktop_Qt_5_9_4_MSVC2017_64bit-Profile</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">F:/Qt_project/build-FaceLink_client-Desktop_Qt_5_9_4_MSVC2017_64bit-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> diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/clientmainwindow.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/clientmainwindow.cpp" new file mode 100644 index 0000000..ae676ea --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/clientmainwindow.cpp" @@ -0,0 +1,201 @@ +锘�/* 鑷畾涔夊ご鏂囦欢 */ +#include "clientmainwindow.h" +#include "ui_clientmainwindow.h" + +/* 绯荤粺澶存枃閿� */ +#include <QMessageBox> + +/* 棰勫鐞嗘寚浠ぢ风紪璇戞寚绀� */ +#pragma execution_character_set("utf-8") + +/* 鏋勯�犲嚱鏁� */ +ClientMainWindow::ClientMainWindow(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::ClientMainWindow) +{ + ui->setupUi(this); + + /* 鍒濆鍖杝ocket缃戠粶杩炴帴 */ + m_client = new QTcpSocket(this); + m_client->connectToHost("127.0.0.1",16888); + if(m_client->waitForConnected()){ + + /* 杩炰笂涔嬪悗锛屽垵濮嬪寲鍏朵粬鐣岄潰锛屽苟涓旀樉绀虹櫥褰曠晫闈� */ + init_Ui();//鏈潵鐨勪綅缃� + + /* 缁熶竴瀹氫竴涓敹鍖呯殑妲� */ + connect(m_client,SIGNAL(readyRead()),this,SLOT(readSlot())); + } + else + { + qDebug()<<"socket connect fail ! "; + QMessageBox::critical(this,"缃戠粶閿欒","缃戠粶杩炴帴鏂紑锛�"); + + /* 濂界敤锛屽緢鏆村姏鐨勫叧闂紝浣嗘槸杩欓噷鐨勬儏鍐靛氨鏄渶瑕佸畠杩欐牱鐨� */ + exit(0); + } + + /* 娴嬭瘯鐨勪綅缃� */ + //init_Ui(); +} + +/* 鏋愭瀯鍑芥暟 */ +ClientMainWindow::~ClientMainWindow() +{ + delete ui; +} + +/* 杩涜鏈夊叧ui鐨勫垵濮嬪寲 */ +void ClientMainWindow::init_Ui() +{ + /* 鍦╱i璁捐鐣岄潰锛岄粯璁ゆ湁涓や釜椤甸潰锛屾垜浠妸浠栨竻闄� */ + ui->tabWidget->clear(); + + /* 椤甸潰鑿滃崟鐨勭偣鍑绘晥鏋� */ + connect(ui->action_logout,SIGNAL(triggered(bool)),this,SLOT(action_logoutSlot())); + connect(ui->action_exit,&QAction::triggered,this,[=]{close();});//閫�鍑� + + /* login鐣岄潰锛屾敞鎰忛噸杞芥瀯閫犲嚱鏁帮紝鎶婅繖涓猻ocket鍏变韩鍑哄幓 */ + m_loginUi = new Login(m_client,this); + m_loginUi->show(); + + /* 娣诲姞瀛愮晫闈㈢殑鍦版柟 */ +} + +/* 鍝嶅簲->鐧诲綍涓氬姟 */ +void ClientMainWindow::loginProcess(LoginRes *res) +{ + /* 杩欓噷杩涜锛岀櫥褰曚笟鍔$殑澶勭悊 */ + /* 閫氳繃鐢ㄦ埛鐨勬潈闄愶紝鏄剧ず涓嶅悓鐨勫洖搴旂粨鏋� */ + qDebug()<<"鐧诲綍鐢ㄦ埛鍚嶏細"<<QString::fromLocal8Bit(res->user_name);//res->user_name浼氫贡鐮� + qDebug()<<"鐢ㄦ埛ID锛�"<<res->emp_id; + qDebug()<<"鐘舵�侊細"<<res->status; + + /* 鍏堟鏌ユ湰娆℃彁浜ょ殑鐢ㄦ埛鐧诲綍淇℃伅鐨勮繑鍥炵姸鎬� */ + /* + 璐︽埛鐘舵�併��0澶辫触锛�1姝e父锛�2绂昏亴锛�3绂佺敤锛�4娉ㄩ攢銆� + */ + + if(res->status == 0){ + + /* 璐︽埛鎴栬�呭瘑鐮佽緭鍏ラ敊璇�,鍚戠櫥褰曠晫闈㈠彂閫佷俊鍙� */ + QString str = "璐︽埛鎴栬�呭瘑鐮佽緭鍏ラ敊璇�"; + emit login_callback_signal(str); + } + else if(res->status == 1){ + + /* 鍒囨崲鏃讹紝涓�瀹氳娓呯┖鏈晫闈㈢殑閿欒淇℃伅 */ + ui->label_info->setText(""); + /* 鍒囨崲鏃讹紝涔熻娓呯┖鏈晫闈㈢殑杈撳叆淇℃伅 */ + + /* 鐢ㄦ埛鐧诲綍鎴愬姛,鍚戠櫥褰曠晫闈㈠彂閫佷俊鍙� */ + QString str = "鐢ㄦ埛鐧诲綍鎴愬姛"; + emit login_callback_signal(str); + + /* 鏍规嵁鏉冮檺锛屽喅瀹氭樉绀哄摢浜涚晫闈� */ + if(res->per.admin == 1){//瓒呯骇鐢ㄦ埛 + m_loginUi->hide(); + this->show(); + } + else if(res->status == 2){//鏅�氱敤鎴仿峰叿浣撲釜鍒潈闄愮嫭绔嬫帶鍒� + + /* 鍏堝叧闂櫥褰曠晫闈� */ + m_loginUi->hide(); + + if(res->per.attend_manage == 1){ + // + } + if(res->per.device_manage == 1){ + //閱囧摜锛� + } + if(res->per.history == 1){ + // + } + if(res->per.image_input == 1){ + // + } + if(res->per.log_search == 1){ + // + } + if(res->per.map_change == 1){ + // + } + if(res->per.monitor_back == 1){ + // + } + if(res->per.notify_manage == 1){ + // + } + if(res->per.version_manage == 1){ + // + } + } + } + else if (res->status == 2) { + + /* 璇ョ敤鎴峰凡绂昏亴,鍚戠櫥褰曠晫闈㈠彂閫佷俊鍙� */ + QString str = "璇ョ敤鎴峰凡绂昏亴"; + emit login_callback_signal(str); + } + else if (res->status == 3) { + + /* 璇ヨ处鍙峰凡绂佺敤,鍚戠櫥褰曠晫闈㈠彂閫佷俊鍙� */ + QString str = "璇ヨ处鍙峰凡绂佺敤"; + emit login_callback_signal(str); + } + else if (res->status == 4) { + + /* 璇ヨ处鍙峰凡娉ㄩ攢,鍚戠櫥褰曠晫闈㈠彂閫佷俊鍙� */ + QString str = "璇ヨ处鍙峰凡娉ㄩ攢"; + emit login_callback_signal(str); + } +} + +/* 鍝嶅簲->娉ㄥ唽涓氬姟 */ +void ClientMainWindow::registerProcess(RegisterRes *res) +{ + if(res->emp_id == 0){//閫氳繃妫�鏌d锛屽垽鏂槸鍚︽垚鍔熸敞鍐� + /* 娉ㄥ唽澶辫触 */ + QString str = QString::fromLocal8Bit(res->res_info); + emit register_callback_signal(false,str,0); + }else { + /* 娉ㄥ唽鎴愬姛 */ + QString str = "娉ㄥ唽鎴愬姛"; + emit register_callback_signal(true,str,res->emp_id); + } +} + +/* 涓撻棬鏀跺寘鐨勬Ы */ +void ClientMainWindow::readSlot(){ + QByteArray buffer = m_client->readAll();//杩欎釜鍑芥暟锛屼細涓�娆℃�ц鍙栨墍鏈夋暟鎹紦瀛� + qDebug()<<"buffer size:"<<buffer.size()<<endl<<"buffer:"<<buffer; + + /* 寮哄埗杞崲瑙e寘 */ + Head *res = (Head *)buffer.data(); + qDebug()<<" bag type:"<<res->type<<"bag length:"<<res->len; + + /* 妫�鏌ユ湇鍔″櫒鍙戞潵鐨勫搷搴斿寘鐨勭被鍨� */ + if(res->type == LOGIN_RES){ + LoginRes *res = (LoginRes *)buffer.data(); + qDebug()<<"杩涘叆鐧诲綍浜嬪姟澶勭悊銆傘�傘��"; + loginProcess(res); + } + else if (res->type == REGISTER_RES) { + RegisterRes *res = (RegisterRes *)buffer.data(); + qDebug()<<"杩涘叆娉ㄥ唽浜嬪姟澶勭悊銆傘�傘��"; + registerProcess(res); + } + //else-if + +} + +/* 鑿滃崟鏍徛锋敞閿� */ +void ClientMainWindow::action_logoutSlot() +{ + this->hide(); + m_loginUi->show(); + + /* 鍒囨崲鏃讹紝涓�瀹氳娓呯┖鏈晫闈㈢殑閿欒淇℃伅 */ + ui->label_info->setText(""); + /* 鍒囨崲鏃讹紝涔熻娓呯┖鏈晫闈㈢殑杈撳叆淇℃伅 */ +} diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/clientmainwindow.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/clientmainwindow.h" new file mode 100644 index 0000000..b8d58e3 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/clientmainwindow.h" @@ -0,0 +1,45 @@ +锘�#ifndef CLIENTMAINWINDOW_H +#define CLIENTMAINWINDOW_H + +/* 鑷畾涔夊ご鏂囦欢 */ +#include "login.h" + +/* 绯荤粺澶存枃閿� */ +#include <QMainWindow> +#include <QTcpSocket> +#include <QDebug> + +namespace Ui { +class ClientMainWindow; +} + +class ClientMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit ClientMainWindow(QWidget *parent = 0); + ~ClientMainWindow(); + +signals: + /* 鏀跺寘鍙嶉淇″彿 */ + void login_callback_signal(QString); + void register_callback_signal(bool,QString,int); + +private slots: + void readSlot();//涓撻棬鏀跺寘妲� + void action_logoutSlot(); + +private: + /* 鍑芥暟 */ + void init_Ui(); + void loginProcess(LoginRes *res); + void registerProcess(RegisterRes *res); + + /* 鐣岄潰+宸ュ叿 */ + Ui::ClientMainWindow *ui; + Login *m_loginUi; + QTcpSocket *m_client;//瀹㈡埛绔痵ocket銆愬叡浜玸ocket銆� +}; + +#endif // CLIENTMAINWINDOW_H diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/clientmainwindow.ui" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/clientmainwindow.ui" new file mode 100644 index 0000000..729f7c3 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/clientmainwindow.ui" @@ -0,0 +1,113 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ClientMainWindow</class> + <widget class="QMainWindow" name="ClientMainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>752</width> + <height>576</height> + </rect> + </property> + <property name="windowTitle"> + <string>FaceLink V1.0.1</string> + </property> + <widget class="QWidget" name="centralWidget"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + </widget> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_info"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>50</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">background-color: rgb(255, 255, 0); +color: rgb(255, 85, 0);</string> + </property> + <property name="text"> + <string>娴嬭瘯</string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menuBar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>752</width> + <height>26</height> + </rect> + </property> + <widget class="QMenu" name="menu"> + <property name="title"> + <string>閫夐」</string> + </property> + <addaction name="action_logout"/> + <addaction name="action_exit"/> + </widget> + <widget class="QMenu" name="menu_2"> + <property name="title"> + <string>甯姪</string> + </property> + <addaction name="action_help"/> + <addaction name="action_connect"/> + </widget> + <addaction name="menu"/> + <addaction name="menu_2"/> + </widget> + <widget class="QToolBar" name="mainToolBar"> + <attribute name="toolBarArea"> + <enum>TopToolBarArea</enum> + </attribute> + <attribute name="toolBarBreak"> + <bool>false</bool> + </attribute> + </widget> + <widget class="QStatusBar" name="statusBar"/> + <action name="action_help"> + <property name="text"> + <string>甯姪鎵嬪唽</string> + </property> + </action> + <action name="action_connect"> + <property name="text"> + <string>鍏充簬</string> + </property> + </action> + <action name="action_logout"> + <property name="text"> + <string>娉ㄩ攢</string> + </property> + </action> + <action name="action_exit"> + <property name="text"> + <string>閫�鍑�</string> + </property> + </action> + </widget> + <layoutdefault spacing="6" margin="11"/> + <resources/> + <connections/> +</ui> diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/my_icon_source.qrc" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/icon_s.qrc" similarity index 72% rename from "Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/my_icon_source.qrc" rename to "Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/icon_s.qrc" index 11831ed..cb85ca2 100644 --- "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/my_icon_source.qrc" +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/icon_s.qrc" @@ -1,5 +1,5 @@ <RCC> - <qresource prefix="/my_icon"> + <qresource prefix="/icon"> <file>icon_source/宸︾澶村浘鏍嘷1756307832.png</file> </qresource> </RCC> diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/icon_source/\345\267\246\347\256\255\345\244\264\345\233\276\346\240\207_1756307832.png" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/icon_source/\345\267\246\347\256\255\345\244\264\345\233\276\346\240\207_1756307832.png" similarity index 100% rename from "Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/icon_source/\345\267\246\347\256\255\345\244\264\345\233\276\346\240\207_1756307832.png" rename to "Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/icon_source/\345\267\246\347\256\255\345\244\264\345\233\276\346\240\207_1756307832.png" Binary files differ diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/login.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/login.cpp" new file mode 100644 index 0000000..3fdca80 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/login.cpp" @@ -0,0 +1,146 @@ +锘�/* 鑷畾涔夊ご鏂囦欢 */ +#include "login.h" +#include "ui_login.h" +#include "textvalidator.h" + +/* 绯荤粺澶存枃閿� */ +#include <QMessageBox> + +/* 棰勫鐞嗘寚浠ぢ风紪璇戞寚绀� */ +#pragma execution_character_set("utf-8") + +/* 鏋勯�犲嚱鏁�1 */ +Login::Login(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::Login) +{ + ui->setupUi(this); +} + +/* 鏋勯�犲嚱鏁�2 */ +Login::Login(QTcpSocket *client, QWidget *parent) : + QMainWindow(parent), + ui(new Ui::Login) +{ + ui->setupUi(this); + + /* 鍒濆鍖栭敊璇俊鎭彁绀� */ + ui->Label_error->setText(""); + + /* 涓虹櫥褰曠獥鍙e畨瑁呬簨浠惰繃婊ゅ櫒 */ + this->installEventFilter(this); + + /* 璁剧疆瀵嗙爜妗嗙鐢ㄨ緭鍏ユ硶鍒囨崲锛屽彧鑳戒娇鐢ㄨ嫳鏂囪緭鍏ユ硶 */ + ui->PasswordEdit->setAttribute(Qt::WA_InputMethodEnabled, false); + + /* 鑾峰緱鍏憡socket */ + m_client = client; + + m_register = new Register(m_client,this); + + connect(m_register,SIGNAL(goto_login_signal()),this,SLOT(show_login_slot())); + + //杩欓噷鐨勨�減arent,SIGNAL(login_callback_signal(QString))鈥濓紝娌℃湁鎻愰啋锛屼絾鏄兘鐢ㄣ�怉I璇达紝杩欎釜鏂规硶澶棫銆� + connect(parent,SIGNAL(login_callback_signal(QString)),this,SLOT(login_callback_slot(QString))); +} + +/* 鏋愭瀯鍑芥暟 */ +Login::~Login() +{ + delete ui; +} + +/* 浜嬩欢杩囨护鍣� */ +bool Login::eventFilter(QObject *obj, QEvent *event) +{ + if(obj == this){//褰撹Е鍙戜簨浠舵潵鑷簬杩欎釜鐣岄潰 + if(event->type() == QEvent::KeyPress){//褰撲簨浠剁被鍨嬫槸鎸夊帇鎸夐敭 + QKeyEvent * keyEvent = (QKeyEvent *)event; + + /* 褰撴寜鍘嬩笅enter閿�愭湁涓や釜enter銆� */ + if((keyEvent->key() == Qt::Key_Return)||(keyEvent->key() == Qt::Key_Enter)){ + on_LoginButton_clicked(); + return true; + } + } + } + return QObject::eventFilter(obj, event); +} + +/* 妲铰风櫥褰�->娉ㄥ唽 */ +void Login::on_RegisterButton_clicked() +{ + this->hide(); + m_register->show(); + + /* 鍒囨崲鏃讹紝涓�瀹氳娓呯┖鏈晫闈㈢殑閿欒淇℃伅 */ + ui->Label_error->setText(""); + /* 鍒囨崲鏃讹紝涔熻娓呯┖鏈晫闈㈢殑杈撳叆淇℃伅 */ +} + +/* 妲铰锋敞鍐�->鐧诲綍 */ +void Login::show_login_slot() +{ + this->show(); + m_register->hide(); +} + +/* 妲铰风偣鍑荤櫥褰� */ +void Login::on_LoginButton_clicked() +{ + QString username = ui->UserNameEdit->text(); + QString password = ui->PasswordEdit->text(); + + /* 鐢ㄦ埛鍚嶈緭鍏ユ涓嶈兘涓虹┖ */ + if(username == ""){ + QString text = "鐢ㄦ埛鍚嶄笉鑳戒负绌猴紒"; + ui->Label_error->clear(); + ui->Label_error->setText(text); + return; + } + + /* 瀵嗙爜杈撳叆妗嗕笉鑳戒负绌� */ + if(password == ""){ + QString text = "瀵嗙爜涓嶈兘涓虹┖锛�"; + ui->Label_error->clear(); + ui->Label_error->setText(text); + return; + } + + /* 妫�鏌ョ敤鎴峰悕鏍煎紡銆愭眽瀛椼�佹暟瀛椼�佽嫳鏂囧瓧绗︺�佷笅鍒掔嚎-闀垮害锛�4~10锛夈�� */ + if( !(TextValidator::isValidUsername(username)) ){ + QString text = "鐢ㄦ埛鍚嶆牸寮忛敊璇� "; + ui->Label_error->clear(); + ui->Label_error->setText(text); + return; + } + + /* 妫�鏌ュ瘑鐮併�愯嫳鏂囧瓧绗︺�佹暟瀛椼�佷笅鍒掔嚎銆佺偣鈥�.鈥�-闀垮害锛�5~20锛夈�� */ + if( !(TextValidator::isValidPassword(password)) ){ + QString text = "瀵嗙爜鏍煎紡閿欒 "; + ui->Label_error->clear(); + ui->Label_error->setText(text); + return; + } + + /* 濡傛灉鍏ㄩ儴姝e父锛屾竻绌洪敊璇俊鎭� */ + ui->Label_error->setText(""); + + /* 鎻愬彇瀛楃涓插悗锛岀綉缁滄瀯寤鸿姹傜粨鏋勪綋 */ + struct LoginReq req; + strcpy(req.user_name,username.toLocal8Bit().data()); + strcpy(req.password,password.toLocal8Bit().data()); + + //鐧诲綍淇℃伅鐨勫唴瀹规鏌�+銆愬姞瀵嗐�戯紝鍙戠粰鏈嶅姟绔紝鎴戜滑鍐嶆敹鎶ャ�愯В瀵嗐�戞鏌ワ紝鍋氬嚭鐩稿簲鐨勫姩浣� + + /* 濡傛灉鏄甯歌繛鎺ワ紝绔嬪嵆鍙戦�佺櫥褰曡姹傚寘 */ + if(m_client){ + qDebug()<<"LoginReq len :"<<m_client->write((char *)&req,req.head.len); + } +} + +void Login::login_callback_slot(QString str) +{ + ui->Label_error->setText(str); + QMessageBox::information(this,"Server",str); +} diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/login.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/login.h" new file mode 100644 index 0000000..beb9962 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/login.h" @@ -0,0 +1,52 @@ +锘�#ifndef LOGIN_H +#define LOGIN_H + +/* 鑷畾涔夊ご鏂囦欢 */ +#include "register.h" +#include "struct_data.h" + +/* 绯荤粺澶存枃閿� */ +#include <QTcpSocket> +#include <QMainWindow> +#include <QDebug> +#include <QKeyEvent> + +namespace Ui { +class Login; +} + +class Login : public QMainWindow +{ + Q_OBJECT + +public: + explicit Login(QWidget *parent = 0); + explicit Login(QTcpSocket *client, QWidget *parent = 0); + ~Login(); + + bool eventFilter(QObject *obj, QEvent *event) override; + +signals: + +private slots: + /* 鐣岄潰鏄剧ず妲� */ + void show_login_slot(); + + /* 鎸夐挳瑙﹀彂妲� */ + void on_RegisterButton_clicked(); + void on_LoginButton_clicked(); + + /* 鏀跺寘鍙嶉妲� */ + void login_callback_slot(QString); + + +private: + /* 鐣岄潰 */ + Ui::Login *ui; + Register *m_register; + + /* 宸ュ叿 */ + QTcpSocket *m_client;//銆愬叡浜玸ocket銆� +}; + +#endif // LOGIN_H diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userauth_mainwindow.ui" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/login.ui" similarity index 69% rename from "Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userauth_mainwindow.ui" rename to "Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/login.ui" index 3128aba..82d9897 100644 --- "a/Client/\347\216\213\351\243\236\346\231\272/code/Qt\346\263\250\345\206\214\347\231\273\345\275\225\347\225\214\351\235\242\050\351\203\250\345\210\206\051/FaceLink_AI_UserAuth/userauth_mainwindow.ui" +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/login.ui" @@ -1,36 +1,36 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>UserAuth_MainWindow</class> - <widget class="QMainWindow" name="UserAuth_MainWindow"> + <class>Login</class> + <widget class="QMainWindow" name="Login"> <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>790</width> + <width>660</width> <height>650</height> </rect> </property> <property name="minimumSize"> <size> - <width>790</width> + <width>660</width> <height>650</height> </size> </property> <property name="maximumSize"> <size> - <width>790</width> + <width>660</width> <height>650</height> </size> </property> <property name="windowTitle"> - <string>UserAuth_MainWindow</string> + <string>MainWindow</string> </property> - <widget class="QWidget" name="centralWidget"> + <widget class="QWidget" name="centralwidget"> <widget class="QLabel" name="Headline"> <property name="geometry"> <rect> - <x>200</x> - <y>20</y> + <x>140</x> + <y>10</y> <width>371</width> <height>71</height> </rect> @@ -45,11 +45,27 @@ <set>Qt::AlignCenter</set> </property> </widget> + <widget class="QPushButton" name="ForgetButton"> + <property name="geometry"> + <rect> + <x>170</x> + <y>530</y> + <width>90</width> + <height>22</height> + </rect> + </property> + <property name="text"> + <string>蹇樿瀵嗙爜</string> + </property> + <property name="flat"> + <bool>true</bool> + </property> + </widget> <widget class="Line" name="line"> <property name="geometry"> <rect> - <x>30</x> - <y>100</y> + <x>-30</x> + <y>90</y> <width>721</width> <height>20</height> </rect> @@ -58,62 +74,11 @@ <enum>Qt::Horizontal</enum> </property> </widget> - <widget class="QLineEdit" name="UserNameEdit"> - <property name="geometry"> - <rect> - <x>290</x> - <y>140</y> - <width>291</width> - <height>80</height> - </rect> - </property> - <property name="cursorPosition"> - <number>0</number> - </property> - <property name="placeholderText"> - <string> 璇疯緭鍏ラ偖绠�/鐢佃瘽鍙风爜/鐢ㄦ埛鍚�</string> - </property> - <property name="clearButtonEnabled"> - <bool>false</bool> - </property> - </widget> - <widget class="QLineEdit" name="PasswordEdit"> - <property name="geometry"> - <rect> - <x>290</x> - <y>250</y> - <width>291</width> - <height>80</height> - </rect> - </property> - <property name="echoMode"> - <enum>QLineEdit::Password</enum> - </property> - <property name="placeholderText"> - <string> 璇疯緭鍏ュ瘑鐮�</string> - </property> - </widget> - <widget class="QLabel" name="UserName"> - <property name="geometry"> - <rect> - <x>180</x> - <y>170</y> - <width>72</width> - <height>15</height> - </rect> - </property> - <property name="text"> - <string>鐢ㄦ埛鍚�</string> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> - </property> - </widget> <widget class="QLabel" name="Password"> <property name="geometry"> <rect> - <x>180</x> - <y>280</y> + <x>120</x> + <y>270</y> <width>72</width> <height>15</height> </rect> @@ -125,37 +90,43 @@ <set>Qt::AlignCenter</set> </property> </widget> - <widget class="Line" name="line_2"> + <widget class="QPushButton" name="RegisterButton"> <property name="geometry"> <rect> - <x>30</x> - <y>380</y> - <width>721</width> - <height>20</height> - </rect> - </property> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - <widget class="QPushButton" name="LoginButton"> - <property name="geometry"> - <rect> - <x>170</x> - <y>440</y> - <width>441</width> - <height>81</height> + <x>400</x> + <y>530</y> + <width>90</width> + <height>22</height> </rect> </property> <property name="text"> - <string>绔嬪嵆鐧诲綍</string> + <string>娉ㄥ唽璐﹀彿</string> + </property> + <property name="flat"> + <bool>true</bool> + </property> + </widget> + <widget class="QLineEdit" name="PasswordEdit"> + <property name="geometry"> + <rect> + <x>230</x> + <y>240</y> + <width>291</width> + <height>80</height> + </rect> + </property> + <property name="echoMode"> + <enum>QLineEdit::Password</enum> + </property> + <property name="placeholderText"> + <string> 闀垮害5-20锛屾暟瀛椼�佽嫳鏂囥�佷笅鍒掔嚎銆佸皬鏁扮偣</string> </property> </widget> <widget class="QCheckBox" name="checkBox"> <property name="geometry"> <rect> - <x>350</x> - <y>350</y> + <x>420</x> + <y>340</y> <width>91</width> <height>19</height> </rect> @@ -164,37 +135,53 @@ <string>璁颁綇瀵嗙爜</string> </property> </widget> - <widget class="QPushButton" name="ForgetButton"> + <widget class="QPushButton" name="LoginButton"> <property name="geometry"> <rect> - <x>230</x> - <y>540</y> - <width>90</width> - <height>22</height> + <x>110</x> + <y>430</y> + <width>441</width> + <height>81</height> </rect> </property> <property name="text"> - <string>蹇樿瀵嗙爜</string> + <string>绔嬪嵆鐧诲綍</string> </property> </widget> - <widget class="QPushButton" name="RegisterButton"> + <widget class="Line" name="line_2"> <property name="geometry"> <rect> - <x>460</x> - <y>540</y> - <width>90</width> - <height>22</height> + <x>-30</x> + <y>370</y> + <width>721</width> + <height>20</height> + </rect> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + <widget class="QLabel" name="UserName"> + <property name="geometry"> + <rect> + <x>120</x> + <y>160</y> + <width>72</width> + <height>15</height> </rect> </property> <property name="text"> - <string>娉ㄥ唽璐﹀彿</string> + <string>鐢ㄦ埛鍚�</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> </property> </widget> - <widget class="QLabel" name="error"> + <widget class="QLabel" name="Label_error"> <property name="geometry"> <rect> - <x>200</x> - <y>410</y> + <x>140</x> + <y>400</y> <width>381</width> <height>20</height> </rect> @@ -203,15 +190,64 @@ <string notr="true">color: rgb(255, 0, 0);</string> </property> <property name="text"> - <string>[榛樿涓洪殣钘廬杈撳叆閿欒鏃讹紝鏄剧ず閿欒锛堢敤鎴峰悕/瀵嗙爜鍑洪敊锛�</string> + <string>娴嬭瘯</string> </property> <property name="alignment"> <set>Qt::AlignCenter</set> </property> </widget> + <widget class="QLineEdit" name="UserNameEdit"> + <property name="geometry"> + <rect> + <x>230</x> + <y>130</y> + <width>291</width> + <height>80</height> + </rect> + </property> + <property name="cursorPosition"> + <number>0</number> + </property> + <property name="placeholderText"> + <string> 闀垮害4-10锛屾眽瀛椼�佹暟瀛椼�佽嫳鏂囧拰涓嬪垝绾�</string> + </property> + <property name="clearButtonEnabled"> + <bool>false</bool> + </property> + </widget> + <zorder>PasswordEdit</zorder> + <zorder>Headline</zorder> + <zorder>ForgetButton</zorder> + <zorder>line</zorder> + <zorder>Password</zorder> + <zorder>RegisterButton</zorder> + <zorder>checkBox</zorder> + <zorder>LoginButton</zorder> + <zorder>line_2</zorder> + <zorder>UserName</zorder> + <zorder>Label_error</zorder> + <zorder>UserNameEdit</zorder> </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>660</width> + <height>26</height> + </rect> + </property> + </widget> + <widget class="QStatusBar" name="statusbar"/> </widget> - <layoutdefault spacing="6" margin="11"/> + <tabstops> + <tabstop>UserNameEdit</tabstop> + <tabstop>PasswordEdit</tabstop> + <tabstop>checkBox</tabstop> + <tabstop>LoginButton</tabstop> + <tabstop>ForgetButton</tabstop> + <tabstop>RegisterButton</tabstop> + </tabstops> <resources/> <connections/> </ui> diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/main.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/main.cpp" new file mode 100644 index 0000000..5d27223 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/main.cpp" @@ -0,0 +1,12 @@ +锘�#include "clientmainwindow.h" +#include <QApplication> + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + ClientMainWindow w; + //姝e紡鎯呭喌鍚庯紝瑕侀殣钘忎笅闈唬鐮侊紝鍥犱负杩欓噷閲囧彇浜嗕富鐣岄潰涓虹涓�鐣岄潰锛屽綋绋嬪簭鍚姩鏃讹紝绗竴涓樉绀� + //w.show(); + + return a.exec(); +} diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/register.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/register.cpp" new file mode 100644 index 0000000..4113c70 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/register.cpp" @@ -0,0 +1,229 @@ +锘�/* 鑷畾涔夊ご鏂囦欢 */ +#include "register.h" +#include "ui_register.h" +#include "textvalidator.h" + +/* 绯荤粺澶存枃閿� */ +#include <QMessageBox> + +/* 棰勫鐞嗘寚浠ぢ风紪璇戞寚绀� */ +#pragma execution_character_set("utf-8") + +/* 鏋勯�犲嚱鏁�1 */ +Register::Register(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::Register) +{ + ui->setupUi(this); +} + + +/* 鏋勯�犲嚱鏁�2 */ +Register::Register(QTcpSocket *clinet,QWidget *parent) : + QMainWindow(parent), + ui(new Ui::Register) +{ + ui->setupUi(this); + + /* 鍒濆鍖栭敊璇俊鎭� */ + ui->error1->setText(""); + ui->error2->setText(""); + ui->error3->setText(""); + ui->error4->setText(""); + ui->error5->setText(""); + + /* 涓烘敞鍐岀獥鍙e畨瑁呬簨浠惰繃婊ゅ櫒 */ + this->installEventFilter(this); + + /* 璁剧疆瀵嗙爜妗嗙鐢ㄨ緭鍏ユ硶鍒囨崲锛屽彧鑳戒娇鐢ㄨ嫳鏂囪緭鍏ユ硶 */ + ui->PasswordEdit->setAttribute(Qt::WA_InputMethodEnabled, false); + ui->PasswordEdit2->setAttribute(Qt::WA_InputMethodEnabled, false); + ui->EmailEdit->setAttribute(Qt::WA_InputMethodEnabled, false); + ui->TelephoneEdit->setAttribute(Qt::WA_InputMethodEnabled, false); + + //杩欓噷鐨勨�減arent,SIGNAL(login_callback_signal(QString))鈥濓紝娌℃湁鎻愰啋锛屼絾鏄兘鐢ㄣ�怉I璇达紝杩欎釜鏂规硶澶棫銆� + connect(parent->parent(),SIGNAL(register_callback_signal(bool,QString,int)),this,SLOT(register_callback_slot(bool,QString,int))); + + m_client = clinet; +} + +/* 鏋愭瀯鍑芥暟 */ +Register::~Register() +{ + delete ui; +} + +/* 浜嬩欢杩囨护鍣� */ +bool Register::eventFilter(QObject *obj, QEvent *event) +{ + if(obj == this){//褰撹Е鍙戜簨浠舵潵鑷簬杩欎釜鐣岄潰 + if(event->type() == QEvent::KeyPress){//褰撲簨浠剁被鍨嬫槸鎸夊帇鎸夐敭 + QKeyEvent * keyEvent = (QKeyEvent *)event; + + /* 褰撴寜鍘嬩笅enter閿�愭湁涓や釜enter銆� */ + if((keyEvent->key() == Qt::Key_Return)||(keyEvent->key() == Qt::Key_Enter)){ + on_RegisterButton_clicked(); + return true; + } + } + } + return QObject::eventFilter(obj, event); +} + + +/* 妲铰风偣鍑诲彂閫佷俊鍙仿锋敞鍐�->鐧诲綍 */ +void Register::on_GoBackButton_clicked() +{ + /* 鍒囨崲鏃讹紝涓�瀹氳娓呯┖鏈晫闈㈢殑閿欒淇℃伅 */ + ui->error1->setText(""); + ui->error2->setText(""); + ui->error3->setText(""); + ui->error4->setText(""); + ui->error5->setText(""); + /* 鍒囨崲鏃讹紝涔熻娓呯┖鏈晫闈㈢殑杈撳叆淇℃伅 */ + + emit goto_login_signal(); +} + +/* 妲铰风偣鍑绘敞鍐� */ +void Register::on_RegisterButton_clicked() +{ + + QString username = ui->UserNameEdit->text(); + QString password = ui->PasswordEdit->text(); + QString password2 = ui->PasswordEdit2->text();//绗簩娆¤緭鍏ョ殑瀵嗙爜 + QString email = ui->EmailEdit->text(); + QString telephone = ui->TelephoneEdit->text(); + QString department = ui->comboBox_department->currentText(); + + /* 杈撳叆妗嗕笉鑳戒负绌� */ + if( !(disableEmpty(username,password,password2,email,telephone)) ){ + return; + } + + /* 鏍煎紡妫�鏌� */ + /* 妫�鏌ョ敤鎴峰悕鏍煎紡銆愭眽瀛椼�佹暟瀛椼�佽嫳鏂囧瓧绗︺�佷笅鍒掔嚎-闀垮害锛�4~10锛夈�� */ + if( !(TextValidator::isValidUsername(username)) ){ + QString text = "鐢ㄦ埛鍚嶆牸寮忛敊璇� "; + ui->error1->clear(); + ui->error1->setText(text); + return; + } + + /* 妫�鏌ュ瘑鐮併�愯嫳鏂囧瓧绗︺�佹暟瀛椼�佷笅鍒掔嚎銆佺偣鈥�.鈥�-闀垮害锛�5~20锛夈�� */ + if( !(TextValidator::isValidPassword(password)) ){ + QString text = "瀵嗙爜鏍煎紡閿欒 "; + ui->error2->clear(); + ui->error2->setText(text); + return; + } + + /* 妫�鏌ラ偖绠卞湴鍧�銆惵仿仿枫�� */ + if( !(TextValidator::isValidEmail(email)) ){ + QString text = "閭鍦板潃鏍煎紡閿欒 "; + ui->error4->clear(); + ui->error4->setText(text); + return; + } + + /* 妫�鏌ョ數璇濆彿鐮併�惵仿仿枫�� */ + if( !(TextValidator::isValidTelephone(telephone)) ){ + QString text = "鐢佃瘽鍙风爜鏍煎紡閿欒 "; + ui->error5->clear(); + ui->error5->setText(text); + return; + } + + /* 瀵嗙爜浜屾涓�鑷存鏌� */ + if(password != password2) { + ui->error3->setText("閿欒锛氫袱娆″瘑鐮佽緭鍏ヤ笉涓�鑷达紒"); + return; + } + + /* 妫�楠屽悎鏍硷紝娓呯┖閿欒淇℃伅 */ + ui->error1->setText(""); + ui->error2->setText(""); + ui->error3->setText(""); + ui->error4->setText(""); + ui->error5->setText(""); + + /* 濉厖娉ㄥ唽璇锋眰鍖� */ + struct RegisterReq req; + strcpy(req.user_name,username.toLocal8Bit().data()); + strcpy(req.password,password.toLocal8Bit().data()); + strcpy(req.email,email.toLocal8Bit().data()); + strcpy(req.telephone,telephone.toLocal8Bit().data()); + strcpy(req.department,department.toLocal8Bit().data()); + + //娉ㄥ唽淇℃伅鐨勫唴瀹规鏌�+銆愬姞瀵嗐�戯紝鍙戠粰鏈嶅姟绔紝鎴戜滑鍐嶆敹鎶ャ�愯В瀵嗐�戞鏌ワ紝鍋氬嚭鐩稿簲鐨勫姩浣� + + /* 濡傛灉鏄甯歌繛鎺ワ紝绔嬪嵆鍙戦�佹敞鍐岃姹傚寘 */ + if(m_client){//濡傛灉杩炴帴姝e父锛岀珛鍗冲彂閫� + qDebug()<<"RegisterReq len :"<<m_client->write((char *)&req,req.head.len); + } + + //娴嬭瘯鐢ㄩ�� + qDebug()<<"鐢ㄦ埛鍚嶏細"<<username; + qDebug()<<"瀵嗙爜锛�"<<password; + qDebug()<<"閭锛�"<<email; + qDebug()<<"鐢佃瘽锛�"<<telephone; + qDebug()<<"閮ㄩ棬锛�"<<department; +} + +/* 娉ㄥ唽鍙嶉 */ +void Register::register_callback_slot(bool flag, QString str, int id) +{ + if(flag == false){//娉ㄥ唽澶辫触锛屽脊绐楁彁閱� + QMessageBox::critical(this,"Server",str); + return; + }else { + QString str = " 娉ㄥ唽鎴愬姛锛佸嵆灏嗚繑鍥炵櫥褰曠晫闈€�傘�傘��"; + str = "鐢ㄦ埛ID:" + QString::number(id) + str; + QMessageBox::information(this,"Server",str); + //璺宠浆鐣岄潰 + emit goto_login_signal(); + } +} + +/* 鎵归噺鍒ょ┖妫�鏌� */ +bool Register::disableEmpty(QString username,QString password,QString password2,QString email,QString telephone) +{ + /* 娓呯┖閿欒淇℃伅 */ + ui->error1->setText(""); + ui->error2->setText(""); + ui->error3->setText(""); + ui->error4->setText(""); + ui->error5->setText(""); + + if(username == ""){ + QString text = "鐢ㄦ埛鍚嶄笉鑳戒负绌猴紒"; + ui->error1->clear(); + ui->error1->setText(text); + return false; + } + if(password == ""){ + QString text = "瀵嗙爜涓嶈兘涓虹┖锛�"; + ui->error2->clear(); + ui->error2->setText(text); + return false; + } + if(password2 == ""){ + QString text = "纭瀵嗙爜涓嶈兘涓虹┖锛�"; + ui->error2->clear(); + ui->error2->setText(text); + return false; + } + if(email == ""){ + QString text = "閭鍦板潃涓嶈兘涓虹┖锛�"; + ui->error4->clear(); + ui->error4->setText(text); + return false; + } + if(telephone == ""){ + QString text = "鐢佃瘽鍙风爜涓嶈兘涓虹┖锛�"; + ui->error5->clear(); + ui->error5->setText(text); + return false; + } + return true; +} diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/register.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/register.h" new file mode 100644 index 0000000..006c254 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/register.h" @@ -0,0 +1,47 @@ +锘�#ifndef REGISTER_H +#define REGISTER_H + +/* 鑷畾涔夊ご鏂囦欢 */ +#include "struct_data.h" + +/* 绯荤粺澶存枃閿� */ +#include <QTcpSocket> +#include <QMainWindow> +#include <QKeyEvent> + +namespace Ui { +class Register; +} + +class Register : public QMainWindow +{ + Q_OBJECT + +public: + explicit Register(QTcpSocket *clinet, QWidget *parent = 0); + explicit Register(QWidget *parent = 0); + ~Register(); + + bool eventFilter(QObject *obj, QEvent *event) override; + +signals: + void goto_login_signal(); + +private slots: + /* 鎸夐挳鐐瑰嚮妲� */ + void on_GoBackButton_clicked(); + void on_RegisterButton_clicked(); + + /* 鏀跺寘鍙嶉妲� */ + void register_callback_slot(bool,QString,int); + +private: + /* 鍑芥暟 */ + bool disableEmpty(QString,QString,QString,QString,QString); + + /* 鐣岄潰+宸ュ叿 */ + Ui::Register *ui; + QTcpSocket *m_client;//姣忎竴涓晫闈㈤兘鏈変竴涓紝鍏变韩 +}; + +#endif // REGISTER_H diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/register.ui" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/register.ui" new file mode 100644 index 0000000..ac2450b --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/register.ui" @@ -0,0 +1,477 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Register</class> + <widget class="QMainWindow" name="Register"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>650</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>800</width> + <height>650</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>800</width> + <height>650</height> + </size> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget"> + <widget class="QPushButton" name="pushButton_captcha"> + <property name="geometry"> + <rect> + <x>549</x> + <y>480</y> + <width>61</width> + <height>50</height> + </rect> + </property> + <property name="text"> + <string>鎹竴鎹�</string> + </property> + <property name="flat"> + <bool>true</bool> + </property> + </widget> + <widget class="QLabel" name="Telephone_2"> + <property name="geometry"> + <rect> + <x>160</x> + <y>440</y> + <width>72</width> + <height>15</height> + </rect> + </property> + <property name="text"> + <string>閮ㄩ棬</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="QLabel" name="label_captcha_map"> + <property name="geometry"> + <rect> + <x>429</x> + <y>479</y> + <width>91</width> + <height>51</height> + </rect> + </property> + <property name="styleSheet"> + <string notr="true">background-color: rgb(170, 255, 255);</string> + </property> + <property name="text"> + <string>captcha_map</string> + </property> + </widget> + <widget class="QLabel" name="error3"> + <property name="geometry"> + <rect> + <x>319</x> + <y>260</y> + <width>341</width> + <height>20</height> + </rect> + </property> + <property name="styleSheet"> + <string notr="true">color: rgb(255, 0, 0);</string> + </property> + <property name="text"> + <string>[娴嬭瘯]</string> + </property> + </widget> + <widget class="QLabel" name="label"> + <property name="geometry"> + <rect> + <x>70</x> + <y>30</y> + <width>72</width> + <height>15</height> + </rect> + </property> + <property name="text"> + <string>鍙栨秷</string> + </property> + </widget> + <widget class="QLineEdit" name="EmailEdit"> + <property name="geometry"> + <rect> + <x>319</x> + <y>280</y> + <width>300</width> + <height>50</height> + </rect> + </property> + <property name="placeholderText"> + <string> 濡傦細user@example.com</string> + </property> + </widget> + <widget class="Line" name="line"> + <property name="geometry"> + <rect> + <x>39</x> + <y>50</y> + <width>711</width> + <height>20</height> + </rect> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + <widget class="QPushButton" name="RegisterButton"> + <property name="geometry"> + <rect> + <x>335</x> + <y>550</y> + <width>131</width> + <height>41</height> + </rect> + </property> + <property name="text"> + <string>娉ㄥ唽</string> + </property> + </widget> + <widget class="QLineEdit" name="lineEdit_captcha"> + <property name="geometry"> + <rect> + <x>189</x> + <y>480</y> + <width>201</width> + <height>50</height> + </rect> + </property> + <property name="placeholderText"> + <string> 璇疯緭鍏ラ獙璇佺爜</string> + </property> + </widget> + <widget class="QLabel" name="Email"> + <property name="geometry"> + <rect> + <x>160</x> + <y>300</y> + <width>72</width> + <height>15</height> + </rect> + </property> + <property name="text"> + <string>閭鍦板潃</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="QLineEdit" name="TelephoneEdit"> + <property name="geometry"> + <rect> + <x>319</x> + <y>350</y> + <width>300</width> + <height>50</height> + </rect> + </property> + <property name="placeholderText"> + <string> 璇疯緭鍏ョ數璇濆彿鐮�</string> + </property> + </widget> + <widget class="QPushButton" name="GoBackButton"> + <property name="geometry"> + <rect> + <x>5</x> + <y>5</y> + <width>60</width> + <height>55</height> + </rect> + </property> + <property name="styleSheet"> + <string notr="true">background-image: url(:/icon/icon_source/宸︾澶村浘鏍嘷1756307832.png);</string> + </property> + <property name="text"> + <string/> + </property> + </widget> + <widget class="QLabel" name="error5"> + <property name="geometry"> + <rect> + <x>319</x> + <y>400</y> + <width>341</width> + <height>20</height> + </rect> + </property> + <property name="styleSheet"> + <string notr="true">color: rgb(255, 0, 0);</string> + </property> + <property name="text"> + <string>[娴嬭瘯]</string> + </property> + </widget> + <widget class="QLabel" name="Password2"> + <property name="geometry"> + <rect> + <x>160</x> + <y>230</y> + <width>72</width> + <height>15</height> + </rect> + </property> + <property name="text"> + <string>纭瀵嗙爜</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="QLabel" name="error4"> + <property name="geometry"> + <rect> + <x>319</x> + <y>330</y> + <width>341</width> + <height>20</height> + </rect> + </property> + <property name="styleSheet"> + <string notr="true">color: rgb(255, 0, 0);</string> + </property> + <property name="text"> + <string>[娴嬭瘯]</string> + </property> + </widget> + <widget class="QLabel" name="HeadLabel"> + <property name="geometry"> + <rect> + <x>680</x> + <y>20</y> + <width>81</width> + <height>41</height> + </rect> + </property> + <property name="text"> + <string>鐢ㄦ埛娉ㄥ唽</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="QLabel" name="Password"> + <property name="geometry"> + <rect> + <x>160</x> + <y>160</y> + <width>72</width> + <height>15</height> + </rect> + </property> + <property name="text"> + <string>瀵嗙爜</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="QLabel" name="UserName"> + <property name="geometry"> + <rect> + <x>160</x> + <y>90</y> + <width>72</width> + <height>15</height> + </rect> + </property> + <property name="text"> + <string>鐢ㄦ埛鍚�</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="QLineEdit" name="UserNameEdit"> + <property name="geometry"> + <rect> + <x>319</x> + <y>70</y> + <width>300</width> + <height>50</height> + </rect> + </property> + <property name="placeholderText"> + <string> 闀垮害4-10锛屾眽瀛椼�佹暟瀛椼�佽嫳鏂囧拰涓嬪垝绾�</string> + </property> + </widget> + <widget class="QLabel" name="Telephone"> + <property name="geometry"> + <rect> + <x>160</x> + <y>370</y> + <width>72</width> + <height>15</height> + </rect> + </property> + <property name="text"> + <string>鐢佃瘽鍙风爜</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="QLineEdit" name="PasswordEdit"> + <property name="geometry"> + <rect> + <x>319</x> + <y>140</y> + <width>300</width> + <height>50</height> + </rect> + </property> + <property name="echoMode"> + <enum>QLineEdit::Password</enum> + </property> + <property name="placeholderText"> + <string> 闀垮害5-20锛屾暟瀛椼�佽嫳鏂囥�佷笅鍒掔嚎銆佸皬鏁扮偣</string> + </property> + </widget> + <widget class="Line" name="line_2"> + <property name="geometry"> + <rect> + <x>39</x> + <y>530</y> + <width>711</width> + <height>20</height> + </rect> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + <widget class="QComboBox" name="comboBox_department"> + <property name="geometry"> + <rect> + <x>319</x> + <y>420</y> + <width>300</width> + <height>50</height> + </rect> + </property> + <item> + <property name="text"> + <string>璐㈠姟閮�</string> + </property> + </item> + <item> + <property name="text"> + <string>杩愯惀閮�</string> + </property> + </item> + <item> + <property name="text"> + <string>鎶�鏈儴</string> + </property> + </item> + <item> + <property name="text"> + <string>浜у搧閮�</string> + </property> + </item> + <item> + <property name="text"> + <string>浜哄姏璧勬簮閮�</string> + </property> + </item> + <item> + <property name="text"> + <string>娉曞姟閮�</string> + </property> + </item> + <item> + <property name="text"> + <string>鏃�</string> + </property> + </item> + </widget> + <widget class="QLabel" name="error2"> + <property name="geometry"> + <rect> + <x>319</x> + <y>190</y> + <width>341</width> + <height>20</height> + </rect> + </property> + <property name="styleSheet"> + <string notr="true">color: rgb(255, 0, 0);</string> + </property> + <property name="text"> + <string>[娴嬭瘯]</string> + </property> + </widget> + <widget class="QLineEdit" name="PasswordEdit2"> + <property name="geometry"> + <rect> + <x>319</x> + <y>210</y> + <width>300</width> + <height>50</height> + </rect> + </property> + <property name="echoMode"> + <enum>QLineEdit::Password</enum> + </property> + <property name="placeholderText"> + <string> 璇峰啀娆¤緭鍏ュ瘑鐮佺‘璁�</string> + </property> + </widget> + <widget class="QLabel" name="error1"> + <property name="geometry"> + <rect> + <x>320</x> + <y>120</y> + <width>341</width> + <height>20</height> + </rect> + </property> + <property name="styleSheet"> + <string notr="true">color: rgb(255, 0, 0);</string> + </property> + <property name="text"> + <string>[娴嬭瘯]</string> + </property> + </widget> + </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>26</height> + </rect> + </property> + </widget> + <widget class="QStatusBar" name="statusbar"/> + </widget> + <tabstops> + <tabstop>UserNameEdit</tabstop> + <tabstop>PasswordEdit</tabstop> + <tabstop>PasswordEdit2</tabstop> + <tabstop>EmailEdit</tabstop> + <tabstop>TelephoneEdit</tabstop> + <tabstop>comboBox_department</tabstop> + <tabstop>lineEdit_captcha</tabstop> + <tabstop>pushButton_captcha</tabstop> + <tabstop>RegisterButton</tabstop> + <tabstop>GoBackButton</tabstop> + </tabstops> + <resources/> + <connections/> +</ui> diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/struct_data.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/struct_data.h" new file mode 100644 index 0000000..1d3efd8 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/struct_data.h" @@ -0,0 +1,117 @@ +锘�#ifndef STRUCT_DATA_H +#define STRUCT_DATA_H + +/* 浣跨敤鏋氫妇锛岃〃绀虹被鍨嬪拰鍔熻兘 */ +enum TypeInfo { + LOGIN_REQ, // 鐧诲綍璇锋眰 + LOGIN_RES, // 鐧诲綍鍝嶅簲 + + REGISTER_REQ,//娉ㄥ唽璇锋眰 + REGISTER_RES,//娉ㄥ唽鍝嶅簲 + + HEART_CHECK_REQ, // 蹇冭烦妫�娴嬭姹� + HEART_CHECK_RES, // 蹇冭烦妫�娴嬪搷搴� + + TEST, // 鏌旀�ф暟缁勭殑绫诲瀷 + TEST_NEXT, // 鎸囬拡涓嶅畾闀跨被鍨� +}; + +/* 鎶ユ枃澶� */ +struct Head{ + int type;//鍖哄垎绫诲瀷 + int len; //琛ㄧず灏佸寘闀垮害 +}; + +/* 鏉冮檺 */ +struct Permission +{ + int admin; // 绠$悊鍛樻潈闄� + int history; // 鍘嗗彶鏌ヨ + int log_search; // 鏃ュ織鏌ヨ鏉冮檺 + int map_change; // 鍦板浘淇敼 + int attend_manage; // 鑰冨嫟绠$悊 + int device_manage; // 璁惧绠$悊 + int version_manage; // 鐗堟湰绠$悊 + int notify_manage; // 閫氱煡绠$悊 + int image_input; // 鍥惧儚褰曞叆 + int monitor_back; // 鍚庡彴鐩戞帶 +}; + +/* 鐧诲綍璇锋眰 */ +struct LoginReq +{ + Head head; + char user_name[32]; + char password[32]; + + LoginReq(){ + head.type = LOGIN_REQ; + head.len = sizeof(LoginReq); + } +}; + +/* 鐧诲綍鍝嶅簲 */ +struct LoginRes +{ + Head head; + char user_name[32]; + int emp_id;//杩斿洖宸ュ彿 + int status; + Permission per;//鏉冮檺瀵硅薄 + + LoginRes() { + head.type = LOGIN_RES; + head.len = sizeof(LoginRes); + } +}; + +/* 娉ㄥ唽璇锋眰 */ +struct RegisterReq +{ + Head head; + char user_name[32]; + char password[32]; + char email[32]; + char telephone[32]; + char department[32]; + + RegisterReq(){ + head.type = REGISTER_REQ; + head.len = sizeof(RegisterReq); + } +}; + +/* 娉ㄥ唽鍝嶅簲 */ +struct RegisterRes +{ + Head head; + char user_name[32]; + int emp_id;//杩斿洖宸ュ彿 + int status; + Permission per;//鏉冮檺瀵硅薄 + char res_info[100]; + + RegisterRes() { + head.type = REGISTER_RES; + head.len = sizeof(RegisterRes); + } +}; + +/* + 缁忚繃鍗忓晢锛屽鎴风Qt鐣岄潰路鐢ㄦ埛淇℃伅鐨勭粨鏋勪綋 + + struct User { + QString username; //ok + QString password; //ok + QString email; //ok + QString phone; //ok + QString department; //ok + QString permission; //default銆愭敞鍐岄粯璁ゅ彧鏈夋渶鍩烘湰鐨勬潈闄愩�慬鍙互鎻愬墠鍐欏叆] + QString status; //default銆愭敞鍐岄粯璁ょ姸鎬�1銆慬鍙互鎻愬墠鍐欏叆] + QDate registerDate; //default銆愭敞鍐岄粯璁ゅ綋鍓嶆椂闂淬�慬鏄笉鏄簲璇ュ湪鏁版嵁搴撳啓鍏�?] + }; + + 涓汉鐞嗚В锛氭妸杩欎釜缁撴瀯浣撳皝瑁呭埌娉ㄥ唽璇锋眰鍖呬腑 +*/ + +#endif // STRUCT_DATA_H diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/textvalidator.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/textvalidator.cpp" new file mode 100644 index 0000000..84b2bae --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/textvalidator.cpp" @@ -0,0 +1,121 @@ +锘�/* 鑷畾涔夊ご鏂囦欢 */ +#include "textvalidator.h" + +/* 绯荤粺澶存枃閿� */ +#include <QDebug> + +/* 棰勫鐞嗘寚浠ぢ风紪璇戞寚绀� */ +#pragma execution_character_set("utf-8") + + +/* 鏋勯�犲嚱鏁� */ +TextValidator::TextValidator() +{ + +} + +/* 鏋愭瀯鍑芥暟 */ +TextValidator::~TextValidator() +{ + +} + +/* 鐢ㄦ埛鍚嶆牸寮忔鏌� */ +bool TextValidator::isValidUsername(const QString username) +{ + /* 闀垮害妫�鏌� */ + if((username.length() < 4) || (username.length() > 10)){ + //qDebug()<<"鐢ㄦ埛鍚嶉暱搴﹁繚瑙勩�傘��"; + return false; + } + + /* 鍐呭妫�鏌� */ + QRegularExpression regex("^[a-zA-Z0-9_\\x{4e00}-\\x{9fa5}]+$");//PCRE锛圥erl鍏煎姝e垯琛ㄨ揪寮忥級 + if (!regex.isValid()) { + qDebug() << "姝e垯琛ㄨ揪寮忔棤鏁堛�愭牸寮忛敊璇紝涓嶅彲鐢ㄣ��:" << regex.errorString(); + } + QRegularExpressionMatch match = regex.match(username); + + if(match.hasMatch()){//鍖归厤杩斿洖true锛屽け璐ヨ繑鍥瀎alse + //qDebug()<<"鍖归厤鎴愬姛"; + return true; + }else { + //qDebug()<<"鍖归厤澶辫触"; + return false; + } +} + +/* 瀵嗙爜鏍煎紡妫�鏌� */ +bool TextValidator::isValidPassword(const QString password) +{ + /* 闀垮害妫�鏌� */ + if((password.length() < 5) || (password.length() > 20)){ + //qDebug()<<"瀵嗙爜闀垮害杩濊銆傘��"; + return false; + } + + /* 鍐呭妫�鏌� */ + QRegularExpression regex("^[a-zA-Z0-9_.]+$");//PCRE锛圥erl鍏煎姝e垯琛ㄨ揪寮忥級 + if (!regex.isValid()) { + qDebug() << "姝e垯琛ㄨ揪寮忔棤鏁�:" << regex.errorString(); + } + QRegularExpressionMatch match = regex.match(password); + + if(match.hasMatch()){//鍖归厤杩斿洖true锛屽け璐ヨ繑鍥瀎alse + //qDebug()<<"鍖归厤鎴愬姛"; + return true; + }else { + //qDebug()<<"鍖归厤澶辫触"; + return false; + } +} + +/* 閭鍦板潃鏍煎紡妫�鏌� */ +bool TextValidator::isValidEmail(const QString email) +{ + /* 闀垮害妫�鏌� */ + if (email.length() > 254 || email.length() < 6) { + //qDebug()<<"閭闀垮害杩濊銆傘��"; + return false; + } + + /* 鍐呭妫�鏌� */ + QRegularExpression regex(R"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,}$)");//PCRE锛圥erl鍏煎姝e垯琛ㄨ揪寮忥級 + if (!regex.isValid()) { + qDebug() << "姝e垯琛ㄨ揪寮忔棤鏁�:" << regex.errorString(); + } + QRegularExpressionMatch match = regex.match(email); + + if(match.hasMatch()){//鍖归厤杩斿洖true锛屽け璐ヨ繑鍥瀎alse + //qDebug()<<"鍖归厤鎴愬姛"; + return true; + }else { + //qDebug()<<"鍖归厤澶辫触"; + return false; + } +} + +/* 鐢佃瘽鍙风爜鏍煎紡妫�鏌� */ +bool TextValidator::isValidTelephone(const QString telephone) +{ + /* 闀垮害妫�鏌� */ + if (telephone.length() != 11) { + //qDebug()<<"鐢佃瘽鍙风爜闀垮害杩濊銆傘��"; + return false; + } + + /* 鍐呭妫�鏌� */ + QRegularExpression regex(R"(^1[3-9]\d{9}$)");//PCRE锛圥erl鍏煎姝e垯琛ㄨ揪寮忥級 + if (!regex.isValid()) { + qDebug() << "姝e垯琛ㄨ揪寮忔棤鏁�:" << regex.errorString(); + } + QRegularExpressionMatch match = regex.match(telephone); + + if(match.hasMatch()){//鍖归厤杩斿洖true锛屽け璐ヨ繑鍥瀎alse + //qDebug()<<"鍖归厤鎴愬姛"; + return true; + }else { + //qDebug()<<"鍖归厤澶辫触"; + return false; + } +} diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/textvalidator.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/textvalidator.h" new file mode 100644 index 0000000..950afd4 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\345\256\242\346\210\267\347\253\257\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/FaceLink_client/textvalidator.h" @@ -0,0 +1,28 @@ +锘�/* 宸ュ叿绫� */ +//鎻愪緵鍚勭妫�娴嬭緭鍏ユ垨鑰呰緭鍑虹殑鏈夋晥鎬х殑鍑芥暟 + +#ifndef TEXTVALIDATOR_H +#define TEXTVALIDATOR_H + +/* 鑷畾涔夊ご鏂囦欢 */ + +/* 绯荤粺澶存枃閿� */ +#include <QString> +#include <QRegularExpression> +#include <QRegularExpressionMatch> + +class TextValidator +{ +public: + TextValidator(); + ~TextValidator(); + + /* 杈呭姪鍑芥暟 */ + static bool isValidUsername(const QString username); + static bool isValidPassword(const QString password); + static bool isValidEmail(const QString email); + static bool isValidTelephone(const QString telephone); + +}; + +#endif // TEXTVALIDATOR_H diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/MySQLDB.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/MySQLDB.cpp" new file mode 100644 index 0000000..707e926 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/MySQLDB.cpp" @@ -0,0 +1,148 @@ +#include "stdafx.h" +#include "MySQLDB.h" + + +MySQLDB::MySQLDB() +{ + //正式开始构造 + if (init_mysql()) + { + if (connect_mysql()) + { + //连接成功 + cout << "mysql connect success..." << endl; + } + else + { + //连接失败 + cout << "mysql connect fail !" << endl; + } + } + else + { + //初始化失败 + cout << "mysql init fail !" << endl; + } +} + + +MySQLDB::~MySQLDB() +{ + mysql_close(my_mysql);//关闭 +} + +/* 数据库查询 */ +size_t MySQLDB::execSQL(const string & sql, vector<vector<string>>& result) +{ + //根据字符串sql,发给数据库 + //得到结果集 + //解析结果集,提取数据到result中 + //返回得到的结果集的数据行数 + + if (mysql_real_query(my_mysql, sql.c_str(),(unsigned long)sql.length())) { + //返回值为非0,代表失败 + cout << "execSQL fail !" << mysql_error(my_mysql) << endl; + return -1; + } + + //SQL语句发送成功 + + //取得结果集【注意,用完后,需要释放】 + MYSQL_RES * res = mysql_store_result(my_mysql); + + //再得到结果集的列数,方便确定一个vector中的string型数据的个数 + unsigned int res_colomn_count = mysql_num_fields(res); + + //得到结果集的行数 + MYSQL_ROW row; + + //循环读出结果集的各个行,列的数据 + while ( (row = mysql_fetch_row(res)) ) + //判断中的这个语句的效果是自动的,在每次循环后,再次来到这里,返回的结果是不一样的 + //每一次,都会返回 存储着这一行的所有列的数据的"数据结合体"指针,格式就像字符串数组一样(char **)== MYSQL_ROW + //直到,走到最后一行后,没有新的行时,返回NULL,while就会结束 + { + vector<string> one_line; + for (unsigned int i = 0;i < res_colomn_count;i++) + { + one_line.push_back(row[i]); + } + result.push_back(one_line); + } + + //释放结果集 + mysql_free_result(res); + + //返回结果集的行数 + return result.size(); +} + +/* 数据库插入 */ +uint64_t MySQLDB::exec_insSQL(const string & sql, char *info) +{ + //关键函数 + if (mysql_real_query(my_mysql, sql.c_str(), (unsigned long)sql.length())) { + //返回值为非0,代表失败,记录错误信息 + strcpy_s(info,100, mysql_error(my_mysql)); + cout << "execSQL fail !" << info << endl; + return 0; + } + + //成功返回正常id,失败返回0 + strcpy_s(info, 100, ""); + return mysql_insert_id(my_mysql); +} + +/* 初始化 */ +bool MySQLDB::init_mysql() +{ + my_mysql = mysql_init(nullptr);//指针:初始化,返回的是MYSQL指针类型 + if (my_mysql != nullptr) + { + return true; + } + return false; +} + +/* 连接 */ +bool MySQLDB::connect_mysql() +{ + //连接MYSQL + MYSQL * conn = mysql_real_connect( + my_mysql, //mysql_init得到的句柄 + "127.0.0.1", //登陆的mysql的IP地址 + "root", //登录使用的用户名 + "066733", //登录使用的用户密码 + "face_link_ai", //数据库的名称 + 3306, //端口号 + nullptr, //**我们使用默认 + 0 //**我们使用默认 + ); + if (conn) + { + //连接上了 + //设置数据库传输过来的字符编码采用GBK + + string sql = "set names gbk";//MYSQL的命令:设置MySQL连接的字符集为GBK编码 + + /* + 这条命令告诉MySQL服务器: + + 客户端发送的SQL语句使用GBK编码 + + 希望服务器返回的结果也使用GBK编码 + + 服务器和客户端之间的通信使用GBK编码 + + */ + + if (mysql_real_query(my_mysql,sql.c_str(),(unsigned long)sql.length())) + { + //成功返回0,if块语句不执行,失败才执行 + cout << "set names gbk --- error : " << mysql_error(my_mysql) << endl; + return false; + } + return true; + } + return false; +} diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/MySQLDB.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/MySQLDB.h" new file mode 100644 index 0000000..330f9ca --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/MySQLDB.h" @@ -0,0 +1,30 @@ +#pragma once +#include <iostream> +#include <WinSock2.h> +#include <string> +#include <vector> + +#include "mysql/include/mysql.h" + +#pragma comment(lib,"./mysql/lib/libmysql.lib") + +using namespace std; + + +class MySQLDB +{ +public: + MySQLDB(); + virtual ~MySQLDB(); + +//提供一些外部的接口 + size_t execSQL(const string &sql, vector<vector<string>> &result);//功能:查找数据库 + uint64_t exec_insSQL(const string &sql, char *info);//测试功能。插入记录行 + +private: + bool init_mysql(); //初始化mysql + bool connect_mysql(); //和数据库建立连接 + + MYSQL *my_mysql; +}; + diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/ReadMe.txt" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/ReadMe.txt" new file mode 100644 index 0000000..4cd3c7d --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/ReadMe.txt" @@ -0,0 +1,30 @@ +锘�======================================================================== + 鎺у埗鍙板簲鐢ㄧ▼搴忥細imitator_FaceLinkServer 椤圭洰姒傝堪 +======================================================================== + +搴旂敤绋嬪簭鍚戝宸蹭负鎮ㄥ垱寤轰簡姝� imitator_FaceLinkServer 搴旂敤绋嬪簭銆� + +鏈枃浠舵瑕佷粙缁嶇粍鎴� imitator_FaceLinkServer 搴旂敤绋嬪簭鐨勬瘡涓枃浠剁殑鍐呭銆� + + +imitator_FaceLinkServer.vcxproj + 杩欐槸浣跨敤搴旂敤绋嬪簭鍚戝鐢熸垚鐨� VC++ 椤圭洰鐨勪富椤圭洰鏂囦欢锛屽叾涓寘鍚敓鎴愯鏂囦欢鐨� Visual C++ 鐨勭増鏈俊鎭紝浠ュ強鏈夊叧浣跨敤搴旂敤绋嬪簭鍚戝閫夋嫨鐨勫钩鍙般�侀厤缃拰椤圭洰鍔熻兘鐨勪俊鎭�� + +imitator_FaceLinkServer.vcxproj.filters + 杩欐槸浣跨敤鈥滃簲鐢ㄧ▼搴忓悜瀵尖�濈敓鎴愮殑 VC++ 椤圭洰绛涢�夊櫒鏂囦欢銆傚畠鍖呭惈鏈夊叧椤圭洰鏂囦欢涓庣瓫閫夊櫒涔嬮棿鐨勫叧鑱斾俊鎭�傚湪 IDE 涓紝閫氳繃杩欑鍏宠仈锛屽湪鐗瑰畾鑺傜偣涓嬩互鍒嗙粍褰㈠紡鏄剧ず鍏锋湁鐩镐技鎵╁睍鍚嶇殑鏂囦欢銆備緥濡傦紝鈥�.cpp鈥濇枃浠朵笌鈥滄簮鏂囦欢鈥濈瓫閫夊櫒鍏宠仈銆� + +imitator_FaceLinkServer.cpp + 杩欐槸涓诲簲鐢ㄧ▼搴忔簮鏂囦欢銆� + +///////////////////////////////////////////////////////////////////////////// +鍏朵粬鏍囧噯鏂囦欢: + +StdAfx.h, StdAfx.cpp + 杩欎簺鏂囦欢鐢ㄤ簬鐢熸垚鍚嶄负 imitator_FaceLinkServer.pch 鐨勯缂栬瘧澶� (PCH) 鏂囦欢鍜屽悕涓� StdAfx.obj 鐨勯缂栬瘧绫诲瀷鏂囦欢銆� + +///////////////////////////////////////////////////////////////////////////// +鍏朵粬娉ㄩ噴: + +搴旂敤绋嬪簭鍚戝浣跨敤鈥淭ODO:鈥濇敞閲婃潵鎸囩ず搴旀坊鍔犳垨鑷畾涔夌殑婧愪唬鐮侀儴鍒嗐�� + +///////////////////////////////////////////////////////////////////////////// diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/Respond.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/Respond.cpp" new file mode 100644 index 0000000..9520f61 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/Respond.cpp" @@ -0,0 +1,165 @@ +#include "stdafx.h" +#include "Respond.h" +#include "MySQLDB.h" + +#include <iostream> +#include <time.h> + +using namespace std; + +Respond::Respond() +{ +} + + +Respond::~Respond() +{ +} + +//辅助函数 +bool Respond::business_login(LoginReq * req, SOCKET client) +{ + cout << "登录请求业务的处理..." << endl; + // 登录响应 + + // 前置的处理:先验证一下数据的准确性,验证通过,再往下一步 + + // 第一步:先把请求的数据拿出来,组装一下SQL语句【标准格式】 + char sql[512] = { 0 }; + + //将格式化数据写入一个字符串缓冲区 + sprintf_s(sql, "select id,user_name,status,admin,history,log_search,map_change,attend_manage,device_manage,version_manage,notify_manage,image_input,monitor_back from user_info a,role_info b where a.user_name ='%s' and a.password = '%s' and a.role_id = b.id;", req->user_name,req->password); + + //实例化一个对象 + MySQLDB my_DB; + + //返回结果的“数据结合体” + vector<vector<string>> result; + size_t rows = my_DB.execSQL(sql, result); + cout << "rows:" << rows << endl; + //一个登录响应结构体,根据result,填充结构体,发送 + LoginRes res; + + //初值 + res.per = { 0 }; + + + if (rows > 0)//代表有数据集 + { + //取得用户ID + res.emp_id = stoi(result[0][0]); + strcpy_s(res.user_name, result[0][1].c_str()); + //将result数组中第0行第2列位置的字符串内容转换为整数 + res.status = stoi(result[0][2]); + //权限赋值 + res.per.admin = stoi(result[0][3]); + res.per.admin = stoi(result[0][4]); + res.per.log_search = stoi(result[0][5]); + res.per.map_change = stoi(result[0][6]); + res.per.attend_manage = stoi(result[0][7]); + res.per.device_manage = stoi(result[0][8]); + res.per.version_manage = stoi(result[0][9]); + res.per.notify_manage = stoi(result[0][10]); + res.per.image_input = stoi(result[0][11]); + res.per.monitor_back = stoi(result[0][12]); + } + else + { + //没有数据集 + strcpy_s(res.user_name, ""); + + res.status = 0; + res.emp_id = 0; + } + + int send_len = 0; + //发送登录响应包 + send_len = send(client, (char *)&res, res.head.len, 0); + + cout << "send len :" << send_len << endl; + cout << "发送登录响应包,登录业务处理完成!" << endl; + +//test + cout << "user_status :" << res.status << endl; + cout << "some part user_power :" << res.per.admin << res.per.admin << res.per.image_input << endl; + + return false; +} + +bool Respond::business_register(RegisterReq * req, SOCKET client) +{ + //先用一个char数组,把访问数据库的语句准备好 + char sql[512] = { 0 }; + + /* + 经过协商,客户端Qt界面·用户信息的结构体 + + struct User { + QString username; //ok + QString password; //ok + QString email; //ok + QString phone; //ok + QString department; //ok + QString permission; //default【注册默认只有最基本的权限】 + QString status; //default【注册默认状态1】 + QDate registerDate; //default【注册默认当前时间】 + }; + */ + + // 获取当前时间并格式化为字符串 + char current_time[20]; + time_t now = time(NULL); + struct tm tm_info; // 改为栈变量而不是指针 + + // 使用安全的 localtime_s 替代 localtime + errno_t err = localtime_s(&tm_info, &now); + if (err == 0) { + strftime(current_time, sizeof(current_time), "%Y-%m-%d %H:%M:%S", &tm_info); + } + else { + // 错误处理 + strcpy_s(current_time, sizeof(current_time), "1970-01-01 00:00:00"); + } + cout << "当前操作时间:" << current_time; + + //格式化输入到字符串【难点,写入数据库的流程】 + sprintf_s(sql, "INSERT INTO user_info (user_name, password, tel, email, department, status, register_time, role_id) VALUES('%s', '%s', '%s', '%s', '%s', 1, '%s', 2);", req->user_name, req->password, req->telephone, req->email, req->department,current_time); + + //实例化一个对象 + MySQLDB my_DB; + + //发送注册响应包 + RegisterRes res; + + //数据库封装的插入函数 + uint64_t user_id = 0; + user_id = my_DB.exec_insSQL(sql, res.res_info); + + //填充响应结构体 + strcpy_s(res.user_name, req->user_name); + res.per = { 0 }; + res.emp_id = user_id;//可以通过检查id,判断是否成功注册 + res.status = 1; + + + /* + 需要加密 + */ + + + int send_len = 0; + //发送注册响应包 + send_len = send(client, (char *)&res, res.head.len, 0); + + cout << "send len :" << send_len << endl; + cout << "发送注册响应包,注册业务处理完成!" << endl; + + //test + cout << "user_status :" << res.status << endl; + cout << "some part user_power :" << res.per.admin << res.per.admin << res.per.image_input << endl; + cout << "user_info :" << res.status << endl; + cout << "用户名:" << res.user_name << " 工号:" << res.emp_id << " 状态:" << res.status << endl; + cout << "错误信息:[" << res.res_info << "/]" << endl; + + return false; +} diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/Respond.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/Respond.h" new file mode 100644 index 0000000..c41f06f --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/Respond.h" @@ -0,0 +1,16 @@ +#pragma once +#include <iostream> +#include <WinSock2.h> + +#include "struct_data.h" + +class Respond +{ +public: + Respond(); + virtual ~Respond(); + bool business_login(LoginReq *req,SOCKET client); + bool business_register(RegisterReq *req, SOCKET client); +}; + +//轻量级的、具有单一职责的工具类 \ No newline at end of file diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/ServerSocket.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/ServerSocket.cpp" new file mode 100644 index 0000000..996d0b3 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/ServerSocket.cpp" @@ -0,0 +1,184 @@ +#include "stdafx.h" +#include "ServerSocket.h" +#include "Respond.h" + +#include <mutex> + +//全局互斥锁 +mutex g_mtx;//你创建了一个互斥锁对象 + +ServerSocket::ServerSocket() +{ + //这里初始化服务器socket + if (init_socket()) + { + cout << "init server socket ok..." << endl; + } + else + { + cout << "init false !" << endl; + } +} + + +ServerSocket::~ServerSocket() +{ + WSACleanup(); // 关闭网络环境 +} + +bool ServerSocket::init_socket() +{ + WSAData wsa = { 0 }; + + //启动网络环境 + WSAStartup(MAKEWORD(2,2), &wsa); + + m_socket = socket(AF_INET, SOCK_STREAM, 0); + + SOCKADDR_IN addr; + addr.sin_family = AF_INET; + addr.sin_port = htons(16888); + addr.sin_addr.S_un.S_addr = 0; // 本机的任意ip + + //连接 + int ret_bind = ::bind(m_socket, (sockaddr*)&addr, sizeof(addr)); + if (ret_bind) { + cout << "bind fail:" << WSAGetLastError() << endl; + return false; + } + + //监听 + int ret_listen = listen(m_socket, 5); // 若并发量大 给个大点的值如 50,500等 + if (ret_listen) { + cout << "listen fail:" << WSAGetLastError() << endl; + return false; + } + + //初始化完成 + //使用线程接收客户端连接请求 + thread accept_thread(&ServerSocket::acceptThread,this); + accept_thread.detach(); // 分离线程,防止异常结束 + + return true; +} + +void ServerSocket::acceptThread() +{ + while (true) + { + SOCKET client; + SOCKADDR_IN addr; + int len = sizeof(addr); + + //接收连接 + cout << "waiting for client connect..." << endl; + client = accept(m_socket, (SOCKADDR *)&addr, &len); + cout << "client :" << client <<"success connected."<< endl; + + //检查一下,client是否正确 + if (client == SOCKET_ERROR) + { + cout << "socket error :" << WSAGetLastError() << endl; + break; + } + else if (client == 0) { + cout << "socket close:" << WSAGetLastError() << endl; + break; + } + + //使用一个{}圈定代码块,限定保护锁的上锁范围 + { + lock_guard<mutex> lg(g_mtx); + + //共享数据map<SOCKET, int> m_clients--【键·值对】 + //map[client] = ... //用作心跳检测的键值对 + } + + //可以进行收发包的操作了,也使用一个线程处理 【匿名对象】[client是这个线程调用函数的参数] + thread(&ServerSocket::recvandsendThread, this, client).detach(); + } +} + +void ServerSocket::recvandsendThread(SOCKET client)//采用Head分离报文头的方法,解决粘包问题 +{ + while (true) + { + //设置了应该接受的Head的字节大小 + int head_len = sizeof(Head); //报文头 应该接收的个数 + int recv_len = 0; //本次实际接收到的个数 + int gap_len = head_len - recv_len; //在本次接收后,还需要接收的个数 + + //开始接收 + char *head_buf = new char[head_len]; + recv_len = recv(client, head_buf, head_len, 0); + + //Head未满而剩下的空间 + gap_len = head_len - recv_len; + + //如果,接收的字节数不够,就一直接收 + while (gap_len > 0) + { + recv_len = recv(client, head_buf + (head_len - gap_len), gap_len, 0); + gap_len -= recv_len; + } + + //解包头 + Head *head = (Head *)head_buf; + + int bag_len = head->len;//这个是包的总长度,报文 应该接收的个数 + + //和包头的流程一样,持续接收,直到取满数据 + char *all_buf = new char[bag_len]; + memcpy(all_buf, head_buf, head_len);//包头拷贝到完整的包中 + + gap_len = bag_len - head_len; //在本次接收后,还需要接收的个数 + + //持续,直到完成 + while (gap_len > 0) { + recv_len = recv(client, all_buf + (bag_len - gap_len), gap_len, 0); + gap_len -= recv_len; + } + + + /* + 需要解密 + */ + + + //开始解包 + if (head->type == LOGIN_REQ) + { + cout << "收到请求包" << endl; + LoginReq *bag = (LoginReq *)all_buf; + cout << "姓名:" << bag->user_name << "密码:" << bag->password << endl; + + //得到客户端的数据,我们用它去查找数据库,完成登录业务的响应 + Respond loginRes; + loginRes.business_login(bag, client); + } + else if (head->type == REGISTER_REQ) + { + cout << "收到请求包 len:" << head->len << endl; + RegisterReq *bag = (RegisterReq *)all_buf; + cout << "姓名:" << bag->user_name << endl + << "密码:" << bag->password << endl + << "邮箱:" << bag->email << endl + << "电话:" << bag->telephone << endl + << "部门:" << bag->department << endl; + + //得到客户端的数据,我们用它去查找数据库,完成登录业务的响应 + Respond registerRes; + registerRes.business_register(bag, client); + } + + + + + // 用完了,记得释放动态开辟的内存 + delete[] head_buf; + delete[] all_buf; + head_buf = nullptr; // 防止指针悬空,而产生悬空指针 + all_buf = nullptr; + } + closesocket(client); // 关闭客户端套接字 +} diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/ServerSocket.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/ServerSocket.h" new file mode 100644 index 0000000..dab7eac --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/ServerSocket.h" @@ -0,0 +1,24 @@ +#pragma once +#include <WinSock2.h> +#include <iostream> +#include <thread> +#include <map> + +#include "struct_data.h" + +using namespace std; +#pragma comment(lib,"ws2_32.lib") + +class ServerSocket +{ +public: + ServerSocket(); + virtual ~ServerSocket(); + bool init_socket(); + void acceptThread(); + void recvandsendThread(SOCKET client); +private: + SOCKET m_socket; + map<SOCKET, int> m_clients; // 存放客户端及阈值的map +}; + diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/imitator_FaceLinkServer.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/imitator_FaceLinkServer.cpp" new file mode 100644 index 0000000..e546ee1 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/imitator_FaceLinkServer.cpp" @@ -0,0 +1,19 @@ +// imitator_FaceLinkServer.cpp : 定义控制台应用程序的入口点。 +// +#include "stdafx.h" +#include "ServerSocket.h" + +#include <string> + +int main() +{ + ServerSocket socket; + + string cmd; + while (cin >> cmd) { + if (cmd == "88")break; // 当输入88时,才会退出循环,结束 + } + + return 0; +} + diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/imitator_FaceLinkServer.sln" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/imitator_FaceLinkServer.sln" new file mode 100644 index 0000000..345e190 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/imitator_FaceLinkServer.sln" @@ -0,0 +1,28 @@ +锘� +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "imitator_FaceLinkServer", "imitator_FaceLinkServer\imitator_FaceLinkServer.vcxproj", "{BB27A66E-9F55-4612-A85D-B19A5A88D085}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BB27A66E-9F55-4612-A85D-B19A5A88D085}.Debug|x64.ActiveCfg = Debug|x64 + {BB27A66E-9F55-4612-A85D-B19A5A88D085}.Debug|x64.Build.0 = Debug|x64 + {BB27A66E-9F55-4612-A85D-B19A5A88D085}.Debug|x86.ActiveCfg = Debug|Win32 + {BB27A66E-9F55-4612-A85D-B19A5A88D085}.Debug|x86.Build.0 = Debug|Win32 + {BB27A66E-9F55-4612-A85D-B19A5A88D085}.Release|x64.ActiveCfg = Release|x64 + {BB27A66E-9F55-4612-A85D-B19A5A88D085}.Release|x64.Build.0 = Release|x64 + {BB27A66E-9F55-4612-A85D-B19A5A88D085}.Release|x86.ActiveCfg = Release|Win32 + {BB27A66E-9F55-4612-A85D-B19A5A88D085}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/imitator_FaceLinkServer.vcxproj" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/imitator_FaceLinkServer.vcxproj" new file mode 100644 index 0000000..bc002e6 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/imitator_FaceLinkServer.vcxproj" @@ -0,0 +1,170 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{BB27A66E-9F55-4612-A85D-B19A5A88D085}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>imitator_FaceLinkServer</RootNamespace> + <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v140</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="Shared"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <PrecompiledHeader>Use</PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader>Use</PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader>Use</PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <SDLCheck>true</SDLCheck> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <Text Include="ReadMe.txt" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="Respond.h" /> + <ClInclude Include="MySQLDB.h" /> + <ClInclude Include="ServerSocket.h" /> + <ClInclude Include="stdafx.h" /> + <ClInclude Include="struct_data.h" /> + <ClInclude Include="targetver.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="imitator_FaceLinkServer.cpp" /> + <ClCompile Include="Respond.cpp" /> + <ClCompile Include="MySQLDB.cpp" /> + <ClCompile Include="ServerSocket.cpp" /> + <ClCompile Include="stdafx.cpp"> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> + <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> + </ClCompile> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/imitator_FaceLinkServer.vcxproj.filters" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/imitator_FaceLinkServer.vcxproj.filters" new file mode 100644 index 0000000..a3dd9af --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/imitator_FaceLinkServer.vcxproj.filters" @@ -0,0 +1,57 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="婧愭枃浠�"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="澶存枃浠�"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="璧勬簮鏂囦欢"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <Text Include="ReadMe.txt" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="stdafx.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="targetver.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="struct_data.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="ServerSocket.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="MySQLDB.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + <ClInclude Include="Respond.h"> + <Filter>澶存枃浠�</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="stdafx.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="imitator_FaceLinkServer.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="ServerSocket.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="MySQLDB.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + <ClCompile Include="Respond.cpp"> + <Filter>婧愭枃浠�</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/stdafx.cpp" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/stdafx.cpp" new file mode 100644 index 0000000..68a9d9b --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/stdafx.cpp" @@ -0,0 +1,8 @@ +// stdafx.cpp : 只包括标准包含文件的源文件 +// imitator_FaceLinkServer.pch 将作为预编译头 +// stdafx.obj 将包含预编译类型信息 + +#include "stdafx.h" + +// TODO: 在 STDAFX.H 中引用任何所需的附加头文件, +//而不是在此文件中引用 diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/stdafx.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/stdafx.h" new file mode 100644 index 0000000..baa4bbc --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/stdafx.h" @@ -0,0 +1,15 @@ +// stdafx.h : 标准系统包含文件的包含文件, +// 或是经常使用但不常更改的 +// 特定于项目的包含文件 +// + +#pragma once + +#include "targetver.h" + +#include <stdio.h> +#include <tchar.h> + + + +// TODO: 在此处引用程序需要的其他头文件 diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/struct_data.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/struct_data.h" new file mode 100644 index 0000000..ac55a78 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/struct_data.h" @@ -0,0 +1,125 @@ +#pragma once + +// +//报文类型 +// +enum TypeInfo +{ + LOGIN_REQ, //登录请求 + LOGIN_RES, //登录响应 + + REGISTER_REQ, //注册请求 + REGISTER_RES, //注册响应 + + //待增加 +}; + + + +// +//成员权限 +// +struct Permission +{ + int admin; // 管理员权限 + int history; // 历史查询 + int log_search; // 日志查询权限 + int map_change; // 地图修改 + int attend_manage; // 考勤管理 + int device_manage; // 设备管理 + int version_manage; // 版本管理 + int notify_manage; // 通知管理 + int image_input; // 图像录入 + int monitor_back; // 后台监控 +}; + + + +// +//Head +// +struct Head //使用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 LoginRes +{ + Head head; + char user_name[32]; + int emp_id; //返回工号 + int status; + Permission per; + + LoginRes() { + head.type = LOGIN_RES; + head.len = sizeof(LoginRes); + } +}; + + + +// +//注册请求结构体 +// +struct RegisterReq +{ + Head head; + char user_name[32]; + char password[32]; + char email[32]; + char telephone[32]; + char department[32]; + + RegisterReq() { + head.type = REGISTER_REQ; + head.len = sizeof(RegisterReq); + } +}; + + + +// +//注册响应结构体 +// +struct RegisterRes +{ + Head head; + char user_name[32]; + int emp_id; //返回工号 + int status; + Permission per;//权限对象 + char res_info[100];//服务器响应的信息 + + RegisterRes() { + head.type = REGISTER_RES; + head.len = sizeof(RegisterRes); + } +}; + + + +// diff --git "a/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/targetver.h" "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/targetver.h" new file mode 100644 index 0000000..416cebf --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/code/\346\263\250\345\206\214\347\231\273\345\275\225\346\234\215\345\212\241\347\253\257\357\274\210\345\220\253\346\234\215\345\212\241\347\253\257\343\200\201\346\225\260\346\215\256\345\272\223\343\200\201\346\223\215\344\275\234API\357\274\211\343\200\220\346\225\260\346\215\256\345\212\240\345\257\206\345\276\205\345\256\214\345\226\204\343\200\221/targetver.h" @@ -0,0 +1,8 @@ +#pragma once + +// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。 + +// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将 +// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。 + +#include <SDKDDKVer.h> diff --git "a/Client/\347\216\213\351\243\236\346\231\272/log/\346\227\245\345\277\227_\347\216\213\351\243\236\346\231\272_250909.doc" "b/Client/\347\216\213\351\243\236\346\231\272/log/\346\227\245\345\277\227_\347\216\213\351\243\236\346\231\272_250909.doc" new file mode 100644 index 0000000..a7efdb9 --- /dev/null +++ "b/Client/\347\216\213\351\243\236\346\231\272/log/\346\227\245\345\277\227_\347\216\213\351\243\236\346\231\272_250909.doc" Binary files differ diff --git "a/Server/\345\215\240\347\224\234\347\224\234/log/\346\227\245\345\277\227_\345\215\240\347\224\234\347\224\234_20250908.doc" "b/Server/\345\215\240\347\224\234\347\224\234/log/\346\227\245\345\277\227_\345\215\240\347\224\234\347\224\234_20250908.doc" new file mode 100644 index 0000000..48af841 --- /dev/null +++ "b/Server/\345\215\240\347\224\234\347\224\234/log/\346\227\245\345\277\227_\345\215\240\347\224\234\347\224\234_20250908.doc" Binary files differ diff --git "a/Server/\345\274\240\347\233\274/log/\346\227\245\345\277\227_\345\274\240\347\233\274_20250908.doc" "b/Server/\345\274\240\347\233\274/log/\346\227\245\345\277\227_\345\274\240\347\233\274_20250908.doc" new file mode 100644 index 0000000..2ff6d85 --- /dev/null +++ "b/Server/\345\274\240\347\233\274/log/\346\227\245\345\277\227_\345\274\240\347\233\274_20250908.doc" Binary files differ diff --git "a/Server/\346\235\250\344\275\263\344\271\220/log/\346\227\245\345\277\227250908.doc" "b/Server/\346\235\250\344\275\263\344\271\220/log/\346\227\245\345\277\227250908.doc" new file mode 100644 index 0000000..7913a8e --- /dev/null +++ "b/Server/\346\235\250\344\275\263\344\271\220/log/\346\227\245\345\277\227250908.doc" Binary files differ diff --git "a/Server/\346\242\201\345\244\251/log/\346\227\245\345\277\227_\346\242\201\345\244\251_20250908.doc" "b/Server/\346\242\201\345\244\251/log/\346\227\245\345\277\227_\346\242\201\345\244\251_20250908.doc" new file mode 100644 index 0000000..3a48601 --- /dev/null +++ "b/Server/\346\242\201\345\244\251/log/\346\227\245\345\277\227_\346\242\201\345\244\251_20250908.doc" Binary files differ diff --git "a/Server/\350\226\233\345\230\211\347\221\266/log/\346\227\245\345\277\227_\350\226\233\345\230\211\347\221\266_0908.doc" "b/Server/\350\226\233\345\230\211\347\221\266/log/\346\227\245\345\277\227_\350\226\233\345\230\211\347\221\266_0908.doc" new file mode 100644 index 0000000..6e274b6 --- /dev/null +++ "b/Server/\350\226\233\345\230\211\347\221\266/log/\346\227\245\345\277\227_\350\226\233\345\230\211\347\221\266_0908.doc" Binary files differ -- Gitblit v1.8.0