mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
添加上传fps文件的支持
This commit is contained in:
1 parent
327fec1fea
commit
7fc721676e
3 files changed
+14
-5
No files matched your search
@@ -85,16 +85,16 @@ class FpsProblemImportHandler extends Handler {
|
||||
testdata.addFile(`${i + 1}.in`, Buffer.from(p.test_input[i]));
|
||||
testdata.addFile(`${i + 1}.out`, Buffer.from(p.test_output[i]));
|
||||
}
|
||||
const file = path.resolve(os.tmpdir(), 'hydro', `${Math.random()}.zip`);
|
||||
const f = path.resolve(os.tmpdir(), 'hydro', `${Math.random()}.zip`);
|
||||
await new Promise((resolve, reject) => {
|
||||
testdata.writeZip(file, (err) => {
|
||||
testdata.writeZip(f, (err) => {
|
||||
if (err) reject(err);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
await problem.setTestdata(domainId, pid, file);
|
||||
await problem.setTestdata(domainId, pid, f);
|
||||
await problem.edit(domainId, pid, { html: true });
|
||||
await fs.unlink(file);
|
||||
await fs.unlink(f);
|
||||
}
|
||||
this.response.body = { count: result.fps.item.length };
|
||||
this.response.redirect = this.url('problem_main');
|
||||
|
||||
Reference in new issue
Block a user