Commit cef76931 by 任晓松

update

parent f4a14258
...@@ -34,53 +34,54 @@ class ExecClientNew { ...@@ -34,53 +34,54 @@ class ExecClientNew {
} }
} }
try { try {
if (settings.env === "localhost" || settings.env === "dev") { // if (settings.env === "localhost" || settings.env === "dev") {
var headers = { // var headers = {
'Content-type': 'application/json' // 'Content-type': 'application/json'
} // }
if (headData) { // if (headData) {
var headDataKeys = Object.keys(headData); // var headDataKeys = Object.keys(headData);
if (headDataKeys.length > 0) { // if (headDataKeys.length > 0) {
for (let index = 0; index < headDataKeys.length; index++) { // for (let index = 0; index < headDataKeys.length; index++) {
const indexKey = headDataKeys[index]; // const indexKey = headDataKeys[index];
var headValue = headData[indexKey]; // var headValue = headData[indexKey];
if (indexKey && headValue) { // if (indexKey && headValue) {
headers[indexKey] = headValue; // headers[indexKey] = headValue;
} // }
} // }
} // }
} // }
axios.default.timeout = timeOut; // axios.default.timeout = timeOut;
let result = await axios({ // let result = await axios({
// headers: {'Content-Type': 'application/x-www-form-urlencoded'}, // // headers: {'Content-Type': 'application/x-www-form-urlencoded'},
headers: headers, // headers: headers,
method: 'POST', // method: 'POST',
url: url, // url: url,
data: JSON.stringify(params) // data: JSON.stringify(params)
}); // });
if (result.status == 200) { // if (result.status == 200) {
reqResult = system.getResultSuccess(result.data); // reqResult = system.getResultSuccess(result.data);
//
} else { // } else {
reqResult = system.getResult(null, "执行execPostTimeOutByBusiness存在错误"); // reqResult = system.getResult(null, "执行execPostTimeOutByBusiness存在错误");
} // }
reqResult.requestId = requestId || uuid.v1(); // reqResult.requestId = requestId || uuid.v1();
if (result.headers) { // if (result.headers) {
delete result["headers"]; // delete result["headers"];
} // }
if (result.request) { // if (result.request) {
delete result["request"]; // delete result["request"];
} // }
if (result.config) { // if (result.config) {
delete result["config"]; // delete result["config"];
} // }
params.reqUrl = url; // params.reqUrl = url;
this.execLogs(execFile + "执行execPostTimeOutByBusiness,errorInfo信息为请求的返回结果", params, params.identifyCode, reqResult, result); // this.execLogs(execFile + "执行execPostTimeOutByBusiness,errorInfo信息为请求的返回结果", params, params.identifyCode, reqResult, result);
return reqResult; // return reqResult;
} // }
//方式二 //方式二
rtn = await this.execPostTimeOut(params, url, ContentType, headData, timeOut); rtn = await this.execPostTimeOut(params, url, ContentType, headData, timeOut);
params.reqUrl = url; params.reqUrl = url;
console.log(result,'----------------')
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
this.execLogs(execFile + "执行execPostTimeOutByBusiness返回的数据为空", params, params.identifyCode, null, null); this.execLogs(execFile + "执行execPostTimeOutByBusiness返回的数据为空", params, params.identifyCode, null, null);
reqResult = system.getResult(null, "execPostTimeOut data is empty"); reqResult = system.getResult(null, "execPostTimeOut data is empty");
......
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