完成系统管理web端功能,实现系统管理服务端接口,实现登录功能

This commit is contained in:
lixiaoyuan
2025-07-18 09:08:09 +08:00
parent 4a198a7271
commit 7b3f32f334
31 changed files with 1384 additions and 325 deletions

View File

@@ -3,7 +3,7 @@
//#include "Spdlogger.h"
#include "Logger.h"
MysqlClient::MysqlClient(MysqlOptions opts) : options_(opts)
MysqlClient::MysqlClient(MysqlOption option) : option_(option)
{
conn();
}
@@ -20,9 +20,10 @@ int MysqlClient::conn()
return 0;
}
mysql_ = mysql_init(nullptr);
MYSQL* ret = mysql_real_connect(mysql_, options_.host.c_str(), options_.user.c_str(), options_.password.c_str(), options_.dbname.c_str(), options_.port, NULL, 0);
MYSQL* ret = mysql_real_connect(mysql_, option_.host.c_str(), option_.user.c_str(), option_.password.c_str(), option_.dbname.c_str(), option_.port, NULL, 0);
if (ret == NULL)
{
std::string err = mysql_error(mysql_);
//Spdlogger::info("[mysql] connect failed: {}", mysql_error(mysql_));
mysql_ = nullptr;
}
@@ -49,7 +50,7 @@ void MysqlClient::close()
bool MysqlClient::exec(std::string sql)
{
XLOGD() << "Mysql exec sql=" << sql;
//XLOGD() << "Mysql exec sql=" << sql;
if (!mysql_)
{
XLOGE() << "Mysql exec error, database is not connected.";