Commit 7bf9b2bc by 宋毅

tj

parent 10293756
...@@ -53,7 +53,7 @@ class APIBase { ...@@ -53,7 +53,7 @@ class APIBase {
async doexec(gname, methodname, pobj, query, req) { async doexec(gname, methodname, pobj, query, req) {
req.requestId = this.getUUID(); req.requestId = this.getUUID();
try { try {
if (["getTokenByHosts", "receiveCallBackNotify", "getAppInfo", "getPayInfo", "test"].indexOf(methodname) < 0) { if (["getTokenByHosts", "receiveCallBackNotify", "getAppInfo", "getPayInfo", "verifyAliPayReturnSign", "test"].indexOf(methodname) < 0) {
if (!pobj.appInfo) { if (!pobj.appInfo) {
return system.getResult(null, "pobj.appInfo can not be empty !"); return system.getResult(null, "pobj.appInfo can not be empty !");
} }
......
...@@ -14,6 +14,10 @@ class AliPayment extends APIBase { ...@@ -14,6 +14,10 @@ class AliPayment extends APIBase {
var result = await this.utilsAlibankSve.getH5AliDingPayInfo(pobj, pobj.actionBody); var result = await this.utilsAlibankSve.getH5AliDingPayInfo(pobj, pobj.actionBody);
return result; return result;
} }
async verifyAliPayReturnSign(pobj, query, req) {
var result = await this.utilsAlibankSve.verifyAliPayReturnSign(pobj, pobj);
return result;
}
async test(pobj, qobj, req) { async test(pobj, qobj, req) {
// var pobj = { appInfo: { uapp_id: 22 }, actionBody: { total_fee: 0.01, order_num: "111222", body_desc: "标题描述1" } }; // var pobj = { appInfo: { uapp_id: 22 }, actionBody: { total_fee: 0.01, order_num: "111222", body_desc: "标题描述1" } };
var actionBody = { var actionBody = {
......
...@@ -29,10 +29,13 @@ module.exports = { ...@@ -29,10 +29,13 @@ module.exports = {
//接口类型 //接口类型
"interface_type": { "bd": "本地", "yc": "远程" }, "interface_type": { "bd": "本地", "yc": "远程" },
//操作类型 //操作类型
"op_type": { "addOrder": "添加订单", "pushOrder": "推送订单", "pushUpdateOrder": "推送修改订单", "pushUpdateOrderContacts": "推送修改订单联系人", "op_type": {
"pushOrderBusiness": "推送订单商机", "pushOrderRefund": "推送订单退款", "pushNeedBusiness": "推送需求商机", "pushNeedNote": "推送需求小计", "addOrder": "添加订单", "pushOrder": "推送订单", "pushUpdateOrder": "推送修改订单", "pushUpdateOrderContacts": "推送修改订单联系人",
"pushOrderBusiness": "推送订单商机", "pushOrderRefund": "推送订单退款", "pushNeedBusiness": "推送需求商机", "pushNeedNote": "推送需求小计",
"pushCloseNeed": "推送关闭需求", "pushNeedSolution": "推送需求方案", "pushCloseNeedSolution": "推送关闭需求方案", "pushOpSolution": "推送操作方案", "pushCloseNeed": "推送关闭需求", "pushNeedSolution": "推送需求方案", "pushCloseNeedSolution": "推送关闭需求方案", "pushOpSolution": "推送操作方案",
"createAliTmApply": "创建阿里商标申请", "closeAliTmApply": "主动关闭阿里商标申请"}, "createAliTmApply": "推送创建阿里商标申请", "closeAliTmApply": "推送主动关闭阿里商标申请", "bindAliTmApplicantGzwts": "推送绑定阿里商标申请人盖章委托书",
"updateAliTmApplicant": "推送更新阿里商标申请人信息"
},
//--------- //---------
"logLevel": { "debug": 0, "info": 1, "warn": 2, "error": 3, "fatal": 4 }, "logLevel": { "debug": 0, "info": 1, "warn": 2, "error": 3, "fatal": 4 },
......
...@@ -89,7 +89,7 @@ class utilsTlBankSve extends AppServiceBase { ...@@ -89,7 +89,7 @@ class utilsTlBankSve extends AppServiceBase {
return prestr; return prestr;
} }
async verifyAliPayReturnSign(pobj, actionBody) { async verifyAliPayReturnSign(actionBody) {
if (!actionBody.out_trade_no) { if (!actionBody.out_trade_no) {
return { status: -305, msg: "out_trade_no param can not be empty" }; return { status: -305, msg: "out_trade_no param can not be empty" };
} }
...@@ -97,7 +97,7 @@ class utilsTlBankSve extends AppServiceBase { ...@@ -97,7 +97,7 @@ class utilsTlBankSve extends AppServiceBase {
if (outTradeInfo.length < 2) { if (outTradeInfo.length < 2) {
return { status: -307, msg: "out_trade_no into is error" }; return { status: -307, msg: "out_trade_no into is error" };
} }
pobj.appInfo = { uapp_id: outTradeInfo[1] }; var pobj = { appInfo: { uapp_id: outTradeInfo[1] } };
var getSignStrResult = await this.getSortSignStr(actionBody); var getSignStrResult = await this.getSortSignStr(actionBody);
if (getSignStrResult.status != 0) { if (getSignStrResult.status != 0) {
return getSignStrResult; return getSignStrResult;
...@@ -110,8 +110,8 @@ class utilsTlBankSve extends AppServiceBase { ...@@ -110,8 +110,8 @@ class utilsTlBankSve extends AppServiceBase {
if (verifyResult) { if (verifyResult) {
return system.getResultSuccess({ return system.getResultSuccess({
orderNo: outTradeInfo[0], orderNo: outTradeInfo[0],
uappId: outTradeInfo[1], uappId: Number(outTradeInfo[1]),
productId: outTradeInfo.length == 3 ? outTradeInfo[2] : 0 productId: outTradeInfo.length == 3 ? Number(outTradeInfo[2]) : 0
}); });
} }
return system.getResult(null, "验签失败,verifyPayReturnSign"); return system.getResult(null, "验签失败,verifyPayReturnSign");
...@@ -124,13 +124,13 @@ class utilsTlBankSve extends AppServiceBase { ...@@ -124,13 +124,13 @@ class utilsTlBankSve extends AppServiceBase {
key.importKey(publicKey, 'pkcs8-public-pem');//导入密钥并设定格式 key.importKey(publicKey, 'pkcs8-public-pem');//导入密钥并设定格式
// const publicDer = key.exportKey('pkcs8-private'); // const publicDer = key.exportKey('pkcs8-private');
let signature = key.verify(Buffer.from(signParamStr), verifySignStr, sourceEncoding, signatureEncoding); let signature = key.verify(Buffer.from(signParamStr), verifySignStr, sourceEncoding, signatureEncoding);
// this.logCtl.info({ this.logCtl.info({
// appid: pobj.appInfo ? pobj.appInfo.uapp_id : "", appid: pobj.appInfo ? pobj.appInfo.uapp_id : "",
// appkey: pobj.appInfo ? pobj.appInfo.uapp_key : "", appkey: pobj.appInfo ? pobj.appInfo.uapp_key : "",
// op: "center-app/app/base/service/impl/utilsSve/utilsAlibankSve.js/getCreateAliSignStr", op: "center-app/app/base/service/impl/utilsSve/utilsAlibankSve.js/getVerifyPaySignStr",
// content: "参数:" + paramStr + "返回结果signStr:" + signature, content: "参数:" + signParamStr + "验证签名结果signStr:" + signature,
// optitle: "获取钉钉支付签名信息返回", optitle: "获取钉钉支付返回签名验证",
// }); });
return signature; return signature;
} }
......
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