mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
完成系统管理web端功能,实现系统管理服务端接口,实现登录功能
This commit is contained in:
85
src/main.cpp
85
src/main.cpp
@@ -1,4 +1,5 @@
|
||||
#include <Windows.h>
|
||||
#include <thread>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QtWebEngineWidgets/QtWebEngineWidgets>
|
||||
@@ -9,46 +10,62 @@
|
||||
#include "app/Application.h"
|
||||
#include "app/Dao.h"
|
||||
|
||||
#include "common/Snowflake.h"
|
||||
#include "protocol/TcpEntity.h"
|
||||
|
||||
#include "common/JsonN.h"
|
||||
|
||||
#include "app/Config.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
SetConsoleOutputCP(CP_UTF8); // 设置控制台输出为UTF-8
|
||||
// 设置控制台输出为 UTF-8 编码
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
// 设置控制台输入为 UTF-8 编码(如果需要输入中文)
|
||||
SetConsoleCP(CP_UTF8);
|
||||
|
||||
auto& mysqlOptions = DaoEntity::mysqlOptions();
|
||||
mysqlOptions.host = "localhost";
|
||||
mysqlOptions.port = 3306;
|
||||
mysqlOptions.user = "root";
|
||||
mysqlOptions.password = "123456";
|
||||
mysqlOptions.dbname = "ees";
|
||||
NJson jsonroot;
|
||||
NJsonParse(R"({"name": "Alice", "age": 25, 111,})", jsonroot);
|
||||
|
||||
std::cout << (jsonroot.is_null() ? "ERROR" : "OK") << std::endl;
|
||||
|
||||
std::string filename = "assets/html/data中文.txt";
|
||||
|
||||
std::filesystem::path filePath = std::filesystem::u8path("assets/html/data中文.txt");
|
||||
//std::locale::global(locale(""));//将全局区域设为操作系统默认区域
|
||||
std::ifstream ifs(filePath, std::ios::binary);
|
||||
//std::locale::global(locale("C"));//还原全局区域设定
|
||||
|
||||
if (ifs.is_open())
|
||||
{
|
||||
// 将文件指针移动到末尾获取文件大小
|
||||
ifs.seekg(0, std::ios::end);
|
||||
std::streamsize size = ifs.tellg();
|
||||
ifs.seekg(0, std::ios::beg);
|
||||
|
||||
std::string buf(size, '\0');
|
||||
ifs.read(&buf[0], size);
|
||||
std::cout << "文件内容: " << buf << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "error" << std::endl;
|
||||
}
|
||||
|
||||
|
||||
////std::cout << Snowflake::instance().getId() << std::endl;
|
||||
//for (int i = 0; i<=10; ++i) {
|
||||
// //std::cout << Snowflake::instance().getId() << std::endl;
|
||||
//}
|
||||
|
||||
|
||||
//DaoEntity dao("");
|
||||
//
|
||||
//std::string filename = "assets/html/data中文.txt";
|
||||
//
|
||||
//std::filesystem::path filePath = std::filesystem::u8path("assets/html/data中文.txt");
|
||||
////std::locale::global(locale(""));//将全局区域设为操作系统默认区域
|
||||
//std::ifstream ifs(filePath, std::ios::binary);
|
||||
////std::locale::global(locale("C"));//还原全局区域设定
|
||||
|
||||
// 运行后台服务
|
||||
//if (ifs.is_open())
|
||||
//{
|
||||
// // 将文件指针移动到末尾获取文件大小
|
||||
// ifs.seekg(0, std::ios::end);
|
||||
// std::streamsize size = ifs.tellg();
|
||||
// ifs.seekg(0, std::ios::beg);
|
||||
|
||||
// std::string buf(size, '\0');
|
||||
// ifs.read(&buf[0], size);
|
||||
// std::cout << "文件内容: " << buf << std::endl;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// std::cout << "error" << std::endl;
|
||||
//}
|
||||
|
||||
//TcpEntity tcpEntity;
|
||||
//tcpEntity.setHost("127.0.0.1", 9901, true);
|
||||
//tcpEntity.setReconnect(5000);
|
||||
//tcpEntity.start();
|
||||
|
||||
// 运行后台服务
|
||||
Application::instance().init();
|
||||
|
||||
// 运行QT主窗口
|
||||
@@ -58,5 +75,9 @@ int main(int argc, char** argv)
|
||||
mainWin.resize(1920, 1080);
|
||||
mainWin.show();
|
||||
qapp.exec();
|
||||
|
||||
//while (1) {
|
||||
// std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
//}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user