Browse Source

(debug)七牛下载路径打印

master
周沫沫历险记 2 years ago
parent
commit
7b30c5f333
  1. 144
      .vscode/launch.json
  2. 2
      web/routes/attachment/index.js

144
.vscode/launch.json

@ -1,68 +1,82 @@
{ {
// 使 IntelliSense // 使 IntelliSense
// //
// 访: https://go.microsoft.com/fwlink/?linkid=830387 // 访: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"type": "node", "type": "node",
"request": "launch", "request": "launch",
"name": "启动 API", "name": "启动 API",
"program": "${workspaceRoot}/api/server.js", "program": "${workspaceRoot}/api/server.js",
"env": { "env": {
"NODE_ENV": "development" "NODE_ENV": "development"
}, },
"args": [ "args": [
"-p 4700", "-p 4700",
"-f http://localhost:4700", "-f http://localhost:4700",
// //
"-g postgres://postgres:123@10.8.30.166:5432/hr-dev", // "-g postgres://postgres:123@10.8.30.166:5432/hr-dev",
"--redisHost localhost", "--redisHost localhost",
"--redisPort 6379", "--redisPort 6379",
"--apiEmisUrl http://localhost:14000", "--apiEmisUrl http://localhost:14000",
// //
// "--apiEmisUrl http://10.8.30.161:1111", // "--apiEmisUrl http://10.8.30.161:1111",
// "--redisHost 10.8.30.112", // "--redisHost 10.8.30.112",
"--qnak 5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu", "-g postgres://postgres:123@10.8.30.166:5432/HRM",
"--qnsk w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5", "--qnak 5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu",
"--qnbkt pep-resource", "--qnsk w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5",
// "--qndmn http://resources.anxinyun.cn", "--qnbkt pep-resource",
"--qndmn https://pepsource.anxinyun.cn", // "--qndmn http://resources.anxinyun.cn",
"--qndmn https://pepsource.anxinyun.cn",
// * 2 // * 2
// "--clickHouseUser ", // "--clickHouseUser ",
// "--clickHousePassword ", // "--clickHousePassword ",
"--clickHousePort 30123",
"--clickHousePort 30123", //
// "--clickHouseUrl http://10.8.30.71",
// // "--clickHousePepEmis pepca_dev",
// "--clickHouseUrl http://10.8.30.71", // "--clickHouseCamworkflow camworkflow",
// "--clickHousePepEmis pepca_dev", // "--clickHouseHr hr_dev",
// "--clickHouseCamworkflow camworkflow", //
// "--clickHouseHr hr_dev", "--clickHouseUrl http://10.8.30.161",
"--clickHousePepEmis pepca8",
// "--clickHouseCamworkflow camworkflow",
"--clickHouseUrl http://10.8.30.161", "--clickHouseHr hrm",
"--clickHousePepEmis pepca8", ]
"--clickHouseCamworkflow camworkflow", },
"--clickHouseHr hrm", {
] "type": "node",
}, "request": "launch",
{ "name": "run hrm-web",
"type": "node", "program": "${workspaceRoot}/web/server.js",
"request": "launch", "args": [
"name": "run mocha", "-p",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", "5700",
"stopOnEntry": false, "-u",
"args": [ "http://localhost:4700",
"app/test/*.test.js", "--apiHrUrl",
"--no-timeouts" "http://localhost:4700",
], "-d",
"cwd": "${workspaceRoot}", "localhost",
"runtimeExecutable": null, "--webPepUrl",
"env": { "http://localhost:5300",
"NODE_ENV": "development" "--apiEmisUrl",
} "http://localhost:4000",
} "--qnak",
] "5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu",
} "--qnsk",
"w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5",
"--qnbkt",
"pep-resource",
"--qndmn",
"https://pepsource.anxinyun.cn",
"--wkys",
"http://10.8.30.109:14000",
],
"env": {
"NODE_ENV": "development"
}
}
]
}

2
web/routes/attachment/index.js

@ -35,7 +35,9 @@ module.exports = {
try { try {
const { filename } = ctx.request.query; const { filename } = ctx.request.query;
const fkey = decodeURI(ctx.path.slice(fetchUrl.length + 1)).replace(/\.json$/, '.js'); const fkey = decodeURI(ctx.path.slice(fetchUrl.length + 1)).replace(/\.json$/, '.js');
console.log(fkey);
const publicDownloadUrl = await app.fs.attachment.download(fkey); const publicDownloadUrl = await app.fs.attachment.download(fkey);
console.log("publicDownloadUrl:", publicDownloadUrl);
ctx.status = 200; ctx.status = 200;
if (filename) ctx.attachment(filename); if (filename) ctx.attachment(filename);
ctx.body = request.get(publicDownloadUrl); ctx.body = request.get(publicDownloadUrl);

Loading…
Cancel
Save