Commit c9dc7756 by 王栋源

wdy

parent 4be57216
...@@ -50,9 +50,9 @@ class APIBase { ...@@ -50,9 +50,9 @@ class APIBase {
if (!result) { if (!result) {
result = system.getResult(null, "请求的方法返回值为空"); result = system.getResult(null, "请求的方法返回值为空");
} }
result.requestId = pobj.RequestId || uuid.v1();
var tmpResult = reqParams.actionType && reqParams.actionType.indexOf("List") < 0 ? result : { status: result.status, message: result.message, requestId: result.requestId }; var tmpResult = reqParams.actionType && reqParams.actionType.indexOf("List") < 0 ? result : { status: result.status, message: result.message, requestId: result.requestId };
this.execClient.execLogs("reqPath:" + req.path + "执行结果", reqParams, "brg-user-center-apibase", tmpResult, null); this.execClient.execLogs("reqPath:" + req.path + "执行结果", reqParams, "brg-user-center-apibase", tmpResult, null);
result.requestId = result.requestId || uuid.v1();
if (pobj.Action && action) { if (pobj.Action && action) {
result = await this.handleTxResult(result); result = await this.handleTxResult(result);
delete req.body["Action"]; delete req.body["Action"];
...@@ -61,9 +61,9 @@ class APIBase { ...@@ -61,9 +61,9 @@ class APIBase {
} catch (error) { } catch (error) {
var stackStr = error.stack ? error.stack : JSON.stringify(error); var stackStr = error.stack ? error.stack : JSON.stringify(error);
console.log(stackStr, "api调用出现异常,请联系管理员..........") console.log(stackStr, "api调用出现异常,请联系管理员..........")
var rtnerror = system.getResultFail(-200, "出现异常,error:" + stackStr); var rtnerror = system.getResultFail(-200, "系统出现异常");
rtnerror.requestId = uuid.v1(); rtnerror.requestId = pobj.RequestId || uuid.v1();
this.execClient.execLogs("reqPath:" + req.path + "执行异常", reqParams, "brg-user-center-apibase", null, stackStr); this.execClient.execLogs("reqPath:" + req.path + "执行异常", reqParams, "brg-user-center-apibase", rtnerror, stackStr);
if (pobj.Action && action) { if (pobj.Action && action) {
return { return {
"Response": { "Response": {
...@@ -194,14 +194,14 @@ class APIBase { ...@@ -194,14 +194,14 @@ class APIBase {
if (!result) { if (!result) {
result = system.getResult(null, "请求的方法返回值为空"); result = system.getResult(null, "请求的方法返回值为空");
} }
result.requestId = result.requestId || uuid.v1(); result.requestId = pobj.RequestId || uuid.v1();
this.execClient.execLogs("reqPath:" + req.path + "brg请求结果", param, "brg-user-center-brg-apibase", result, null); this.execClient.execLogs("reqPath:" + req.path + "brg请求结果", param, "brg-user-center-brg-apibase", result, null);
return result; return result;
} catch (error) { } catch (error) {
var stackStr = error.stack ? error.stack : JSON.stringify(error); var stackStr = error.stack ? error.stack : JSON.stringify(error);
console.log(stackStr, "api-brg请求调用出现异常,请联系管理员..........") console.log(stackStr, "api-brg请求调用出现异常,请联系管理员..........")
var rtnerror = system.getResultTX(-1, "", "brg请求出现异常,error:" + stackStr, null); var rtnerror = system.getResultTX(-1, "", "brg请求出现异常,error:" + stackStr, null);
rtnerror.requestId = uuid.v1(); rtnerror.requestId = pobj.RequestId || uuid.v1();
this.execClient.execLogs("reqPath:" + req.path + "brg请求出现异常", param, "brg-user-center-brg-apibase", null, stackStr); this.execClient.execLogs("reqPath:" + req.path + "brg请求出现异常", param, "brg-user-center-brg-apibase", null, stackStr);
return rtnerror; return rtnerror;
} }
...@@ -209,17 +209,18 @@ class APIBase { ...@@ -209,17 +209,18 @@ class APIBase {
/** /**
* 带超时时间的post请求 * 带超时时间的post请求
* @param {*} req 请求信息
* @param {*} params 请求数据-json格式 * @param {*} params 请求数据-json格式
* @param {*} url 请求地址 * @param {*} url 请求地址
* @param {*} ContentType 请求头类型,默认application/json * @param {*} ContentType 请求头类型,默认application/json
* @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"} * @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"}
* @param {*} timeOut 超时时间 * @param {*} timeOut 超时时间
*/ */
async execPostByTimeOut(params, url, ContentType, headData, timeOut = 60) { async execPostByTimeOut(req, params, url, ContentType, headData, timeOut = 60) {
return await this.execClient.execPostTimeOutByBusiness("api.base", params, url, ContentType, headData, timeOut); return await this.execClient.execPostTimeOutByBusiness("api.base", params, url, ContentType, headData, timeOut, req);
} }
/** /**
* 返回20位业务订单号 * 返回20位业务订单号
* @param {*} prefix 业务前缀 * @param {*} prefix 业务前缀
*/ */
......
...@@ -26,7 +26,7 @@ class icName extends APIBase { ...@@ -26,7 +26,7 @@ class icName extends APIBase {
opResult = system.getResultSuccess("测试接口"); opResult = system.getResultSuccess("测试接口");
break; break;
case "checkBusinessNameList"://工商核名 case "checkBusinessNameList"://工商核名
opResult = await this.utilsIcNameSve.checkBusinessNameList(pobj.actionBody); opResult = await this.utilsIcNameSve.checkBusinessNameList(pobj.actionBody, req);
break; break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
......
...@@ -24,7 +24,7 @@ class Need extends APIBase { ...@@ -24,7 +24,7 @@ class Need extends APIBase {
async opActionProcess(pobj, action_type, req) { async opActionProcess(pobj, action_type, req) {
var opResult = null; var opResult = null;
var verificationCodeList = [ var verificationCodeList = [
"needSubmit" "needSubmit"
]; ];
var self = this; var self = this;
if (verificationCodeList.indexOf(action_type) > -1) { if (verificationCodeList.indexOf(action_type) > -1) {
...@@ -47,13 +47,13 @@ class Need extends APIBase { ...@@ -47,13 +47,13 @@ class Need extends APIBase {
opResult = system.getResultSuccess("测试接口"); opResult = system.getResultSuccess("测试接口");
break; break;
case "needSubmit"://需求提交 case "needSubmit"://需求提交
opResult = await this.needinfoSve.needSubmit(pobj.actionBody); opResult = await this.needinfoSve.needSubmit(pobj.actionBody, req);
break; break;
case "needList"://需求列表 case "needList"://需求列表
opResult = await this.needinfoSve.needList(pobj.actionBody); opResult = await this.needinfoSve.needList(pobj.actionBody, req);
break; break;
case "needDetail"://需求详情 case "needDetail"://需求详情
opResult = await this.needinfoSve.needDetail(pobj.actionBody); opResult = await this.needinfoSve.needDetail(pobj.actionBody, req);
break; break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
......
...@@ -29,14 +29,14 @@ class Order extends APIBase { ...@@ -29,14 +29,14 @@ class Order extends APIBase {
async opActionProcess(pobj, action_type, req) { async opActionProcess(pobj, action_type, req) {
var opResult = null; var opResult = null;
var verificationCodeList = [ var verificationCodeList = [
"submitGoodsinfo" "submitGoodsinfo"
]; ];
var self = this; var self = this;
if (verificationCodeList.indexOf(action_type) > -1) { if (verificationCodeList.indexOf(action_type) > -1) {
if (!pobj.actionBody.Info) { if (!pobj.actionBody.Info) {
return system.getResultFail(-101, "Info is empty"); return system.getResultFail(-101, "Info is empty");
} }
pobj.actionBody.Info = JSON.parse(pobj.actionBody.Info); pobj.actionBody.Info = JSON.parse(pobj.actionBody.Info);
if (!pobj.actionBody.Info[0].formInfo.contactsPhone) { if (!pobj.actionBody.Info[0].formInfo.contactsPhone) {
opResult = system.getResult(null, "contactsPhone参数错误"); opResult = system.getResult(null, "contactsPhone参数错误");
return opResult; return opResult;
...@@ -54,46 +54,46 @@ class Order extends APIBase { ...@@ -54,46 +54,46 @@ class Order extends APIBase {
opResult = system.getResultSuccess("测试接口"); opResult = system.getResultSuccess("测试接口");
break; break;
case "getOrderDetail"://用户端查看订单详情 case "getOrderDetail"://用户端查看订单详情
opResult = await this.orderinfoSve.getOrderDetail(pobj); opResult = await this.orderinfoSve.getOrderDetail(pobj, req);
break; break;
case "getQcOrderList"://用户端查看资质证照订单列表 case "getQcOrderList"://用户端查看资质证照订单列表
opResult = await this.orderinfoSve.getQcOrderList(pobj); opResult = await this.orderinfoSve.getQcOrderList(pobj, req);
break; break;
case "getOrderList"://用户端获取订单列表 case "getOrderList"://用户端获取订单列表
opResult = await this.orderinfoSve.getOrderList(pobj); opResult = await this.orderinfoSve.getOrderList(pobj, req);
break; break;
case "getApplyListByUserAndType"://用户端获取申请主体列表 case "getApplyListByUserAndType"://用户端获取申请主体列表
opResult = await this.applyinfoSve.getApplyListByUserAndType(pobj); opResult = await this.applyinfoSve.getApplyListByUserAndType(pobj, req);
break; break;
case "getApplyAndSolutionInfo"://公司/个体户详情 case "getApplyAndSolutionInfo"://公司/个体户详情
opResult = await this.applyinfoSve.getApplyAndSolutionInfo(pobj); opResult = await this.applyinfoSve.getApplyAndSolutionInfo(pobj, req);
break; break;
case "selPrice2TX"://商城询价接口 case "selPrice2TX"://商城询价接口
opResult = await this.orderinfoSve.selPrice2TX(pobj); opResult = await this.orderinfoSve.selPrice2TX(pobj, req);
break; break;
case "submitGoodsinfo"://立即购买 case "submitGoodsinfo"://立即购买
opResult = await this.orderinfoSve.submitGoodsinfo(pobj); opResult = await this.orderinfoSve.submitGoodsinfo(pobj, req);
break; break;
case "getOverviewInfoByUser"://获取概览数据 case "getOverviewInfoByUser"://获取概览数据
opResult = await this.applyinfoSve.getOverviewInfoByUser(pobj); opResult = await this.applyinfoSve.getOverviewInfoByUser(pobj, req);
break; break;
case "getOrderListByStatus"://根据交付状态获取订单列表(概览数据待收文件->待收文件订单列表) case "getOrderListByStatus"://根据交付状态获取订单列表(概览数据待收文件->待收文件订单列表)
opResult = await this.orderdeliverySve.getOrderListByStatus(pobj); opResult = await this.orderdeliverySve.getOrderListByStatus(pobj, req);
break; break;
case "orderPayNotify"://发货回调 case "orderPayNotify"://发货回调
opResult = await this.orderinfoSve.orderPayNotify(pobj); opResult = await this.orderinfoSve.orderPayNotify(pobj, req);
break; break;
case "getQualificationCertificateListByUserAndType"://用户获取资质证照列表 case "getQualificationCertificateListByUserAndType"://用户获取资质证照列表
opResult = await this.qualificationCertificateSve.getQualificationCertificateListByUserAndType(pobj); opResult = await this.qualificationCertificateSve.getQualificationCertificateListByUserAndType(pobj, req);
break; break;
case "getQualificationCertificateDetail"://用户获取资质证照详情 case "getQualificationCertificateDetail"://用户获取资质证照详情
opResult = await this.qualificationCertificateSve.getQualificationCertificateDetail(pobj); opResult = await this.qualificationCertificateSve.getQualificationCertificateDetail(pobj, req);
break; break;
case "refundOrder"://退款接口 case "refundOrder"://退款接口
opResult = await this.orderinfoSve.refundOrder(pobj.actionBody); opResult = await this.orderinfoSve.refundOrder(pobj.actionBody, req);
break; break;
case "jftime"://计费时间修改 case "jftime"://计费时间修改
opResult = await this.orderinfoSve.jftime(pobj.actionBody); opResult = await this.orderinfoSve.jftime(pobj.actionBody, req);
break; break;
default: default:
opResult = system.getResult(null, "action_type参数错误"); opResult = system.getResult(null, "action_type参数错误");
......
...@@ -14,7 +14,7 @@ class Need extends APIBase { ...@@ -14,7 +14,7 @@ class Need extends APIBase {
*/ */
async springBoard(pobj, qobj, req) { async springBoard(pobj, qobj, req) {
if (!pobj.interface || !pobj.interface.interfaceName) { if (!pobj.interface || !pobj.interface.interfaceName) {
return system.getResultTX(-1,"","interfaceName参数不能为空",null); return system.getResultTX(-1, "", "interfaceName参数不能为空", null);
} }
var result = await this.opActionProcess(pobj, pobj.interface.interfaceName, req); var result = await this.opActionProcess(pobj, pobj.interface.interfaceName, req);
return result; return result;
...@@ -23,25 +23,25 @@ class Need extends APIBase { ...@@ -23,25 +23,25 @@ class Need extends APIBase {
var opResult = null; var opResult = null;
switch (action_type) { switch (action_type) {
case "qcloud.domain.checkCreate"://新购参数检查 case "qcloud.domain.checkCreate"://新购参数检查
opResult = await this.txPushLogSve.checkCreate(pobj); opResult = await this.txPushLogSve.checkCreate(pobj, req);
break; break;
case "qcloud.cbs.CreateCbsInstance"://支付回调 case "qcloud.cbs.CreateCbsInstance"://支付回调
opResult = await this.txPushLogSve.createCbsInstance(pobj); opResult = await this.txPushLogSve.createCbsInstance(pobj, req);
break; break;
case "qcloud.PRODUCT_NAME.queryFlow"://发货状态查询 case "qcloud.PRODUCT_NAME.queryFlow"://发货状态查询
opResult = await this.txPushLogSve.queryFlow(pobj); opResult = await this.txPushLogSve.queryFlow(pobj, req);
break; break;
case "qcloud.PRODUCT_NAME.isolateResource"://资源隔离 case "qcloud.PRODUCT_NAME.isolateResource"://资源隔离
opResult = await this.txPushLogSve.isolateResource(pobj); opResult = await this.txPushLogSve.isolateResource(pobj, req);
break; break;
case "qcloud.PRODUCT_NAME.queryResources"://资源拉取 case "qcloud.PRODUCT_NAME.queryResources"://资源拉取
opResult = await this.txPushLogSve.queryResources(pobj); opResult = await this.txPushLogSve.queryResources(pobj, req);
break; break;
case "qcloud.PRODUCT_NAME.destroyResource"://销毁资源 case "qcloud.PRODUCT_NAME.destroyResource"://销毁资源
opResult = await this.txPushLogSve.destroyResource(pobj); opResult = await this.txPushLogSve.destroyResource(pobj, req);
break; break;
default: default:
opResult = system.getResultTX(-1,"","未知方法名",null); opResult = system.getResultTX(-1, "", "未知方法名", null);
break; break;
} }
return opResult; return opResult;
......
...@@ -7,7 +7,7 @@ class NeedInfoDao extends Dao { ...@@ -7,7 +7,7 @@ class NeedInfoDao extends Dao {
//根据产品区域获取服务商详情 //根据产品区域获取服务商详情
async findServiceByProductType(obj) { async findServiceByProductType(obj) {
var sql = "select xsi.servicer_code,xsi.servicer_name,xsi.push_domain_addr from x_product xp join x_service_info xsi on xp.servicer_code=xsi.servicer_code " var sql = "select xsi.servicer_code,xsi.servicer_name,xsi.push_domain_addr,xsi.is_enabled is_enabled from x_product xp join x_service_info xsi on xp.servicer_code=xsi.servicer_code "
sql += "where xp.path_code=:path_code and xp.region_id=:region_id"; sql += "where xp.path_code=:path_code and xp.region_id=:region_id";
try { try {
var list = await this.customQuery(sql, obj); var list = await this.customQuery(sql, obj);
...@@ -16,6 +16,7 @@ class NeedInfoDao extends Dao { ...@@ -16,6 +16,7 @@ class NeedInfoDao extends Dao {
rtn.servicer_code = list[0].servicer_code; rtn.servicer_code = list[0].servicer_code;
rtn.servicer_name = list[0].servicer_name; rtn.servicer_name = list[0].servicer_name;
rtn.push_domain_addr = list[0].push_domain_addr; rtn.push_domain_addr = list[0].push_domain_addr;
rtn.is_enabled = list[0].is_enabled;
return system.getResultSuccess(rtn); return system.getResultSuccess(rtn);
} else { } else {
return system.getResultFail(-203, "servicer is empty"); return system.getResultFail(-203, "servicer is empty");
......
...@@ -122,8 +122,8 @@ class OrderInfoDao extends Dao{ ...@@ -122,8 +122,8 @@ class OrderInfoDao extends Dao{
} }
//获取产品详情 //获取产品详情
async selPrice2TX(obj) { async selPrice2TX(obj) {
var sql = "select xp.product_icon product_icon, xp.path_name path_name, xp.servicer_code servicer_code, xp.servicer_name servicer_name,xs.push_domain_addr push_domain_addr from x_product xp JOIN x_service_info xs ON xp.servicer_code=xs.servicer_code " var sql = "select xp.product_icon product_icon, xp.path_name path_name, xp.servicer_code servicer_code, xp.servicer_name servicer_name,xs.push_domain_addr push_domain_addr,xs.is_enabled is_enabled from x_product xp JOIN x_service_info xs ON xp.servicer_code=xs.servicer_code "
sql += "where path_code=:path_code and region_id=:region_id "; sql += "where xp.path_code=:path_code and xp.region_id=:region_id";
try { try {
var list = await this.customQuery(sql, obj); var list = await this.customQuery(sql, obj);
var rtn = {}; var rtn = {};
...@@ -133,6 +133,7 @@ class OrderInfoDao extends Dao{ ...@@ -133,6 +133,7 @@ class OrderInfoDao extends Dao{
rtn.servicer_code = list[0].servicer_code; rtn.servicer_code = list[0].servicer_code;
rtn.servicer_name = list[0].servicer_name; rtn.servicer_name = list[0].servicer_name;
rtn.push_domain_addr = list[0].push_domain_addr; rtn.push_domain_addr = list[0].push_domain_addr;
rtn.is_enabled = list[0].is_enabled;
return system.getResultSuccess(rtn); return system.getResultSuccess(rtn);
} else { } else {
return system.getResultFail(-203, "servicer is empty"); return system.getResultFail(-203, "servicer is empty");
......
...@@ -10,14 +10,15 @@ class AppServiceBase { ...@@ -10,14 +10,15 @@ class AppServiceBase {
} }
/** /**
* 带超时时间的post请求 * 带超时时间的post请求
* @param {*} req 请求信息
* @param {*} params 请求数据-json格式 * @param {*} params 请求数据-json格式
* @param {*} url 请求地址 * @param {*} url 请求地址
* @param {*} ContentType 请求头类型,默认application/json * @param {*} ContentType 请求头类型,默认application/json
* @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"} * @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"}
* @param {*} timeOut 超时时间 * @param {*} timeOut 超时时间
*/ */
async execPostByTimeOut(params, url, ContentType, headData, timeOut = 60) { async execPostByTimeOut(req, params, url, ContentType, headData, timeOut = 60) {
return await this.execClient.execPostTimeOutByBusiness("app.base", params, url, ContentType, headData, timeOut); return await this.execClient.execPostTimeOutByBusiness("app.base", params, url, ContentType, headData, timeOut, req);
} }
/** /**
* 验证签名 * 验证签名
......
...@@ -6,7 +6,7 @@ class TxPushLogService extends ServiceBase { ...@@ -6,7 +6,7 @@ class TxPushLogService extends ServiceBase {
super("common", ServiceBase.getDaoName(TxPushLogService)); super("common", ServiceBase.getDaoName(TxPushLogService));
this.orderProductDao = system.getObject("db.order.orderProductDao"); this.orderProductDao = system.getObject("db.order.orderProductDao");
this.orderInfoDao = system.getObject("db.order.orderInfoDao"); this.orderInfoDao = system.getObject("db.order.orderInfoDao");
} }
returnTX(status, componentName, message, data) { returnTX(status, componentName, message, data) {
...@@ -57,19 +57,19 @@ class TxPushLogService extends ServiceBase { ...@@ -57,19 +57,19 @@ class TxPushLogService extends ServiceBase {
identifyCode: "orderPayNotify" identifyCode: "orderPayNotify"
} }
}; };
var a = await this.execPostByTimeOut(pushobj, settings.opPushUrl()); var a = await this.execPostByTimeOut(req, pushobj, settings.opPushUrl());
return self.returnTX(1, "cgateway", "ok", { "flowId": creatlog.flow_id, "resourceIds": [pobj.interface.para.dealName] }) return self.returnTX(1, "cgateway", "ok", { "flowId": creatlog.flow_id, "resourceIds": [pobj.interface.para.dealName] })
} catch (error) { } catch (e) {
console.log(error); this.execClient.execLogs("txPushLogSve.js/createCbsInstance方法出现异常", { params: orderNum }, "txPushLogSve_createCbsInstance_error", null, e.stack);
return self.returnTX(-1, "cgateway", "请求失败", null) return this.returnTX(-1, "cgateway", "请求失败", null)
} }
} }
//发货检查 //发货检查
async queryFlow(pobj) { async queryFlow(pobj) {
var self=this; var self = this;
if (!pobj.interface.para.flowId) { if (!pobj.interface.para.flowId) {
return self.returnTX(-1, "cgateway", "参数错误", null) return self.returnTX(-1, "cgateway", "参数错误", null)
} }
...@@ -91,7 +91,7 @@ class TxPushLogService extends ServiceBase { ...@@ -91,7 +91,7 @@ class TxPushLogService extends ServiceBase {
//资源拉取 //资源拉取
async queryResources(pobj) { async queryResources(pobj) {
var self=this; var self = this;
if (!pobj.interface.para.resourceIds[0]) { if (!pobj.interface.para.resourceIds[0]) {
return self.returnTX(-1, "cgateway", "参数错误", null) return self.returnTX(-1, "cgateway", "参数错误", null)
} }
...@@ -161,7 +161,7 @@ class TxPushLogService extends ServiceBase { ...@@ -161,7 +161,7 @@ class TxPushLogService extends ServiceBase {
// } // }
//隔离资源 //隔离资源
async isolateResource(pobj) { async isolateResource(pobj) {
var self=this; var self = this;
if (!pobj.interface.para.resourceId) { if (!pobj.interface.para.resourceId) {
return self.returnTX(-1, "mall_logic", "参数错误", null) return self.returnTX(-1, "mall_logic", "参数错误", null)
} }
...@@ -182,7 +182,7 @@ class TxPushLogService extends ServiceBase { ...@@ -182,7 +182,7 @@ class TxPushLogService extends ServiceBase {
//销毁资源 //销毁资源
async destroyResource(pobj) { async destroyResource(pobj) {
var self=this; var self = this;
if (!pobj.interface.para.resourceId) { if (!pobj.interface.para.resourceId) {
return self.returnTX(-1, "mall_logic", "参数错误", null) return self.returnTX(-1, "mall_logic", "参数错误", null)
} }
...@@ -217,7 +217,7 @@ class TxPushLogService extends ServiceBase { ...@@ -217,7 +217,7 @@ class TxPushLogService extends ServiceBase {
//新购参数检查 //新购参数检查
async checkCreate(pobj) { async checkCreate(pobj) {
var self=this; var self = this;
if (!pobj.interface || !pobj.interface.para || !pobj.interface.para.goodsDetail) { if (!pobj.interface || !pobj.interface.para || !pobj.interface.para.goodsDetail) {
return self.returnTX(-1, "qcloud_domain_register", "参数错误", null) return self.returnTX(-1, "qcloud_domain_register", "参数错误", null)
} }
......
...@@ -31,7 +31,7 @@ class NeedInfoService extends ServiceBase { ...@@ -31,7 +31,7 @@ class NeedInfoService extends ServiceBase {
} }
var self = this; var self = this;
return await self.db.transaction(async function (t) { return await self.db.transaction(async function (t) {
await self.dao.update({ id: needinfo.id, status: 5,close_reason:ab.note }, t); await self.dao.update({ id: needinfo.id, status: 5, close_reason: ab.note }, t);
// var needsolution = await self.needSolutionDao.model.findOne({ // var needsolution = await self.needSolutionDao.model.findOne({
// where: { need_num: ab.needNum }, // where: { need_num: ab.needNum },
// raw: true // raw: true
...@@ -49,7 +49,7 @@ class NeedInfoService extends ServiceBase { ...@@ -49,7 +49,7 @@ class NeedInfoService extends ServiceBase {
* @param {*} actionBody * @param {*} actionBody
*/ */
//创建需求 //创建需求
async needSubmit(actionBody) { async needSubmit(actionBody, req) {
if (!actionBody.ContactsMobile) { if (!actionBody.ContactsMobile) {
return system.getResultFail(-102, "ContactsMobile cannot be empty"); return system.getResultFail(-102, "ContactsMobile cannot be empty");
} }
...@@ -68,72 +68,69 @@ class NeedInfoService extends ServiceBase { ...@@ -68,72 +68,69 @@ class NeedInfoService extends ServiceBase {
if (!actionBody.UserId) { if (!actionBody.UserId) {
return system.getResultFail(-102, "userId cannot be empty"); return system.getResultFail(-102, "userId cannot be empty");
} }
try { var scobj = {
var scobj = { "region_id": actionBody.RegionId,
"region_id": actionBody.RegionId, "regionName": actionBody.RegionName,
"regionName": actionBody.RegionName, "path_code": actionBody.ConsultType
"path_code": actionBody.ConsultType }
} var serviceinfo = await this.dao.findServiceByProductType(scobj);
var serviceinfo = await this.dao.findServiceByProductType(scobj); if (serviceinfo.status < 0) {
if (serviceinfo.status < 0) { return system.getResultFail(-203, "servicer is empty");
return system.getResultFail(-203, "servicer is empty"); }
} if (!serviceinfo.data.is_enabled) {
actionBody.ServicerCode = serviceinfo.data.servicer_code; return system.getResultFail(-300, "servicer isn't enable");
actionBody.ServicerName = serviceinfo.data.servicer_name; }
actionBody.ServicerCode = serviceinfo.data.servicer_code;
//需求创建 actionBody.ServicerName = serviceinfo.data.servicer_name;
var need_num = await this.getBusUid("n");
var datavalue = {
need_num: need_num,
user_id: actionBody.UserId,
contacts_mobile: actionBody.ContactsMobile,
contacts_name: actionBody.ContactsName || "",
region_id: actionBody.RegionId,
region_name: actionBody.RegionName,
consult_type: actionBody.ConsultType,
consult_type_name: actionBody.ConsultTypeName,
notes: actionBody.Notes,
servicer_code: actionBody.ServicerCode,
servicer_name: actionBody.ServicerName,
status: 1,
user_name: actionBody.UserName,
email: actionBody.Email,
wechat_no: actionBody.WechatNo
}
if (actionBody.CompanyName) {
datavalue.need_info = {
companyName: actionBody.CompanyName
};
}
actionBody.NeedNum = need_num;
//生产者------需求推送
var pushobj = { //需求创建
"actionType": "produceData",// Y 功能名称 var need_num = await this.getBusUid("n");
"actionBody": { var datavalue = {
notifyUrl: "http://brguser.brg.tencentyun.com/api/receive/notifyApi/springBoard", need_num: need_num,
actionType: "needSubmit", user_id: actionBody.UserId,
pushUrl: serviceinfo.data.push_domain_addr + "/entService/consultation/springBoard", contacts_mobile: actionBody.ContactsMobile,
messageBody: actionBody, contacts_name: actionBody.ContactsName || "",
identifyCode: "needSubmit" region_id: actionBody.RegionId,
} region_name: actionBody.RegionName,
consult_type: actionBody.ConsultType,
consult_type_name: actionBody.ConsultTypeName,
notes: actionBody.Notes,
servicer_code: actionBody.ServicerCode,
servicer_name: actionBody.ServicerName,
status: 1,
user_name: actionBody.UserName,
email: actionBody.Email,
wechat_no: actionBody.WechatNo
}
if (actionBody.CompanyName) {
datavalue.need_info = {
companyName: actionBody.CompanyName
}; };
var r = await this.execPostByTimeOut(pushobj, settings.opPushUrl()); }
if (r.status < 1) {
return system.getResultFail(-102, "Post error");
}
var newneedinfo = await this.create(datavalue);
if (!newneedinfo) {
return system.getResultFail(-310, "newneedinfo cannot be created");
}
return system.getResultSuccess();
} catch (e) {
return system.getResultFail(-510, e) actionBody.NeedNum = need_num;
//生产者------需求推送
var pushobj = {
"actionType": "produceData",// Y 功能名称
"actionBody": {
notifyUrl: "http://brguser.brg.tencentyun.com/api/receive/notifyApi/springBoard",
actionType: "needSubmit",
pushUrl: serviceinfo.data.push_domain_addr + "/entService/consultation/springBoard",
messageBody: actionBody,
identifyCode: "needSubmit"
}
};
var r = await this.execPostByTimeOut(req, pushobj, settings.opPushUrl());
if (r.status < 1) {
return system.getResultFail(-102, "Post error");
} }
var newneedinfo = await this.create(datavalue);
if (!newneedinfo) {
return system.getResultFail(-310, "newneedinfo cannot be created");
}
return system.getResultSuccess();
} }
//需求提交回调 //需求提交回调
...@@ -148,12 +145,9 @@ class NeedInfoService extends ServiceBase { ...@@ -148,12 +145,9 @@ class NeedInfoService extends ServiceBase {
if (!needinfo) { if (!needinfo) {
return system.getResultFail(-102, "needinfo is empty"); return system.getResultFail(-102, "needinfo is empty");
} }
try { await this.update({ id: needinfo.dataValues.id, status: 2 });
await this.update({ id: needinfo.dataValues.id, status: 2 }); return system.getResultSuccess();
return system.getResultSuccess();
} catch (error) {
return system.getResultFail(-510, error)
}
} }
async needList(searchObj) { async needList(searchObj) {
......
...@@ -47,7 +47,7 @@ class NeedSolutionService extends ServiceBase { ...@@ -47,7 +47,7 @@ class NeedSolutionService extends ServiceBase {
} }
return; return;
} catch (e) { } catch (e) {
this.execClient.execLogs("needSolutionSve.js/sendSmsNotification(发送短信通知)方法出现异常", { mobile: mobile, consultType: consultType, consultName: consultName, status: status }, "", null, e.stack); this.execClient.execLogs("needSolutionSve.js/sendSmsNotification(发送短信通知)方法出现异常", { mobile: mobile, consultType: consultType, consultName: consultName, status: status }, "needSolutionSve_sendSmsNotification_error", null, e.stack);
return; return;
} }
...@@ -135,7 +135,7 @@ class NeedSolutionService extends ServiceBase { ...@@ -135,7 +135,7 @@ class NeedSolutionService extends ServiceBase {
} }
//驳回方案 //驳回方案
async refusalSolution(actionBody, t) { async refusalSolution(actionBody, req) {
if (!actionBody.NeedNum) { if (!actionBody.NeedNum) {
return system.getResultFail(-102, "needNum cannot be empty"); return system.getResultFail(-102, "needNum cannot be empty");
} }
...@@ -164,8 +164,6 @@ class NeedSolutionService extends ServiceBase { ...@@ -164,8 +164,6 @@ class NeedSolutionService extends ServiceBase {
if (serviceinfo.status < 0) { if (serviceinfo.status < 0) {
return system.getResultFail(-203, "servicer is empty"); return system.getResultFail(-203, "servicer is empty");
} }
//生产者------方案反馈 //生产者------方案反馈
var pushobj = { var pushobj = {
"actionType": "produceData",// Y 功能名称 "actionType": "produceData",// Y 功能名称
...@@ -177,12 +175,12 @@ class NeedSolutionService extends ServiceBase { ...@@ -177,12 +175,12 @@ class NeedSolutionService extends ServiceBase {
identifyCode: "needClose" identifyCode: "needClose"
} }
}; };
var r = await self.execPostByTimeOut(pushobj, settings.opPushUrl()); var r = await self.execPostByTimeOut(req, pushobj, settings.opPushUrl());
if (r.status < 1) { if (r.status < 1) {
return system.getResultFail(-102, "Post error"); return system.getResultFail(-102, "Post error");
} }
await self.needInfoDao.update({ id: needInfo.dataValues.id, status: 2 }, t); await self.needInfoDao.update({ id: needInfo.dataValues.id, status: 2 });
await self.dao.update({ id: solutionInfo.dataValues.id, is_refusal: 1, refusal_notes: actionBody.RefusalContent }, t); await self.dao.update({ id: solutionInfo.dataValues.id, is_refusal: 1, refusal_notes: actionBody.RefusalContent });
return system.getResultSuccess(); return system.getResultSuccess();
}) })
} }
......
...@@ -285,7 +285,7 @@ class OrderDeliveryService extends ServiceBase { ...@@ -285,7 +285,7 @@ class OrderDeliveryService extends ServiceBase {
} }
} catch (e) { } catch (e) {
console.log(e.stack) console.log(e.stack)
this.execClient.execLogs("orderDeliverySve.js/sendSmsNotification(发送短信通知)方法出现异常", {orderNum:orderNum,status:status}, "", null, e.stack); this.execClient.execLogs("orderDeliverySve.js/sendSmsNotification(发送短信通知)方法出现异常", {orderNum:orderNum,status:status}, "orderDeliverySve_sendSmsNotification_error", null, e.stack);
return; return;
} }
...@@ -342,7 +342,7 @@ class OrderDeliveryService extends ServiceBase { ...@@ -342,7 +342,7 @@ class OrderDeliveryService extends ServiceBase {
} }
} catch (e) { } catch (e) {
console.log(e); console.log(e);
this.execClient.execLogs("orderDeliverySve.js/createQualificationCertificateInfo方法出现异常", {params:orderNum}, "", null, e.stack); this.execClient.execLogs("orderDeliverySve.js/createQualificationCertificateInfo方法出现异常", {params:orderNum}, "orderDeliverySve_createQualificationCertificateInfo_error", null, e.stack);
} }
...@@ -451,7 +451,7 @@ class OrderDeliveryService extends ServiceBase { ...@@ -451,7 +451,7 @@ class OrderDeliveryService extends ServiceBase {
return system.getResultSuccess(); return system.getResultSuccess();
} catch (e) { } catch (e) {
console.log(e,"创建申请实体异常"); console.log(e,"创建申请实体异常");
this.execClient.execLogs("orderDeliverySve.js/createApplyInfo方法出现异常", {params:orderNum}, "", null, e.stack); this.execClient.execLogs("orderDeliverySve.js/createApplyInfo方法出现异常", {params:orderNum}, "orderDeliverySve_createApplyInfo_error", null, e.stack);
return system.getResultSuccess(); return system.getResultSuccess();
} }
......
...@@ -31,7 +31,7 @@ class OrderInfoService extends ServiceBase { ...@@ -31,7 +31,7 @@ class OrderInfoService extends ServiceBase {
attributes: [ attributes: [
"pay_time", "pay_time",
"order_num", "order_num",
["tx_orders_num","main_orders_num"], //腾讯主订单号 ["tx_orders_num", "main_orders_num"], //腾讯主订单号
"need_num", //需求号 "need_num", //需求号
"user_name", //用户名称 "user_name", //用户名称
"quantity", //订单数量 "quantity", //订单数量
...@@ -116,7 +116,7 @@ class OrderInfoService extends ServiceBase { ...@@ -116,7 +116,7 @@ class OrderInfoService extends ServiceBase {
} }
//发货回调 //发货回调
async orderPayNotify(pobj) { async orderPayNotify(pobj, req) {
if (!pobj.actionBody.interface || !pobj.actionBody.interface.para) { if (!pobj.actionBody.interface || !pobj.actionBody.interface.para) {
return system.getResultFail(-101, "参数错误"); return system.getResultFail(-101, "参数错误");
} }
...@@ -145,7 +145,7 @@ class OrderInfoService extends ServiceBase { ...@@ -145,7 +145,7 @@ class OrderInfoService extends ServiceBase {
"seqId": "647ea242-f654-965d-a62a-eabe0289d954", "seqId": "647ea242-f654-965d-a62a-eabe0289d954",
"spanId": "https://buy.qcloud.com;61911" "spanId": "https://buy.qcloud.com;61911"
} }
var txorderinfo = await this.execPostByTimeOut(selobj, "http://trade.sandbox.com/interfaces/interface.php"); var txorderinfo = await this.execPostByTimeOut(req, selobj, "http://trade.sandbox.com/interfaces/interface.php");
if (txorderinfo.status < 0) { if (txorderinfo.status < 0) {
return system.getResultFail(-101, "post is error"); return system.getResultFail(-101, "post is error");
...@@ -292,7 +292,7 @@ class OrderInfoService extends ServiceBase { ...@@ -292,7 +292,7 @@ class OrderInfoService extends ServiceBase {
identifyCode: "orderSubmit" identifyCode: "orderSubmit"
} }
}; };
var r = await this.execPostByTimeOut(pushobj, settings.opPushUrl()); var r = await this.execPostByTimeOut(req, pushobj, settings.opPushUrl());
if (r.status < 1) { if (r.status < 1) {
return system.getResultFail(-102, "Post error"); return system.getResultFail(-102, "Post error");
} }
...@@ -553,7 +553,7 @@ class OrderInfoService extends ServiceBase { ...@@ -553,7 +553,7 @@ class OrderInfoService extends ServiceBase {
identifyCode: "orderSubmit" identifyCode: "orderSubmit"
} }
}; };
var r = await this.execPostByTimeOut(pushobj, settings.opPushUrl()); var r = await this.execPostByTimeOut(req, pushobj, settings.opPushUrl());
if (r.status < 1) { if (r.status < 1) {
return system.getResultFail(-102, "Post error"); return system.getResultFail(-102, "Post error");
} }
...@@ -561,7 +561,7 @@ class OrderInfoService extends ServiceBase { ...@@ -561,7 +561,7 @@ class OrderInfoService extends ServiceBase {
} }
//询价----调取腾讯接口 //询价----调取腾讯接口
async selPrice2TX(pobj) { async selPrice2TX(pobj, req) {
var pid = 1003949; var pid = 1003949;
var goodsCategoryId = "101630"; var goodsCategoryId = "101630";
var goodsSubType = ""; var goodsSubType = "";
...@@ -629,7 +629,7 @@ class OrderInfoService extends ServiceBase { ...@@ -629,7 +629,7 @@ class OrderInfoService extends ServiceBase {
sql += " and price_name like :priceName;"; sql += " and price_name like :priceName;";
} }
var txprice = await this.customQuery(sql, sqlobj); var txprice = await this.customQuery(sql, sqlobj);
console.log(txprice,".....txprice..........."); console.log(txprice, ".....txprice...........");
if (txprice && txprice.length > 0) { if (txprice && txprice.length > 0) {
goodsSubType = txprice[0].goodsSubType; goodsSubType = txprice[0].goodsSubType;
pid = txprice[0].pid; pid = txprice[0].pid;
...@@ -645,6 +645,9 @@ class OrderInfoService extends ServiceBase { ...@@ -645,6 +645,9 @@ class OrderInfoService extends ServiceBase {
if (txproductinfo.status < 0) { if (txproductinfo.status < 0) {
return system.getResultFail(-203, "txproduct is empty"); return system.getResultFail(-203, "txproduct is empty");
} }
if (!txproductinfo.data.is_enabled) {
return system.getResultFail(-300, "servicer isn't enable");
}
var txobj = { var txobj = {
"version": "1.0", "version": "1.0",
"componentName": "Market", "componentName": "Market",
...@@ -695,7 +698,7 @@ class OrderInfoService extends ServiceBase { ...@@ -695,7 +698,7 @@ class OrderInfoService extends ServiceBase {
txobj.interface.para.resInfo[0].goodsDetail.timeSpan = pobj.actionBody.TimeSpan; txobj.interface.para.resInfo[0].goodsDetail.timeSpan = pobj.actionBody.TimeSpan;
txobj.interface.para.resInfo[0].goodsDetail.timeUnit = pobj.actionBody.TimeUnit; txobj.interface.para.resInfo[0].goodsDetail.timeUnit = pobj.actionBody.TimeUnit;
} }
var rtn = await this.execPostByTimeOut(txobj, "http://trade.sandbox.com/interfaces/interface.php"); var rtn = await this.execPostByTimeOut(req, txobj, "http://trade.sandbox.com/interfaces/interface.php");
if (rtn.status < 0) { if (rtn.status < 0) {
return system.getResultFail(-101, "post is error"); return system.getResultFail(-101, "post is error");
} }
...@@ -719,7 +722,7 @@ class OrderInfoService extends ServiceBase { ...@@ -719,7 +722,7 @@ class OrderInfoService extends ServiceBase {
return system.getResultSuccess(data); return system.getResultSuccess(data);
} }
async submitGoodsinfo(pobj) { async submitGoodsinfo(pobj, req) {
// if (!pobj.actionBody.Info) { // if (!pobj.actionBody.Info) {
// return system.getResultFail(-101, "Info is empty"); // return system.getResultFail(-101, "Info is empty");
// } // }
...@@ -815,16 +818,16 @@ class OrderInfoService extends ServiceBase { ...@@ -815,16 +818,16 @@ class OrderInfoService extends ServiceBase {
} }
} }
} }
var a = await this.execPostByTimeOut(p, "http://192.168.1.113:4011/api/action/txapi/springBoard"); var a = await this.execPostByTimeOut(req, p, "http://192.168.1.113:4011/api/action/txapi/springBoard");
if (pobj.itemDetails.raw_goodsData.length == 2) { if (pobj.itemDetails.raw_goodsData.length == 2) {
p.interface.para.dealName = Date.now(); p.interface.para.dealName = Date.now();
p.interface.para.goodsDetail = pobj.itemDetails.raw_goodsData[1].goodsDetail; p.interface.para.goodsDetail = pobj.itemDetails.raw_goodsData[1].goodsDetail;
var b = await this.execPostByTimeOut(p, "http://192.168.1.113:4011/api/action/txapi/springBoard"); var b = await this.execPostByTimeOut(req, p, "http://192.168.1.113:4011/api/action/txapi/springBoard");
} }
if (pobj.itemDetails.raw_goodsData.length == 3) { if (pobj.itemDetails.raw_goodsData.length == 3) {
p.interface.para.dealName = Date.now(); p.interface.para.dealName = Date.now();
p.interface.para.goodsDetail = pobj.itemDetails.raw_goodsData[2].goodsDetail; p.interface.para.goodsDetail = pobj.itemDetails.raw_goodsData[2].goodsDetail;
await this.execPostByTimeOut(p, "http://192.168.1.113:4011/api/action/txapi/springBoard"); await this.execPostByTimeOut(req, p, "http://192.168.1.113:4011/api/action/txapi/springBoard");
} }
return system.getResultSuccess(); return system.getResultSuccess();
} }
...@@ -906,18 +909,14 @@ class OrderInfoService extends ServiceBase { ...@@ -906,18 +909,14 @@ class OrderInfoService extends ServiceBase {
if (!pobj.entTime) { if (!pobj.entTime) {
return system.getResultFail(-101, "entTime is empty"); return system.getResultFail(-101, "entTime is empty");
} }
try { var orderproduct = await this.orderProductDao.findOne({ order_num: pobj.orderNum });
var orderproduct = await this.orderProductDao.findOne({ order_num: pobj.orderNum }); if (!orderproduct) {
if (!orderproduct) { return system.getResultFail(-101, "orderproduct is empty");
return system.getResultFail(-101, "orderproduct is empty");
}
orderproduct.dataValues.start_time = new Date(pobj.startTime)
orderproduct.dataValues.ent_time = new Date(pobj.entTime)
await this.orderProductDao.update(orderproduct.dataValues);
return system.getResultSuccess();
} catch (error) {
return system.getResultFail(510, error);
} }
orderproduct.dataValues.start_time = new Date(pobj.startTime)
orderproduct.dataValues.ent_time = new Date(pobj.entTime)
await this.orderProductDao.update(orderproduct.dataValues);
return system.getResultSuccess();
} }
......
...@@ -11,11 +11,11 @@ class UtilsIcNameService extends AppServiceBase { ...@@ -11,11 +11,11 @@ class UtilsIcNameService extends AppServiceBase {
* 工商核名请求接口 * 工商核名请求接口
* @param {*} * @param {*}
*/ */
async checkBusinessNameList(params) { async checkBusinessNameList(params, req) {
var result = await this.execPostByTimeOut(params,settings.hemingUrl()); var result = await this.execPostByTimeOut(req, params, settings.hemingUrl());
return result; return result;
} }
} }
module.exports = UtilsIcNameService; module.exports = UtilsIcNameService;
\ No newline at end of file
...@@ -231,7 +231,7 @@ class UtilsMsgSendService extends AppServiceBase { ...@@ -231,7 +231,7 @@ class UtilsMsgSendService extends AppServiceBase {
sendChannel = sendChannel + 2; sendChannel = sendChannel + 2;
} }
params.interface.para.sendChannel = sendChannel; params.interface.para.sendChannel = sendChannel;
var result = await this.execPostByTimeOut(params, "http://dev.message.tencentyun.com"); var result = await this.execPostByTimeOut(null, params, "http://dev.message.tencentyun.com");
if (result.status != 1 || !result.data || !result.data.codeDesc || result.data.codeDesc != "success") { if (result.status != 1 || !result.data || !result.data.codeDesc || result.data.codeDesc != "success") {
return system.getResult(null, "获取失败"); return system.getResult(null, "获取失败");
} }
......
...@@ -12,14 +12,15 @@ class ServiceBase { ...@@ -12,14 +12,15 @@ class ServiceBase {
} }
/** /**
* 带超时时间的post请求 * 带超时时间的post请求
* @param {*} req 请求信息
* @param {*} params 请求数据-json格式 * @param {*} params 请求数据-json格式
* @param {*} url 请求地址 * @param {*} url 请求地址
* @param {*} ContentType 请求头类型,默认application/json * @param {*} ContentType 请求头类型,默认application/json
* @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"} * @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"}
* @param {*} timeOut 超时时间 * @param {*} timeOut 超时时间
*/ */
async execPostByTimeOut(params, url, ContentType, headData, timeOut = 60) { async execPostByTimeOut(req, params, url, ContentType, headData, timeOut = 60) {
return await this.execClient.execPostTimeOutByBusiness("sve.base", params, url, ContentType, headData, timeOut); return await this.execClient.execPostTimeOutByBusiness("sve.base", params, url, ContentType, headData, timeOut, req);
} }
/** /**
* 验证签名 * 验证签名
......
...@@ -10,7 +10,7 @@ class ExecClient { ...@@ -10,7 +10,7 @@ class ExecClient {
constructor() { constructor() {
this.cmdGetPattern = "curl -G -X GET '{url}'"; this.cmdGetPattern = "curl -G -X GET '{url}'";
this.cmdPostPattern = "curl -k -H 'Content-type: application/json' -d '{data}' {url}"; this.cmdPostPattern = "curl -k -H 'Content-type: application/json' -d '{data}' {url}";
// this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}"; // this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'appkey:{appkey}' -d '{data}' {url}";
} }
/** /**
* 带超时时间的post请求 * 带超时时间的post请求
...@@ -20,10 +20,19 @@ class ExecClient { ...@@ -20,10 +20,19 @@ class ExecClient {
* @param {*} ContentType 请求头类型,默认application/json * @param {*} ContentType 请求头类型,默认application/json
* @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"} * @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"}
* @param {*} timeOut 超时时间设置,单位秒 * @param {*} timeOut 超时时间设置,单位秒
* @param {*} req 请求信息
*/ */
async execPostTimeOutByBusiness(execFile, params, url, ContentType, headData, timeOut = 5000) { async execPostTimeOutByBusiness(execFile, params, url, ContentType, headData, timeOut = 60, req) {
var rtn = null; var rtn = null;
var reqResult = null; var reqResult = null;
var requestId = null;
if (req && req.body && (req.body.RequestId || req.body.requestId)) {
requestId = req.body.RequestId || req.body.requestId;
} else {
if (req && req.query && (req.query.RequestId || req.query.requestId)) {
requestId = req.query.RequestId || req.query.requestId;
}
}
try { try {
if (settings.env === "dev") { if (settings.env === "dev") {
var headers = { var headers = {
...@@ -55,7 +64,7 @@ class ExecClient { ...@@ -55,7 +64,7 @@ class ExecClient {
} else { } else {
reqResult = system.getResult(null, "执行execPostTimeOutByBusiness存在错误"); reqResult = system.getResult(null, "执行execPostTimeOutByBusiness存在错误");
} }
reqResult.requestId = uuid.v1(); reqResult.requestId = requestId || uuid.v1();
if (result.headers) { if (result.headers) {
delete result["headers"]; delete result["headers"];
} }
...@@ -76,12 +85,12 @@ class ExecClient { ...@@ -76,12 +85,12 @@ class ExecClient {
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
reqResult = system.getResultSuccess(result); reqResult = system.getResultSuccess(result);
} }
reqResult.requestId = uuid.v1(); reqResult.requestId = requestId || uuid.v1();
this.execLogs(execFile + "执行execPostTimeOutByBusiness", params, params.identifyCode, reqResult, rtn); this.execLogs(execFile + "执行execPostTimeOutByBusiness", params, params.identifyCode, reqResult, rtn);
return reqResult; return reqResult;
} catch (error) { } catch (error) {
reqResult = system.getResultFail(-200, execFile + "执行execPostByTimeOut存在异常"); reqResult = system.getResultFail(-200, execFile + "执行execPostByTimeOut存在异常");
reqResult.requestId = uuid.v1(); reqResult.requestId = requestId || uuid.v1();
this.execLogs(execFile + "执行execPostByTimeOut存在异常", params, params.identifyCode, reqResult, error.stack); this.execLogs(execFile + "执行execPostByTimeOut存在异常", params, params.identifyCode, reqResult, error.stack);
return reqResult; return reqResult;
} }
......
<a name="menu" href="/doc">返回主目录</a> <a name="menu" href="/doc">返回主目录</a>
1. [短信验证码](#smsCode) 1. [短信验证码](#smsCode)
1. [日志说明](#execLogs)
## **<a name="smsCode"> 短信验证码</a>** ## **<a name="smsCode"> 短信验证码</a>**
[返回到目录](#menu) [返回到目录](#menu)
...@@ -26,4 +26,41 @@ ...@@ -26,4 +26,41 @@
"RequestId": "7364f560-b29c-11ea-97f7-efd638e57201" "RequestId": "7364f560-b29c-11ea-97f7-efd638e57201"
} }
} }
``` ```
\ No newline at end of file
## **<a name="execLogs"> 日志说明</a>**
[返回到目录](#menu)
##### 调用方式
本地调用
#### 方法路径
app\base\utils\execClient.js
#### 方法名称:execLogs
#### 参数说明
| 参数名 | 必填 | 类型 | 描述 |
| ---- | ---- | ---- | ---- |
| opTitle | 否 | string | 操作的标题 |
| params | 否 | json | 参数 |
| identifyCode | 否 | string | 业务标识 |
| resultInfo | 否 | json | 返回结果 |
| errorInfo | 否 | json | 错误信息 |
#### 参数示例
``` javascript
this.execClient = system.getObject("util.execClient");
this.execClient.execLogs("短信通知异常",reqobj, "orderDeliverySve_sendSmsNotification_error", null, e.stack);
```
#### 业务标识参数说明
identifyCode参数约定命名方式:文件名_方法名_日志类型
| 业务标识 | 业务描述 |
| ---- | ---- |
| orderDeliverySve_sendSmsNotification_error | 发送短信通知异常(订单) |
| orderDeliverySve_createQualificationCertificateInfo_error | 创建资质信息异常 |
| orderDeliverySve_createApplyInfo_error | 创建申请实体异常 |
| needSolutionSve_sendSmsNotification_error | 发送短信通知异常(需求方案) |
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