Commit ba572f4a by zhaoxiqing

gsb

parent 4c7c2ee2
...@@ -7,14 +7,14 @@ class YZContractApi { ...@@ -7,14 +7,14 @@ class YZContractApi {
this.idcardClient = system.getObject("util.idcardClient"); this.idcardClient = system.getObject("util.idcardClient");
this.utilesignbaoSve = system.getObject("service.utilesignbaoSve"); this.utilesignbaoSve = system.getObject("service.utilesignbaoSve");
this.ecompanybusiSve = system.getObject("service.ecompanybusiSve"); this.ecompanybusiSve = system.getObject("service.ecompanybusiSve");
this.enttemplateSve = system.getObject("service.enttemplateSve");
this.econtractSve = system.getObject("service.econtractSve"); this.econtractSve = system.getObject("service.econtractSve");
this.esettleSve = system.getObject("service.esettleSve"); this.esettleSve = system.getObject("service.esettleSve");
this.etemplatebusiSve = system.getObject("service.etemplatebusiSve"); this.etemplatebusiSve = system.getObject("service.etemplatebusiSve");
this.appId = "1201869719607517185"; // this.appId = "1201869719607517185";
this.key = "bee7870e008ab144bf518b70ef91f8ac"; // this.key = "bee7870e008ab144bf518b70ef91f8ac";
} }
async syncSignedFile() { async syncSignedFile() {
...@@ -74,6 +74,11 @@ class YZContractApi { ...@@ -74,6 +74,11 @@ class YZContractApi {
return this.returnjson(-1, "请提供随机码") return this.returnjson(-1, "请提供随机码")
} }
var enttemplate = await this.enttemplateSve.findById(param.ecid);
if (!enttemplate || !enttemplate.key) {
return this.returnjson(1001003, "配置信息错误,请联系薪必果人员进行配置");
}
// 签名 // 签名
var signArr = []; var signArr = [];
var keys = Object.keys(param).sort(); var keys = Object.keys(param).sort();
...@@ -85,7 +90,7 @@ class YZContractApi { ...@@ -85,7 +90,7 @@ class YZContractApi {
} }
signArr.push(k + "=" + v); signArr.push(k + "=" + v);
} }
var signStr = signArr.join("&") + "&key=" + this.key; var signStr = signArr.join("&") + "&key=" + enttemplate.key;
var sign = md5(signStr).toUpperCase(); var sign = md5(signStr).toUpperCase();
console.log(sign) console.log(sign)
if (param.sign != sign) { if (param.sign != sign) {
...@@ -263,13 +268,22 @@ class YZContractApi { ...@@ -263,13 +268,22 @@ class YZContractApi {
var merchantId = obj.merchantId || ""; var merchantId = obj.merchantId || "";
var pageSize = 20; var pageSize = 20;
if (!obj.appId) {
return this.returnjson(-1, "请传入appId")
}
var enttemplate = await this.enttemplateSve.findOne({appid : obj.appId});
if (!enttemplate || !enttemplate.key) {
return this.returnjson(1001003, "配置信息错误,请联系薪必果人员进行配置");
}
var signArr = []; var signArr = [];
signArr.push("appId=" + this.appId); signArr.push("appId=" + enttemplate.appId);
signArr.push("idNo=" + idNo); signArr.push("idNo=" + idNo);
signArr.push("merchantId=" + merchantId); signArr.push("merchantId=" + merchantId);
signArr.push("nonceStr=" + nonceStr); signArr.push("nonceStr=" + nonceStr);
signArr.push("startId=" + startId); signArr.push("startId=" + startId);
signArr.push("key=" + this.key); signArr.push("key=" + enttemplate.key);
var sign = md5(signArr.join("&")).toUpperCase(); var sign = md5(signArr.join("&")).toUpperCase();
console.log(sign); console.log(sign);
if (sign != obj.sign) { if (sign != obj.sign) {
......
...@@ -6,6 +6,9 @@ module.exports = (db, DataTypes) => { ...@@ -6,6 +6,9 @@ module.exports = (db, DataTypes) => {
codeurl:DataTypes.STRING, codeurl:DataTypes.STRING,
remark:DataTypes.STRING, remark:DataTypes.STRING,
templateid:DataTypes.STRING, templateid:DataTypes.STRING,
appid :DataTypes.STRING,
mcthid : DataTypes.STRING,
key : DataTypes.STRING,
},{ },{
paranoid: true,//假的删除 paranoid: true,//假的删除
underscored: true, underscored: true,
......
...@@ -208,8 +208,8 @@ class EntcontractService extends ServiceBase { ...@@ -208,8 +208,8 @@ class EntcontractService extends ServiceBase {
async createYzMerchant(params) { async createYzMerchant(params) {
var data = { var data = {
appId: "1202849621743763458", appId: params.toAppId,
mchtId: "1202848945651318786", mchtId: params.toMcthid,
type: "0",// 类型 0 一般纳税人 1 小规模纳税人 type: "0",// 类型 0 一般纳税人 1 小规模纳税人
companyName: params.merchantName,//商户名称 companyName: params.merchantName,//商户名称
mobile: params.mobile,//手机号 mobile: params.mobile,//手机号
...@@ -667,6 +667,8 @@ class EntcontractService extends ServiceBase { ...@@ -667,6 +667,8 @@ class EntcontractService extends ServiceBase {
await entcontract.save(); await entcontract.save();
params.entcontract_id = entcontract.id; params.entcontract_id = entcontract.id;
// this.syncSign(entcontract.id); // this.syncSign(entcontract.id);
params.toAppId = enttemplate.appid;
params.toMcthid = enttemplate.mcthid;
return await this.createYzMerchant(params); return await this.createYzMerchant(params);
// return this.returnjson(0, "success", { // return this.returnjson(0, "success", {
// contractId: entcontract.id // contractId: entcontract.id
......
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