Commit d7141989 by 王昆

gsb

parent 7d150077
......@@ -51,6 +51,21 @@ class BpoSDPJApi {
return o.toString().trim();
}
async testqr(obj, req) {
let arr = [];
for (let i = 0; i < 20; i++) {
this.tttttt();
// let url = await this.qrClient.generateQR("https://bpohhr.gongsibao.com/sdpj?no=D6L0EoGg1wkzO5GEvm%2B9hA%3D%3D&outTradeNo=01234567891011121319&mchtId=1286935856342376450");
// arr.push(url);
}
return arr;
}
async tttttt() {
let url = await this.qrClient.generateQR("https://bpohhr.gongsibao.com/sdpj?no=D6L0EoGg1wkzO5GEvm%2B9hA%3D%3D&outTradeNo=01234567891011121319&mchtId=1286935856342376450");
console.log(url);
}
/**
* 生成二维码
* @param obj
......
......@@ -6,6 +6,7 @@ const fs = require("fs");
class QrClient{
constructor(){
this.redisClient = system.getObject("util.redisClient");
this.ossClient = system.getObject("util.ossClient");
}
/**
......@@ -20,20 +21,11 @@ class QrClient{
return null;
}
let key = prev + await this.redisClient.genrateId("qrcode") + ".png";
let filePath = settings.localPath();
var qr_png = qr.image(text, {size :10 });
let _r = await qr_png.pipe(require('fs').createWriteStream(`${filePath}${key}`));
console.log(_r);
if(!_r){
return null;
}
let urlRes = await new ossClient().upfile(key,`${filePath}${key}`);
fs.unlink(`${filePath}${key}`, (err) => {
if (err){
console.log(`二维码删除失败`);
}
console.log('已成功地删除文件');
});
console.log(1, key);
let is = qr.imageSync(text, {type: 'png' ,size :10});
console.log(2);
let urlRes = await this.ossClient.upfile(key, is);
console.log(3, urlRes);
return urlRes.url;
}catch (e) {
console.log(e);
......
......@@ -35,9 +35,9 @@ var settings = {
let rootPath = "";
// windows
if (platform.toLocaleLowerCase().startsWith('win')) {
rootPath = "D:/tmp";
rootPath = "D:/tmp/";
} else {
rootPath="/tmp"
rootPath="/tmp/"
}
return rootPath;
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment