Commit cdfa49d6 by 蒋勇

Merge branch 'igirl-web' of gitlab.gongsibao.com:jiangyong/zhichan into igirl-web

parents 08450e97 a1b54499
...@@ -9,6 +9,7 @@ var moment = require('moment'); ...@@ -9,6 +9,7 @@ var moment = require('moment');
const md5 = require("MD5"); const md5 = require("MD5");
class TestApi { class TestApi {
constructor() { constructor() {
this.utilstlbankSve = System.getObject("service.utilstlbankSve");
this.bytmmonitSve = System.getObject("service.bytmmonitSve"); this.bytmmonitSve = System.getObject("service.bytmmonitSve");
this.utilscloudSve = System.getObject("service.utilscloudSve"); this.utilscloudSve = System.getObject("service.utilscloudSve");
this.trademarkSve = System.getObject("service.trademarkSve"); this.trademarkSve = System.getObject("service.trademarkSve");
...@@ -40,15 +41,17 @@ class TestApi { ...@@ -40,15 +41,17 @@ class TestApi {
return y + "-" + m.substring(m.length - 2, m.length) + "-" + d.substring(d.length - 2, d.length); return y + "-" + m.substring(m.length - 2, m.length) + "-" + d.substring(d.length - 2, d.length);
} }
async test(obj) { async test(obj) {
// try { try {
var result= await this.utilstlbankSve.getH5Url();
// var result = await this.businesscompanySve.recycleBusiness(); // var result = await this.businesscompanySve.recycleBusiness();
// // var result = await this.businesscompanySve.freeClaimOperation({ id: 41, company_id: 4 }, "xz", [1095, 1113]); // var result = await this.businesscompanySve.freeClaimOperation({ id: 41, company_id: 4 }, "xz", [1095, 1113]);
// // var result = await this.businesscompanySve.protectBus({ id: 41, company_id: 4 }, "xz", ["RL20190429114493kNw4", "RL2019042911449mftfK"]); // var result = await this.businesscompanySve.protectBus({ id: 41, company_id: 4 }, "xz", ["RL20190429114493kNw4", "RL2019042911449mftfK"]);
// console.log(result, "result.................."); console.log(result, "result..................");
// return result; return result;
// } catch (e) { } catch (e) {
// console.log(e.stack, "e......................."); console.log(e.stack, "e.......................");
// } }
} }
async callSign() { async callSign() {
var tmpSignObj = { var tmpSignObj = {
......
...@@ -10,6 +10,16 @@ const md5 = require("MD5"); ...@@ -10,6 +10,16 @@ const md5 = require("MD5");
class TlApi { class TlApi {
constructor() { constructor() {
this.tlorderSve = System.getObject("service.tlorderSve"); this.tlorderSve = System.getObject("service.tlorderSve");
this.utilstlbankSve = System.getObject("service.utilstlbankSve");
}
async getH5PayUrl(pobj) {
try {
var result = await this.utilstlbankSve.getH5Url(pobj.company_id,pobj.pay_title,pobj.total_sum,pobj.order_no,pobj.returl);
console.log(result, "result..................");
return result;
} catch (e) {
console.log(e.stack, "e.......................");
}
} }
async getQrCodeInfo(obj) { async getQrCodeInfo(obj) {
try { try {
......
...@@ -28,6 +28,52 @@ class utilsTlBankSve { ...@@ -28,6 +28,52 @@ class utilsTlBankSve {
this.tlorderDao = System.getObject("db.tlorderDao"); this.tlorderDao = System.getObject("db.tlorderDao");
} }
//-------------------------------------------h5支付-----------------开始
/**
* 唤起H5支付---只供简单应用
* @param {*} company_id 公司ID
* @param {*} pay_title 支付显示标题
* @param {*} total_sum 支付金额
* @param {*} order_no 订单号
* @param {*} returl 支付成功后返回的url
*/
async getH5Url(company_id, pay_title, total_sum, order_no, returl) {
// appid:00000003,商户号(mch_id):990440148166000,md5key(pay_key):a0ea3fa20dbd7bb4d5abf1d59d63bae8
var payParam = await this.companypayparamDao.getOneByCompanyId(company_id, 1);
if (!payParam) {
return { code: -210, msg: "公司没有对应的支付凭证" }
}
var timestamp = Date.now();
var jsonObj = {
appid: payParam.pay_appid,
cusid: payParam.mch_id,
version: 12,
trxamt: total_sum,//单位为分
reqsn: order_no,//order_num + "_" + company_id.toString(),
charset: "UTF-8",
returl: returl,
notify_url: payParam.notifyUrl || this.notifyUrl,
body: pay_title,
remark: "h5paypagesywdy",
randomstr: timestamp.toString()//随机字符串,不长于32位
}
var param_result = await this.getReqBeforeParam(jsonObj, "1352105537612345789");
if (param_result.code != 1) {
return param_result;
}
var paramStr = Object.keys(jsonObj).sort().map(key => {
return `${encodeURIComponent(key)}=${encodeURIComponent(jsonObj[key])}`
}).join('&');
return { code: 1, payUrl: "https://syb.allinpay.com/apiweb/h5unionpay/unionorder?" + paramStr };
}
//-------------------------------------------h5支付-----------------结束
//----------------------------------------------------------------------------------------请求银行接口开始--------------------------------------------------- //----------------------------------------------------------------------------------------请求银行接口开始---------------------------------------------------
/* /*
......
...@@ -28,11 +28,14 @@ module.exports = function (app) { ...@@ -28,11 +28,14 @@ module.exports = function (app) {
app.use("/api/tl/zxNotify", async function (req, res, next) { app.use("/api/tl/zxNotify", async function (req, res, next) {
var client_ip = System.get_client_ip(req); var client_ip = System.get_client_ip(req);
if (req.body.remark && req.body.remark== "h5paypagesywdy"){
res.end("");
}
var result = await utilstlbankSve.receiveCallBackNotify(req.body, client_ip); var result = await utilstlbankSve.receiveCallBackNotify(req.body, client_ip);
res.end(result); res.end(result);
}); });
app.get('/api/:qname/:method', function (req, res) { app.get('/api/:qname/:method', function (req, res) {
var classPath = req.params["qname"]; var classPath = req.params["qname"];
var methodName = req.params["method"]; var methodName = req.params["method"];
var params = []; var params = [];
...@@ -52,8 +55,8 @@ module.exports = function (app) { ...@@ -52,8 +55,8 @@ module.exports = function (app) {
p.then(r => { p.then(r => {
res.end(JSON.stringify(r)); res.end(JSON.stringify(r));
}) })
}); });
app.post('/api/:qname/:method', function (req, res) { app.post('/api/:qname/:method', function (req, res) {
var classPath = req.params["qname"]; var classPath = req.params["qname"];
var methodName = req.params["method"]; var methodName = req.params["method"];
var params = []; var params = [];
...@@ -71,5 +74,5 @@ module.exports = function (app) { ...@@ -71,5 +74,5 @@ module.exports = function (app) {
}).then(() => { }).then(() => {
}); });
}); });
}; };
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