Commit b7761f60 by 宋毅

tj

parent fb7f0af6
......@@ -5,6 +5,7 @@ const uuidv4 = require('uuid/v4');
const md5 = require("MD5");
class APIBase {
constructor() {
this.execClientNew = system.getObject("util.execClientNew");
this.logCtl = system.getObject("service.common.oplogSve");
this.exTime = 2 * 3600;//缓存过期时间,2小时
}
......@@ -44,20 +45,24 @@ class APIBase {
isPassResult.requestId = "";
return isPassResult;
}
var rtn = await this[methodname](pobj, query, req);
var result = await this[methodname](pobj, query, req);
if (!result.requestId) {
result.requestId = pobj.RequestId ? pobj.RequestId : pobj.requestId || req.requestId;
}
this.logCtl.createDb({
appid: pobj.appInfo ? pobj.appInfo.uapp_id : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key : "",
requestId: req.requestId,
op: req.classname + "/" + methodname,
content: JSON.stringify(pobj),
resultInfo: JSON.stringify(rtn),
resultInfo: JSON.stringify(result),
clientIp: req.clientIp,
agent: req.uagent,
opTitle: "api服务提供方appKey:" + settings.appKey,
});
rtn.requestId = req.requestId;
return rtn;
var tmpResult = pobj.actionType && pobj.actionType.indexOf("List") < 0 ? result : { status: result.status, message: result.message, requestId: result.requestId };
this.execClientNew.execLogs("center-order-doexecMethod-reqPath:" + req.path, pobj, "center-order-doexecMethod", tmpResult, null);
return result;
} catch (e) {
console.log(e.stack, "api调用出现异常,请联系管理员..........")
this.logCtl.createDb({
......@@ -71,16 +76,17 @@ class APIBase {
agent: req.uagent,
opTitle: "api调用出现异常,请联系管理员error,appKey:" + settings.appKey,
});
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key : "",
requestId: req.requestId,
op: req.classname + "/" + methodname,
content: e.stack,
clientIp: pobj.clientIp,
agent: req.uagent,
optitle: "api调用出现异常,请联系管理员",
});
// this.logCtl.error({
// appid: pobj.appInfo ? pobj.appInfo.uapp_id : "",
// appkey: pobj.appInfo ? pobj.appInfo.uapp_key : "",
// requestId: req.requestId,
// op: req.classname + "/" + methodname,
// content: e.stack,
// clientIp: pobj.clientIp,
// agent: req.uagent,
// optitle: "api调用出现异常,请联系管理员",
// });
this.execClientNew.execLogs("center-order-doexecMethod-reqPath异常:" + req.path, pobj, "center-channel-doexecMethod", tmpResult, null);
var rtnerror = system.getResultFail(-200, "出现异常,error:" + e.stack);
rtnerror.requestId = req.requestId;
return rtnerror;
......
......@@ -20,6 +20,13 @@ var settings = {
usertimeout: 3600,//单位秒
basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 4011,
//记录日志地址
opNewLogUrl() {
if (this.env == 'dev') {
return "http://43.247.184.94:7200/center_order_req_log/_doc?pretty";
}
return "http://43.247.184.94:7200/center_order_req_log/_doc?pretty";
},
reqTransferurl: function () {
if (this.env == "dev") {
return "http://192.168.18.61:3003/";
......@@ -42,15 +49,15 @@ var settings = {
return "http://gsb.qifu.gongsibao.com:4012/";
}
},
push360Url:function(){
if(this.env == 'dev'){
push360Url: function () {
if (this.env == 'dev') {
return "http://180.163.239.98:38086/";
} else {
return "http://180.163.239.98:38086/";
}
},
auth360Url:function(){
if(this.env == 'dev'){
auth360Url: function () {
if (this.env == 'dev') {
return "https://oauth2.e.360.cn/site/token";
} else {
return "https://oauth2.e.360.cn/site/token";
......@@ -64,7 +71,7 @@ var settings = {
return 1;
},
},
homePage: function () {
if (this.env == "dev") {
var localsettings = require("./localsettings");
......@@ -114,8 +121,8 @@ var settings = {
};
}
},
addArr: function() {
return ["南海诸岛", "北京", "天津", "上海", "重庆", "河北", "河南", "云南", "辽宁", "黑龙江", "湖南", "安徽", "山东", "新疆", "江苏", "浙江", "江西", "湖北", "广西", "甘肃", "山西", "内蒙古", "陕西", "吉林", "福建", "贵州", "广东", "青海", "西藏", "四川", "宁夏", "海南", "台湾", "香港", "澳门"]
addArr: function () {
return ["南海诸岛", "北京", "天津", "上海", "重庆", "河北", "河南", "云南", "辽宁", "黑龙江", "湖南", "安徽", "山东", "新疆", "江苏", "浙江", "江西", "湖北", "广西", "甘肃", "山西", "内蒙古", "陕西", "吉林", "福建", "贵州", "广东", "青海", "西藏", "四川", "宁夏", "海南", "台湾", "香港", "澳门"]
}
};
module.exports = settings;
......@@ -15,6 +15,7 @@
"after": "^0.8.2",
"ali-oss": "^4.12.2",
"aliyun-api-gateway": "^1.1.6",
"axios": "^0.21.0",
"babel-polyfill": "^6.26.0",
"base64id": "^1.0.0",
"bluebird": "^3.5.1",
......@@ -57,4 +58,4 @@
"element-theme": "^2.0.1",
"element-theme-chalk": "^2.4.0"
}
}
\ No newline at end of file
}
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