Commit 2ad4065d by 宋毅

tj

parent d0892f31
node_modules/ node_modules/
.idea
.history/
.vscode
\ No newline at end of file
...@@ -53,7 +53,7 @@ class APIBase { ...@@ -53,7 +53,7 @@ class APIBase {
await this.redisClient.setWithEx(shaStr, JSON.stringify(result), 3600); await this.redisClient.setWithEx(shaStr, JSON.stringify(result), 3600);
} }
var tmpResult = pobj.actionType && pobj.actionType.indexOf("List") < 0 ? result : { status: result.status, message: result.message, requestId: result.requestId }; var tmpResult = pobj.actionType && pobj.actionType.indexOf("List") < 0 ? result : { status: result.status, message: result.message, requestId: result.requestId };
this.execClientNew.execLogs("center-channel-doexecMethod-reqPath:" + req.path, pobj, "center-channel-doexecMethod", tmpResult, null); this.execClientNew.execLogs("api-center-channel-doexecMethod-reqPath:" + req.path, pobj, "center-channel-doexecMethod", tmpResult, null);
return result; return result;
} catch (e) { } catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e); const stackStr = e.stack ? e.stack : JSON.stringify(e);
......
var WEBBase = require("../../web.base"); var WEBBase = require("../../web.base");
var system = require("../../../system"); var system = require("../../../system");
var settings = require("../../../../config/settings"); var settings = require("../../../../config/settings");
class ProductAPI extends WEBBase { class ProductAPI extends WEBBase {
constructor() { constructor() {
super(); super();
this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve"); this.utilsOrderSve = system.getObject("service.utilsSve.utilsOrderSve");
} }
/** /**
* 接口跳转-POST请求 * 接口跳转-POST请求
* action_process 执行的流程 * action_process 执行的流程
* action_type 执行的类型 * action_type 执行的类型
* action_body 执行的参数 * action_body 执行的参数
*/ */
async springBoard(pobj, qobj, req) { async springBoard(pobj, qobj, req) {
if (!pobj.actionProcess) { if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空"); return system.getResult(null, "actionProcess参数不能为空");
...@@ -22,15 +24,19 @@ class ProductAPI extends WEBBase { ...@@ -22,15 +24,19 @@ class ProductAPI extends WEBBase {
var result = await this.opActionProcess(pobj, pobj.actionType, req); var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result; return result;
} }
async opActionProcess(pobj, action_type, req) { async opActionProcess(pobj, action_type, req) {
pobj.requestId = req.requestId; pobj.requestId = req.requestId;
var opResult = null; var opResult = null;
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);
//处理推送到峰擎
// opType:值为query、add
this.pushNewFq(pobj, opResult);
break; break;
case "addOrderWeb"://创建订单 官网 case "addOrderWeb"://创建订单 官网
opResult = await this.utilsOrderSve.addOrderWeb(pobj,pobj.actionBody); opResult = await this.utilsOrderSve.addOrderWeb(pobj, pobj.actionBody);
break; break;
case "getOrderInfo"://获取订单列表信息 case "getOrderInfo"://获取订单列表信息
opResult = await this.utilsOrderSve.getOrderInfo(pobj, pobj.actionBody); opResult = await this.utilsOrderSve.getOrderInfo(pobj, pobj.actionBody);
...@@ -69,22 +75,22 @@ class ProductAPI extends WEBBase { ...@@ -69,22 +75,22 @@ class ProductAPI extends WEBBase {
// opResult = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody); // opResult = await this.utilsOrderSve.addOrder(pobj, pobj.actionBody);
// break; // break;
case "addUsuallyContacts"://添加常用联系人、申请人 case "addUsuallyContacts"://添加常用联系人、申请人
opResult = await this.utilsOrderSve.addUsuallyContacts(pobj,pobj.actionBody); opResult = await this.utilsOrderSve.addUsuallyContacts(pobj, pobj.actionBody);
break; break;
case "delUsuallyContacts"://删除常用联系人、申请人 case "delUsuallyContacts"://删除常用联系人、申请人
opResult = await this.utilsOrderSve.delUsuallyContacts(pobj,pobj.actionBody); opResult = await this.utilsOrderSve.delUsuallyContacts(pobj, pobj.actionBody);
break; break;
case "updateUsuallyContacts"://修改常用联系人、申请人 case "updateUsuallyContacts"://修改常用联系人、申请人
opResult = await this.utilsOrderSve.updateUsuallyContacts(pobj,pobj.actionBody); opResult = await this.utilsOrderSve.updateUsuallyContacts(pobj, pobj.actionBody);
break; break;
case "getUsuallyContacts"://查询常用联系人、申请人 case "getUsuallyContacts"://查询常用联系人、申请人
opResult = await this.utilsOrderSve.getUsuallyContacts(pobj,pobj.actionBody); opResult = await this.utilsOrderSve.getUsuallyContacts(pobj, pobj.actionBody);
break; break;
case "importOrders": case "importOrders":
opResult = await this.utilsOrderSve.importOrders(pobj,req); opResult = await this.utilsOrderSve.importOrders(pobj, req);
break; break;
case "pushTest": case "pushTest":
opResult = await this.utilsOrderSve.pushTest(pobj,pobj.actionBody); opResult = await this.utilsOrderSve.pushTest(pobj, pobj.actionBody);
break; break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
...@@ -93,5 +99,18 @@ class ProductAPI extends WEBBase { ...@@ -93,5 +99,18 @@ class ProductAPI extends WEBBase {
return opResult; return opResult;
} }
async pushNewFq(pobj, result) {
if (result.status == 0 && result.data && result.data.channelOrderNo) {
try {
pobj.actionType = "getOrderInfoByChannelOrderNo";
pobj.actionBody.channelOrderNo = result.data.channelOrderNo;
await this.utilsOrderSve.pushNewFqByChannelOrderNo(pobj);
} catch (e) {
const stackStr = e.stack ? e.stack : JSON.stringify(e);
this.execClientNew.execLogs("pushNewFq异常:", pobj, "center-channel-pushNewFq", null, stackStr);
}
}
}
} }
module.exports = ProductAPI; module.exports = ProductAPI;
...@@ -38,7 +38,7 @@ class WEBBase { ...@@ -38,7 +38,7 @@ class WEBBase {
opTitle: "api服务提供方appKey:" + settings.appKey, opTitle: "api服务提供方appKey:" + settings.appKey,
}); });
var tmpResult = pobj.actionType && pobj.actionType.indexOf("List") < 0 ? result : { status: result.status, message: result.message, requestId: result.requestId }; var tmpResult = pobj.actionType && pobj.actionType.indexOf("List") < 0 ? result : { status: result.status, message: result.message, requestId: result.requestId };
this.execClientNew.execLogs("reqPath:" + req.path, pobj, "center-channel-doexecMethod-web", tmpResult, null); this.execClientNew.execLogs("web-center-channel--reqPath:" + req.path, pobj, "center-channel-doexecMethod-web", tmpResult, null);
return result; return result;
} catch (e) { } catch (e) {
console.log(e.stack, "api调用出现异常,请联系管理员..........") console.log(e.stack, "api调用出现异常,请联系管理员..........")
...@@ -53,16 +53,16 @@ class WEBBase { ...@@ -53,16 +53,16 @@ class WEBBase {
agent: req.uagent, agent: req.uagent,
opTitle: "api调用出现异常,请联系管理员error,appKey:" + settings.appKey, opTitle: "api调用出现异常,请联系管理员error,appKey:" + settings.appKey,
}); });
this.logCtl.error({ // this.logCtl.error({
appid: req.app.id, // appid: req.app.id,
appkey: req.app.uappKey, // appkey: req.app.uappKey,
requestId: req.requestId, // requestId: req.requestId,
op: req.classname + "/" + methodname, // op: req.classname + "/" + methodname,
content: e.stack, // content: e.stack,
clientIp: pobj.clientIp, // clientIp: pobj.clientIp,
agent: req.uagent, // agent: req.uagent,
optitle: "api调用出现异常,请联系管理员", // optitle: "api调用出现异常,请联系管理员",
}); // });
var rtnerror = system.getResultFail(-200, "出现异常,error:" + e.stack); var rtnerror = system.getResultFail(-200, "出现异常,error:" + e.stack);
rtnerror.requestId = req.requestId; rtnerror.requestId = req.requestId;
return rtnerror; return rtnerror;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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