|
@@ -370,12 +370,12 @@ void ExamsController::doPost(CWF::Request &request, CWF::Response &response) con
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ qDebug() << "个人考试题目:" << examContent;
|
|
|
UserModel user(storage);
|
|
UserModel user(storage);
|
|
|
ExamsQuestionModel exams(storage);
|
|
ExamsQuestionModel exams(storage);
|
|
|
|
|
|
|
|
// 个人考试内容是空 获取默认选择的考试内容
|
|
// 个人考试内容是空 获取默认选择的考试内容
|
|
|
- if (examContent.isEmpty()) {
|
|
|
|
|
|
|
+ if (examContent.isEmpty() || examContent == "") {
|
|
|
CWF::SqlQuery query(storage);
|
|
CWF::SqlQuery query(storage);
|
|
|
QJsonObject status = query.exec(QString("SELECT * FROM exams_question WHERE isSelect = 1"));
|
|
QJsonObject status = query.exec(QString("SELECT * FROM exams_question WHERE isSelect = 1"));
|
|
|
if (status["success"].toBool()) {
|
|
if (status["success"].toBool()) {
|
|
@@ -386,7 +386,7 @@ void ExamsController::doPost(CWF::Request &request, CWF::Response &response) con
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ qDebug() << "使用考试题目:" << examContent;
|
|
|
// 获取考试内容
|
|
// 获取考试内容
|
|
|
|
|
|
|
|
CWF::SqlQueryManager queryManager(storage);
|
|
CWF::SqlQueryManager queryManager(storage);
|
|
@@ -403,10 +403,15 @@ void ExamsController::doPost(CWF::Request &request, CWF::Response &response) con
|
|
|
{"data", QJsonValue()}});
|
|
{"data", QJsonValue()}});
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ qDebug() << "数据库考试题目:" << jsonArray;
|
|
|
for (const QJsonValue &json : jsonArray) {
|
|
for (const QJsonValue &json : jsonArray) {
|
|
|
if (json.isObject()) {
|
|
if (json.isObject()) {
|
|
|
QJsonObject obj = json.toObject();
|
|
QJsonObject obj = json.toObject();
|
|
|
const QString dir = obj["fileDir"].toString();
|
|
const QString dir = obj["fileDir"].toString();
|
|
|
|
|
+ if (dir == "") {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ qDebug() << "数据库考试题目信息文件或者目录:" << dir;
|
|
|
|
|
|
|
|
const QStringList files = listFiles(dir, dir);
|
|
const QStringList files = listFiles(dir, dir);
|
|
|
response.write(QJsonObject{{"status", true},
|
|
response.write(QJsonObject{{"status", true},
|
|
@@ -517,7 +522,7 @@ void ExamsFilesController::doGet(CWF::Request &request, CWF::Response &response)
|
|
|
response.addHeader(CWF::HTTP::CONTENT_TYPE, getMimeType(fileName).toUtf8());
|
|
response.addHeader(CWF::HTTP::CONTENT_TYPE, getMimeType(fileName).toUtf8());
|
|
|
response.write(file.readAll());
|
|
response.write(file.readAll());
|
|
|
} else {
|
|
} else {
|
|
|
- response.sendJsonError(0, file.errorString().toUtf8());
|
|
|
|
|
|
|
+ response.sendJsonError(0, (file.errorString() + path).toUtf8());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -603,6 +608,7 @@ void UploadedFilesController::doPost(CWF::Request &request, CWF::Response &respo
|
|
|
.arg(user.getName())
|
|
.arg(user.getName())
|
|
|
.arg(user.getExamineeNumber())
|
|
.arg(user.getExamineeNumber())
|
|
|
.arg(QString(it.key()));
|
|
.arg(QString(it.key()));
|
|
|
|
|
+ continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const QString filePath = dir.absoluteFilePath(fileName);
|
|
const QString filePath = dir.absoluteFilePath(fileName);
|