Commit 914f780d by 孙亚楠

d

parents cd24818e fc15a4cd
......@@ -24,11 +24,13 @@ class BpoSDPJApi {
this.EXCEPT_KEYS = ['sign'];
this.ccashinfoSve = system.getObject("service.ccashinfoSve");
// this.ecompanybusiSve = system.getObject("service.ecompanybusiSve");
this.ecompanybusiDao = system.getObject("db.ecompanybusiDao");
this.qrClient = system.getObject("util.qrClient");
this.idcardClient = system.getObject("util.idcardClient");
this.esettleSve = system.getObject("service.esettleSve");
this.ecompanybusiSve = system.getObject("service.ecompanybusiSve");
this.tdevApi = require("./tdevApi");
this.redisLock = system.getObject("util.redisLock");
this.bankthreelogSve = system.getObject("service.bankthreelogSve");
......@@ -55,31 +57,43 @@ class BpoSDPJApi {
*/
async cashQRCode(obj, req) {
// 验证合法性
// let p = {
// appId: this.trim(obj.appId),
// nonceStr: this.trim(obj.nonceStr),
// ecid: Number(obj.ecid || 0),
// idNo: this.trim(obj.idNo),
// };
//
// let keys = Object.keys(p).sort();
// let signArr = [];
// for (let k = 0; k < keys.length; k++) {
// let tKey = keys[k];
// if (this.EXCEPT_KEYS.indexOf(tKey) == -1 && p[tKey]) {
// signArr.push(tKey + "=" + p[tKey]);
// }
// }
// let signStr = signArr.join("&") + "&key=" + api.app_secret;
// let sign = md5(signStr).toUpperCase();
// console.log(obj.sign, signStr, sign);
//
// if (sign != obj.sign) {
// return {
// code: 1001001,
// msg: "签名失败"
// };
// }
let param = {
appId: obj.appId,
ecid: obj.ecid,
mchtId: obj.mchtId,
amt: obj.amt,
idName: obj.idName,
idNo: obj.idNo,
outTradeNo: obj.outTradeNo,
nonceStr: obj.nonceStr
};
let api = await this.ecompanybusiSve.findOne({
appId: obj.appId,
etemplate_id: obj.ecid,
mchtId: obj.mchtId,
});
if (!api) {
return this.getBaseResult(1001003, "配置信息错误,请联系薪必果人员进行配置");
}
let keys = Object.keys(param).sort();
let signArr = [];
for (let k = 0; k < keys.length; k++) {
let tKey = keys[k];
if (this.EXCEPT_KEYS.indexOf(tKey) == -1 && param[tKey]) {
signArr.push(tKey + "=" + param[tKey]);
}
}
let signStr = signArr.join("&") + "&key=" + api.key;
let sign = md5(signStr).toUpperCase();
console.log(obj.sign, signStr, sign);
if (sign != obj.sign) {
return this.getBaseResult(1001001, "签名失败");
}
try {
if(!obj || !obj.outTradeNo || !obj.mchtId){
return this.getCodeResult(1002001,null);
......
......@@ -17,7 +17,7 @@ class QrClient{
if(!text){
return null;
}
let key = "_"+new Date().getTime(), filePath = settings.localPath();
let key = "_" + new Date().getTime(), filePath = settings.localPath();
var qr_png = qr.image(text, {size :10 });
let _r = await qr_png.pipe(require('fs').createWriteStream(`${filePath}${key}.png`));
console.log(_r);
......
......@@ -35,7 +35,7 @@ var settings = {
let rootPath = "";
// windows
if (platform.toLocaleLowerCase().startsWith('win')) {
rootPath = "C:\\Temp\\";
rootPath = "D:/tmp";
} else {
rootPath="/tmp"
}
......
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