Commit d05ffb6b by 宋毅

tj

parent 8f0a9dff
...@@ -27,6 +27,8 @@ class ProductDao extends Dao { ...@@ -27,6 +27,8 @@ class ProductDao extends Dao {
"product_desc", "product_desc",
"desc_url", "desc_url",
"icon_url", "icon_url",
"pay_after_jump_h5url",
"pay_after_jump_pcurl",
"productType_id"], "productType_id"],
raw: true raw: true
}); });
......
...@@ -17,6 +17,8 @@ module.exports = (db, DataTypes) => { ...@@ -17,6 +17,8 @@ module.exports = (db, DataTypes) => {
channel_item_name: DataTypes.STRING(100), channel_item_name: DataTypes.STRING(100),
service_business_code: DataTypes.STRING(100), service_business_code: DataTypes.STRING(100),
service_business_name: DataTypes.STRING(100), service_business_name: DataTypes.STRING(100),
pay_after_jump_h5url: DataTypes.STRING(500),
pay_after_jump_pcurl: DataTypes.STRING(500),
is_enabled: { //状态 0禁用 1启用 is_enabled: { //状态 0禁用 1启用
type: DataTypes.BOOLEAN, type: DataTypes.BOOLEAN,
defaultValue: true, defaultValue: true,
......
...@@ -7,7 +7,7 @@ class utilsTlBankSve { ...@@ -7,7 +7,7 @@ class utilsTlBankSve {
this.logCtl = system.getObject("service.common.oplogSve"); this.logCtl = system.getObject("service.common.oplogSve");
this.wxMethod = "W01";//微信订单支付 this.wxMethod = "W01";//微信订单支付
this.aliMethod = "A01";//阿里订单支付 this.aliMethod = "A01";//阿里订单支付
this.notifyUrl = "https://igirl.gongsibao.com/api/tl/zxNotify"; this.notifyUrl = "https://igirl.gongsibao.com/api/tl/zxNotify";//通联后台配置,H5则不需要配置,H5可自定义传递通知Url
this.restClient = system.getObject("util.restClient"); this.restClient = system.getObject("util.restClient");
this.appDao = system.getObject("db.dbapp.appDao"); this.appDao = system.getObject("db.dbapp.appDao");
this.apppayparamDao = system.getObject("db.dbapp.apppayparamDao"); this.apppayparamDao = system.getObject("db.dbapp.apppayparamDao");
...@@ -16,11 +16,17 @@ class utilsTlBankSve { ...@@ -16,11 +16,17 @@ class utilsTlBankSve {
async getPayParamItem(uappId) { async getPayParamItem(uappId) {
var item = await this.apppayparamDao.getItemByUAppId(uappId); var item = await this.apppayparamDao.getItemByUAppId(uappId);
if (!item) {
return system.getResult(null, "应用支付参数为空");
}
return system.getResultSuccess(item); return system.getResultSuccess(item);
} }
async getAppItem(uappId) { async getAppItem(uappId) {
var item = await this.appDao.getItemByUAppId(uappId); var item = await this.appDao.getItemByUAppId(uappId);
if (!item) {
return system.getResult(null, "应用数据为空");
}
return system.getResultSuccess(item); return system.getResultSuccess(item);
} }
//-------------------------------------------h5支付-----------------开始 //-------------------------------------------h5支付-----------------开始
...@@ -45,10 +51,10 @@ class utilsTlBankSve { ...@@ -45,10 +51,10 @@ class utilsTlBankSve {
cusid: payParam.mch_id, cusid: payParam.mch_id,
version: 12, version: 12,
trxamt: pobj.actionBody.total_fee,//单位为分 trxamt: pobj.actionBody.total_fee,//单位为分
reqsn: pobj.actionBody.order_num,// "qft" + order_num + "_" + uapp_id.toString(), reqsn: "qft" + pobj.actionBody.order_num + "_" + pobj.appInfo.uapp_id,
charset: "UTF-8", charset: "UTF-8",
returl: pobj.actionBody.returl, returl: pobj.actionBody.returl,
notify_url: pobj.actionBody.returl, notify_url: payParam.notify_url || pobj.actionBody.returl,
body: pobj.actionBody.body_desc, body: pobj.actionBody.body_desc,
remark: "h5paypagesywdy", remark: "h5paypagesywdy",
randomstr: timestamp.toString()//随机字符串,不长于32位 randomstr: timestamp.toString()//随机字符串,不长于32位
...@@ -299,14 +305,13 @@ class utilsTlBankSve { ...@@ -299,14 +305,13 @@ class utilsTlBankSve {
return result; return result;
} }
async receiveCallBackNotify(parmas, client_ip) {//收到通联回调通知---post请求 async receiveCallBackNotify(parmas, client_ip) {//收到通联回调通知---post请求
try { try {
if (!parmas) { if (!parmas) {
return system.getResult(null, "回调parmas中参数信息为空"); return system.getResult(null, "回调parmas中参数信息为空");
} }
//日志记录 //日志记录
logCtl.info({ this.logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + ":,method=" + parmas.trxcode, optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + ":,method=" + parmas.trxcode,
op: "center-app/app/base/service/impl/utilsSve/utilstlbankSve.js/receiveCallBackNotify", op: "center-app/app/base/service/impl/utilsSve/utilstlbankSve.js/receiveCallBackNotify",
content: JSON.stringify(parmas), content: JSON.stringify(parmas),
...@@ -314,8 +319,7 @@ class utilsTlBankSve { ...@@ -314,8 +319,7 @@ class utilsTlBankSve {
}); });
var isVerify = await this.verifyCallBackParams(parmas); var isVerify = await this.verifyCallBackParams(parmas);
if (isVerify) { if (isVerify) {
result.msg = isVerify; return system.getResult(null, isVerify);
return result;
} }
let attachList = []; let attachList = [];
if (parmas.cusorderid.indexOf("_") >= 0) { if (parmas.cusorderid.indexOf("_") >= 0) {
...@@ -336,7 +340,7 @@ class utilsTlBankSve { ...@@ -336,7 +340,7 @@ class utilsTlBankSve {
if (!payParam.notify_url) { if (!payParam.notify_url) {
return system.getResult(null, "app_pay_param回调应用没有对应的支付成功通知url配置"); return system.getResult(null, "app_pay_param回调应用没有对应的支付成功通知url配置");
} }
var appinfo =await this.appDao.getItemByUAppId(uappid); var appinfo = await this.appDao.getItemByUAppId(uappid);
if (!appinfo) { if (!appinfo) {
return system.getResult(null, "app回调应用没有对应的支付凭证"); return system.getResult(null, "app回调应用没有对应的支付凭证");
} }
...@@ -355,10 +359,10 @@ class utilsTlBankSve { ...@@ -355,10 +359,10 @@ class utilsTlBankSve {
} }
return system.getResultSuccess(); return system.getResultSuccess();
} catch (e) { } catch (e) {
logCtl.error({ this.logCtl.error({
optitle: "回调业务处理---error异常", optitle: "回调业务处理---error异常",
op: "center-app/app/base/service/impl/utilsSve/utilstlbankSve.js/receiveCallBackNotify", op: "center-app/app/base/service/impl/utilsSve/utilstlbankSve.js/receiveCallBackNotify",
content: "参数=" + JSON.stringify(parmas), content: "参数=" + JSON.stringify(parmas) + ",error异常:" + e.stack,
clientIp: client_ip || "" clientIp: client_ip || ""
}); });
return system.getResult(null, "回调业务处理---error异常"); return system.getResult(null, "回调业务处理---error异常");
...@@ -380,45 +384,5 @@ class utilsTlBankSve { ...@@ -380,45 +384,5 @@ class utilsTlBankSve {
} }
return ""; return "";
} }
async opBackNotify(getParams, opDesc) {//操作回调业务逻辑__暂时没有用到
try {
// //日志记录
// logCtl.info({
// optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + ":支付回调信息=====" + opDesc + ",method=" + getParams.trxcode,
// op: "base/service/impl/utilszxbankSve.js/opBackNotify",
// content: JSON.stringify(getParams),
// clientIp: getParams.client_ip || ""
// });
//获取充值业务锁
var locker = await cacheManager["ZxPayLocker"].enter(getParams.trxid);
if (locker && locker == "1") {
if (getParams.trxcode == "VSP501") {
getParams.req_accountType = "wx";
} else {
getParams.req_accountType = "alipay";
}
// if (getParams.method == "VSP511") {
// getParams.req_accountType="alipay";
// }
return await this.notifyOpDb(getParams);
}
else {
// await cacheManager["ZxPayLocker"].release(getParams.trxid);//---测试时放开
// logCtl.info({
// optitle: "通联回调操作频繁---太频繁了,太频繁了",
// op: "/app/config/routes/api.js",
// content: "参数=" + JSON.stringify(getParams),
// clientIp: getParams.client_ip || ""
// });
return { status: -510, msg: "中信回调操作频繁---太频繁了,太频繁了" };
}
} catch (e) {
await cacheManager["ZxPayLocker"].release(getParams.trxid);
throw new Error(e.stack);
}
}
} }
module.exports = utilsTlBankSve; module.exports = utilsTlBankSve;
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