fix: import unpublished exam rooms and add opt-in school HTML feedback

This commit is contained in:
Codex
2026-10-16 16:38:00 +08:00
parent defe7fd50e
commit 437ed14dbe
31 changed files with 969 additions and 39 deletions
@@ -120,10 +120,11 @@ class HttpFeedbackSender implements FeedbackSender {
throw const FeedbackException('服务器不支持此附件的格式或内容,请移除附件,或换用正常的图片、视频后提交');
}
if (response.statusCode == 422 && errorCode == 'validation_error') {
if (submission.diagnosticLog != null &&
if ((submission.diagnosticLog != null ||
submission.diagnosticHtml != null) &&
result?['detail'] == 'Unexpected file field.') {
throw const FeedbackException(
'反馈服务器尚未更新日志附件协议,请先更新服务器,或取消附带日志后提交。填写内容已保留。',
'反馈服务器尚未更新日志或网页附件协议,请先更新服务器,或取消附带排查附件后提交。填写内容已保留。',
);
}
throw const FeedbackException('填写内容未通过服务器校验,请检查必填内容、长度及附件后重新提交');
@@ -206,6 +207,14 @@ class HttpFeedbackSender implements FeedbackSender {
bytes.add(submission.diagnosticLog!);
write('\r\n');
}
if (submission.diagnosticHtml != null) {
write(
'--$boundary\r\nContent-Disposition: form-data; name="diagnostic_html"; filename="TPSchedule-school-page.html"\r\n'
'Content-Type: text/html; charset=utf-8\r\n\r\n',
);
bytes.add(submission.diagnosticHtml!);
write('\r\n');
}
write('--$boundary--\r\n');
return bytes.takeBytes();
}