优化了web界面,下载功能等

This commit is contained in:
zjk
2025-03-02 14:35:21 +08:00
parent 0fbe95bc45
commit 16cffa296a
6 changed files with 773 additions and 176 deletions
+15
View File
@@ -2,6 +2,7 @@
#include <iostream>
#include <ctime>
#include <json/json.h>
#include <sys/stat.h>
SQLiteDB::SQLiteDB(const std::string& dbPath) {
if (sqlite3_open(dbPath.c_str(), &m_db) != SQLITE_OK) {
@@ -674,6 +675,20 @@ string SQLiteDB::getDBPatch(){
return m_dbPath;
}
long SQLiteDB::getDatabaseSize() {
if (m_dbPath.empty()) {
return -1;
}
struct stat stat_buf;
int rc = stat(m_dbPath.c_str(), &stat_buf);
if (rc != 0) {
return -1;
}
return stat_buf.st_size;
}
bool SQLiteDB::clearPowerData() {
if (!m_db) return false;
+3
View File
@@ -78,6 +78,9 @@ public:
// 获取数据库状态函数
string getDBPatch();
// 获取数据库大小
long getDatabaseSize();
private:
sqlite3* m_db;