pdreport:GWM
This commit is contained in:
parent
8f74d54908
commit
5e4558502b
@ -199,26 +199,33 @@ exports.DownloadPdReport = async (req, res) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
pd_id = req.query.ref_no;
|
||||
DownloadPdReportUrl = process.env.PD_REPORT_URL;
|
||||
url = DownloadPdReportUrl+"getCreditPDReportforCETApp?credit_pd_id="+pd_id;
|
||||
// pd_id = req.query.ref_no;
|
||||
// DownloadPdReportUrl = process.env.PD_REPORT_URL;
|
||||
// url = DownloadPdReportUrl+"getCreditPDReportforCETApp?credit_pd_id="+pd_id;
|
||||
|
||||
request({
|
||||
url: url,
|
||||
method: "GET"
|
||||
// request({
|
||||
// url: url,
|
||||
// method: "GET"
|
||||
|
||||
}, function (error, response, body) { console.log(body);
|
||||
if (body != undefined) {
|
||||
data = JSON.parse(body);
|
||||
if ( data.status == 200) {
|
||||
// }, function (error, response, body) { console.log(body);
|
||||
// if (body != undefined) {
|
||||
// data = JSON.parse(body);
|
||||
// if ( data.status == 200) {
|
||||
|
||||
link = data.records;
|
||||
res.send({'status':200,'message':"success",'data':link});
|
||||
}else{
|
||||
res.send({'status':404,'message':"failed",'data':"No data"});
|
||||
}
|
||||
}
|
||||
});
|
||||
// link = data.records;
|
||||
// res.send({'status':200,'message':"success",'data':link});
|
||||
// }else{
|
||||
// res.send({'status':404,'message':"failed",'data':"No data"});
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
const storage = new Storage({ keyFilename : path.join(__dirname, "../../googleCloud.json") });
|
||||
const bucketName = process.env.GCP_BUCKET_NAME;
|
||||
const fileName = 'credit-pd/pd'+req.query.ref_no+'/'+req.query.ref_no+'.pdf';
|
||||
const options = {version: 'v2', action: 'read',expires: Date.now() + 1000 * 60 * 60, };
|
||||
const [url] = await storage.bucket(bucketName).file(fileName).getSignedUrl(options);
|
||||
res.send({'status':200,'message':"success",'data':url});
|
||||
|
||||
|
||||
} catch(err) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user