Commit 6c66bb08 by 王昆

gsb

parent 8e475552
......@@ -430,6 +430,96 @@ class EcontractApi {
}
}
async bankfour(obj, req) {
try {
var appId = obj.appId;
var userName = obj.userName || "";
var userIdNo = obj.userIdNo || "";
var userBankNo = obj.userBankNo || "";
var userMobile = obj.userMobile || "";
var nonceStr = obj.nonceStr || "";
var sign = obj.sign || "";
var btl = await this.bankthreelogSve.create({
appId: appId,
userName: userName,
userIdNo: userIdNo,
userBankNo: userBankNo,
userMobile: userMobile,
nonceStr: nonceStr,
sign: sign,
use_esign: false,
result: false,
});
var busi = await this.ecompanybusiSve.findOne({
appId: appId
});
if (!busi) {
return {
code: 1001003,
msg: "配置信息错误,请联系薪必果人员进行配置"
};
}
var signArr = [];
signArr.push("appId=" + appId);
signArr.push("nonceStr=" + nonceStr);
signArr.push("userBankNo=" + userBankNo);
signArr.push("userIdNo=" + userIdNo);
signArr.push("userMobile=" + userMobile);
signArr.push("userName=" + userName);
signArr.push("key=" + busi.key);
var calcSign = md5(signArr.join("&")).toUpperCase();
if (sign != calcSign) {
return {
code: 1,
msg: "签名失败"
};
}
var bankParams = {
name: userName, //姓名 必填
idno: userIdNo, //身份证 必填
cardno: userBankNo, //银行卡 必填
mobile: userMobile,
};
var tt = await this.utilesignbaoSve.bankfour(bankParams, "econtractapi.bankthree") || {};
// {"code":-110,"message":"手机号格式错误","data":{}}
//1成功,-110提示验证信息有误,-120亲,提供的信息不正确,请验证后再试!
console.log("tt-----------------------------", tt);
btl.use_esign = true;
if (tt.code == 1) {
btl.result = true;
btl.save();
return {
code: 0,
msg: "success"
};
} else if (tt.code == -110) {
btl.result = false;
btl.save();
return {
code: 1002002,
msg: tt.message
};
} else {
btl.result = false;
btl.save();
return {
code: 1002002,
msg: tt.message || "银行四要素验证失败"
};
}
} catch (error) {
return {
code: 500,
msg: "接口异常"
};
}
}
async dosync(obj, req) {
// TODO 需要验证一下合法
this.econtractSve.syncAllSigners();
......
......@@ -7,6 +7,7 @@ module.exports = (db, DataTypes) => {
userName: DataTypes.STRING(100),
userIdNo: DataTypes.STRING(100),
userBankNo: DataTypes.STRING(100),
userMobile: DataTypes.STRING(30),
nonceStr: DataTypes.STRING(100),
sign: DataTypes.STRING(100),
......
......@@ -41,6 +41,7 @@ class UtilESignBaoService {
result.data = tResult.data;
return result;
}
async bankfour(params, opName) { //四要素验证
var result = {
code: 1,
......@@ -67,6 +68,7 @@ class UtilESignBaoService {
result.data = tResult.data;
return result;
}
//-------------------------------------------------------------------------e签宝银行四要素、三要素验证---结束----------------
......
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