Commit 7f2e4488 by 宋毅

渠道增加

parent b81c3486
......@@ -147,7 +147,7 @@ class TmqueryService {
* 请求es 拿出数据,组装
*/
let failOrders = [];
var self=this;
var self = this;
try {
const data = await this.execClient.execPostTimeOut({
"query": {
......@@ -221,7 +221,7 @@ class TmqueryService {
}//工商产品订单
let reqUrl = self.channelApiUrl + "/action/tmOrder/springBoard";
let rtn = await self.execClient.execPushDataPost(param, reqUrl, tokenInfo.data.token, req.headers["request-id"]);
let rtn = await self.execClient.execPushDataPost(param, reqUrl, tokenInfo.data.token, req.headers["request-id"], 10000);
self.execClientNew.execLogs("igirl-channel-pushJdPayOrder-去重后的数据处理结果", param, "igirl-channel-pushJdPayOrder", rtn, null);
if (!rtn || !rtn.stdout) {
failOrders.push(
......@@ -249,8 +249,8 @@ class TmqueryService {
return {successOrders: buildResult, failOrders};
} catch (error) {
const stackStr = error.stack ? error.stack : JSON.stringify(error);
console.log(stackStr,"pushJdPayOrder.................error")
self.execClientNew.execLogs("igirl-channel-pushJdPayOrder-error", queryobj, "igirl-channel-pushJdPayOrder", rtn, null);
console.log(stackStr, "pushJdPayOrder.................error")
self.execClientNew.execLogs("igirl-channel-pushJdPayOrder-error", queryobj, "igirl-channel-pushJdPayOrder", null, stackStr);
return system.getResultFail(-200, "操作error");
}
}
......
......@@ -25,6 +25,13 @@ class ExecClient {
return {stdout, stderr};
}
async newExec(cmd) {
//await后面表达式返回的promise对象,是then的语法糖,await返回then函数的返回值
//异常需要try/catch自己捕获或外部catch捕获
const {stdout, stderr} = await exec(cmd, options);
return {stdout, stderr};
}
async exec2(cmd) {
return exec(cmd, {encoding: "base64"});
......@@ -34,7 +41,7 @@ class ExecClient {
var data = JSON.stringify(subData);
var cmd = this.cmdPostPattern.replace(/\{data\}/g,
data).replace(/\{url\}/g, url);
console.log(cmd,"cmd......................................");
console.log(cmd, "cmd......................................");
return cmd;
}
......@@ -73,15 +80,19 @@ class ExecClient {
let cmd = this.FetchPostCmd(params, url);
let options = {
timeout: timeOut,
maxBuffer: 1024 * 1024 * 50
maxBuffer: 1024 * 1024 * 10000
};
let result = await this.exec(cmd, options);
let result = await this.newExec(cmd, options);
return result;
}
async execPushDataPost(subData, url, token, requestId) {
async execPushDataPost(subData, url, token, requestId, timeOut = 5000) {
let cmd = this.FetchPushDataPostCmd(subData, url, token, requestId);
var result = await this.exec(cmd);
let options = {
timeout: timeOut,
maxBuffer: 1024 * 1024 * 10000
};
var result = await this.newExec(cmd, options);
return result;
}
......
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