Commit f4b6bb32 by 宋毅

tj

parent b1072334
...@@ -5,6 +5,7 @@ class ProductAPI extends APIBase { ...@@ -5,6 +5,7 @@ class ProductAPI extends APIBase {
constructor() { constructor() {
super(); super();
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve"); this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
} }
/** /**
* 接口跳转-POST请求 * 接口跳转-POST请求
...@@ -27,8 +28,7 @@ class ProductAPI extends APIBase { ...@@ -27,8 +28,7 @@ class ProductAPI extends APIBase {
switch (action_type) { switch (action_type) {
case "addOrder"://创建订单 case "addOrder"://创建订单
opResult = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody); opResult = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody);
await this.pushInfo(opResult, pobj, pobj.actionBody, "pushBusiness"); await this.utilsPushSve.pushInfo(opResult, pobj, pobj.actionBody, "pushBusiness");
await this.pushInfo(opResult, pobj, pobj.actionBody, "pushOrder");
break; break;
case "getOrderInfo"://获取订单列表信息 case "getOrderInfo"://获取订单列表信息
opResult = await this.utilsOrderSve.getOrderInfo(pobj, pobj.actionBody); opResult = await this.utilsOrderSve.getOrderInfo(pobj, pobj.actionBody);
...@@ -48,44 +48,6 @@ class ProductAPI extends APIBase { ...@@ -48,44 +48,6 @@ class ProductAPI extends APIBase {
} }
return opResult; return opResult;
} }
async pushInfo(orderResult, pobj, actionBody, opType) {
if (orderResult.status != 0) {
return "";
}
var interface_list = actionBody.product_info.interface_info;
if (!interface_list) {
return "";
}
var interface_info = null;
var interface_list_temp = interface_list.filter(f => f.op_type == opType)
if (interface_list_temp && interface_list_temp.length > 0) {
interface_info = interface_list_temp[0];
}
if (!interface_info) {
return "";
}
pobj.actionBody.add_order_info = orderResult.data;
var refOpResult = this.reflexAction(interface_info, pobj);
return refOpResult;
}
async reflexAction(interface_info, pobj) {
var refResult = null;
if (interface_info.interface_type == "bd") {
if (!interface_info.method_name) {
return system.getResult(null, "产品接口参数信息有误,20110");
}//操作的方法名称
var invokeObj = system.getObject(interface_info.interface_url);
if (!invokeObj[interface_info.method_name]) {
return system.getResult(null, "产品接口参数方法信息有误,20130");
}
pobj.interface_params = interface_info.params;
var params = [pobj];
refResult = await invokeObj[interface_info.method_name].apply(invokeObj, params);
}
else if (interface_info.interface_type == "yc") {
}
return refResult;
}
} }
module.exports = ProductAPI; module.exports = ProductAPI;
\ No newline at end of file
...@@ -24,7 +24,6 @@ class UtilsFqAliyunSve extends AppServiceBase { ...@@ -24,7 +24,6 @@ class UtilsFqAliyunSve extends AppServiceBase {
if (!interface_params_info || !interface_params_info.opUrl || !interface_params_info.key || !interface_params_info.secret) { if (!interface_params_info || !interface_params_info.opUrl || !interface_params_info.key || !interface_params_info.secret) {
return ""; return "";
} }
var url = "https://yunfuapi-dev.gongsibao.com" + pobj.interface_params;
var params = { var params = {
idempotentId: add_order_info.orderNo,// 是 业务 ID idempotentId: add_order_info.orderNo,// 是 业务 ID
idempotentSource: product_info.service_business_code,// 是 业务来源(ic_jdyun、ic_ali) idempotentSource: product_info.service_business_code,// 是 业务来源(ic_jdyun、ic_ali)
......
...@@ -106,8 +106,7 @@ class UtilsOrderService extends AppServiceBase { ...@@ -106,8 +106,7 @@ class UtilsOrderService extends AppServiceBase {
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
return result; return result;
} }
/** /**
* 获取H5支付地址 * 获取H5支付地址
* @param {*} pobj * @param {*} pobj
......
const system = require("../../../system");
var settings = require("../../../../config/settings");
const querystring = require('querystring');
const AppServiceBase = require("../../app.base");
class UtilsPushService extends AppServiceBase {
constructor() {
super();
};
async pushInfo(orderResult, pobj, actionBody, opType) {
if (orderResult.status != 0) {
return "";
}
var interface_list = actionBody.product_info.interface_info;
if (!interface_list) {
return "";
}
var interface_info = null;
var interface_list_temp = interface_list.filter(f => f.op_type == opType)
if (interface_list_temp && interface_list_temp.length > 0) {
interface_info = interface_list_temp[0];
}
if (!interface_info) {
return "";
}
pobj.actionBody.add_order_info = orderResult.data;
var refOpResult = this.reflexAction(interface_info, pobj);
return refOpResult;
}
async reflexAction(interface_info, pobj) {
var refResult = null;
if (interface_info.interface_type == "bd") {
if (!interface_info.method_name) {
return system.getResult(null, "产品接口参数信息有误,20110");
}//操作的方法名称
var invokeObj = system.getObject(interface_info.interface_url);
if (!invokeObj[interface_info.method_name]) {
return system.getResult(null, "产品接口参数方法信息有误,20130");
}
pobj.interface_params = interface_info.params;
var params = [pobj];
refResult = await invokeObj[interface_info.method_name].apply(invokeObj, params);
}
else if (interface_info.interface_type == "yc") {
}
return refResult;
}
}
module.exports = UtilsPushService;
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