Commit aaa9e95c by 任晓松

Merge remote-tracking branch 'origin/center-channel' into center-channel

parents aca41dcc 53c0ba9f
//百度工商注册
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class RegAPI extends APIBase {
constructor() {
super();
this.regCenterOrderSve = system.getObject("service.common.regCenterOrderSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
//-----------接入百度reg------start----laolan--2020.12.17----------------------------
//---------2.
case "submitRegNeed"://提交需求
opResult = await this.regCenterOrderSve.submitRegNeed(pobj, pobj.actionBody);
break;
case "regFeedbackSubmit"://接收方案反馈信息
pobj.actionType = "regFeedbackSubmit";
opResult = await this.regCenterOrderSve.reqCenterOrderRegApi(pobj);
break;
case "regOrderStatus"://reg方案更新
opResult = await this.regCenterOrderSve.regOrderStatus(pobj, pobj.actionBody);
if (opResult.status == 0 && pobj.actionBody.status == 1) {
opResult = await self.centerorderSve.regPaySuccess(pobj, pobj.actionBody);
}
break;
case "regOrderClose"://关闭reg订单
opResult = await this.regCenterOrderSve.regOrderClose(pobj, pobj.actionBody);
break;
case "getItemByChannelSolutionNo":
opResult = await this.regCenterOrderSve.getItemByChannelSolutionNo(pobj, pobj.actionBody);
break;
case "getSolutionByChannelOrderNo"://根据渠道订单获取方案信息
opResult = await this.regCenterOrderSve.getSolutionByChannelOrderNo(pobj, pobj.actionBody);
break;
//------------3.
case "submitRegSolution"://方案提交
opResult = await this.regCenterOrderSve.submitRegSolution(pobj);
break;
case "writeRegCommunicationLog"://新增沟通记录
opResult = await this.regCenterOrderSve.writeRegCommunicationLog(pobj);
break;
case "queryExpertRegCommunicationLogs"://获取沟通记录
opResult = await this.regCenterOrderSve.queryExpertRegCommunicationLogs(pobj);
break;
case "updateOrdertatus"://提交交付信息/修改订单状态
opResult = await this.regCenterOrderSve.updateOrdertatus(pobj);
break;
case "regNeedClose"://需求关闭
opResult = await this.regCenterOrderSve.regNeedClose(pobj);
break;
case "getRegInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.regCenterOrderSve.reqCenterOrderApi(pobj,"action/regapi/springBoard");
break;
// case "closeRegSolution"://服务商方案关闭
// opResult = await this.regCenterOrderSve.closeRegSolution(pobj);
// break;
// case "closeOrderDelivery"://交付商关闭交付单
// opResult = await this.regCenterOrderSve.closeOrderDelivery(pobj);
// break;
//-----------接入百度reg------end----------------------------
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = RegAPI;
\ No newline at end of file
//百度工商注册
var APIBase = require("../../api.base");
var system = require("../../../system");
const regCfg = require("./regCfg");
class Consultation extends APIBase {
constructor() {
super();
this.gatewaypushlogSve = system.getObject("service.common.gatewaypushlogSve");
}
async submit(pobj,req) {
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return regCfg.getResultFail("未知应用或应用未启用");
}
if (!pobj.intentionBizId) {
return regCfg.getResultFail("intentionBizId不能为空");
}
if (!pobj.phone) {
return regCfg.getResultFail("mobile不能为空");
}
if (!pobj.consultType) {
return regCfg.getResultFail("consultType不能为空");
}
pobj.type = pobj.consultType;
pobj.mobile = pobj.phone;
pobj.action_type = "submitRegNeed";
if (pobj.area) {
pobj.area = regCfg.baiduArea[pobj.area]
}
if (!pobj.area) {
return regCfg.getResultFail("area参数错误");
}
var param = {
requestId: req.requestId || regCfg.getUUID(),
requestUrl: "/ic/consultation/submit",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "submitRegNeed",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
await this.gatewaypushlogSve.create(param);
return regCfg.getResultSuccess(param.requestId);
}
}
module.exports = Consultation;
\ No newline at end of file
//百度工商注册
var APIBase = require("../../api.base");
var system = require("../../../system");
const regCfg = require("./regCfg");
class Feedback extends APIBase {
constructor() {
super();
this.gatewaypushlogSve = system.getObject("service.common.gatewaypushlogSve");
}
//需求反馈
async submit(pobj,req) {
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return regCfg.getResultFail("未知应用或应用未启用");
}
if (!pobj.intentionBizId) {
return regCfg.getResultFail("intentionBizId不能为空");
}
if (!pobj.description) {
return regCfg.getResultFail("description不能为空");
}
if (!pobj.intentionStatus) {
return regCfg.getResultFail("intentionStatus不能为空");
}
pobj.action_type = "regFeedbackSubmit";
var param = {
requestId: req.requestId || regCfg.getUUID(),
requestUrl: "/ic/feedback/submit",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "regFeedbackSubmit",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
await this.gatewaypushlogSve.create(param);
return regCfg.getResultSuccess(param.requestId);
}
}
module.exports = Feedback;
\ No newline at end of file
//百度工商注册
var APIBase = require("../../api.base");
var system = require("../../../system");
const regCfg = require("./regCfg");
class Order extends APIBase {
constructor() {
super();
this.gatewaypushlogSve = system.getObject("service.common.gatewaypushlogSve");
}
//状态变更
async notify(pobj, req) {
if (!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret) {
return regCfg.getResultFail("未知应用或应用未启用");
}
if (!pobj.isDirectBuy || pobj.isDirectBuy == 0) {
pobj.isDirectBuy = 0;
}
if (!pobj.mainOrderNo) {
return regCfg.getResultFail("mainOrderNo不能为空");
}
var i = 0;
var orderLength = pobj.subOrderList.lenght;
for (i = 0; i <= orderLength; i++) {
if (!pobj.subOrderList[i].orderNo) {
return regCfg.getResultFail("orderNo不能为空");
}
if (pobj.isDirectBuy == 0 && !pobj.subOrderList[i].bizId) {
return regCfg.getResultFail("非直接下单bizId不能为空");
}
if (pobj.isDirectBuy == 1 && !pobj.subOrderList[i].phone) {
return regCfg.getResultFail("直接下单phone不能为空");
}
if (pobj.isDirectBuy == 1 && !pobj.subOrderList[i].consultType) {
return regCfg.getResultFail("直接下单consultType不能为空");
}
// if (pobj.subOrderList[i].area) {
// pobj.subOrderList[i].area = regCfg.baiduArea[pobj.subOrderList[i].area]
// }
if (!pobj.subOrderList[i].area) {
return regCfg.getResultFail("area参数错误");
}
}
pobj.status = 1;
pobj.action_type = "regOrderStatus";
var param = {
requestId: req.requestId || regCfg.getUUID(),
requestUrl: "/ic/order/notify",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "regOrderStatus",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
await this.gatewaypushlogSve.create(param);
return regCfg.getResultSuccess(param.requestId);
}
async close(pobj, req) {
if (!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret) {
return regCfg.getResultFail("未知应用或应用未启用");
}
if (!pobj.orderNo) {
return regCfg.getResultFail("orderNo不能为空");
}
pobj.channelOrderNo = pobj.orderNo;
pobj.action_type = "regOrderClose";
var param = {
requestId: req.requestId || regCfg.getUUID(),
requestUrl: "/ic/order/close",
requestjson: JSON.stringify(pobj),//请求地址
pushUrl: "/action/intentionapi/springBoard",//调用地址
pushActionType: "regOrderClose",//调用参数
pushtimes: 0,//推送次数
pushStatus: "wts",//推送状态
}
await this.gatewaypushlogSve.create(param);
return regCfg.getResultSuccess(param.requestId);
}
}
module.exports = Order;
\ No newline at end of file
//百度配置
const uuidv4 = require('uuid/v4');
var regCfg = {
//工商注册城市对照表
baiduArea : {
"310100":"上海",
"441900":"东莞",
"440600":"佛山",
"110100":"北京",
"320100":"南京",
"360100":"南昌",
"320600":"南通",
"331000":"台州",
"340100":"合肥",
"330400":"嘉兴",
"210200":"大连",
"120100":"天津",
"140100":"太原",
"330200":"宁波",
"320400":"常州",
"440100":"广州",
"320300":"徐州",
"510100":"成都",
"321000":"扬州",
"320200":"无锡",
"530100":"昆明",
"330100":"杭州",
"420100":"武汉",
"210100":"沈阳",
"370100":"济南",
"440300":"深圳",
"330300":"温州",
"370600":"烟台",
"350100":"福州",
"330600":"绍兴",
"320500":"苏州",
"610100":"西安",
"520100":"贵阳",
"410100":"郑州",
"500100":"重庆",
"330700":"金华",
"220100":"长春",
"430100":"长沙",
"370200":"青岛",
"230100":"哈尔滨",
"130100":"石家庄"
},
baiduAreaCode : {
"上海": "310100",
"东莞": "441900",
"佛山": "440600",
"北京": "110100",
"南京": "320100",
"南昌": "360100",
"南通": "320600",
"台州": "331000",
"合肥": "340100",
"嘉兴": "330400",
"大连": "210200",
"天津": "120100",
"太原": "140100",
"宁波": "330200",
"常州": "320400",
"广州": "440100",
"徐州": "320300",
"成都": "510100",
"扬州": "321000",
"无锡": "320200",
"昆明": "530100",
"杭州": "330100",
"武汉": "420100",
"沈阳": "210100",
"济南": "370100",
"深圳": "440300",
"温州": "330300",
"烟台": "370600",
"福州": "350100",
"绍兴": "330600",
"苏州": "320500",
"西安": "610100",
"贵阳": "520100",
"郑州": "410100",
"重庆": "500100",
"金华": "330700",
"长春": "220100",
"长沙": "430100",
"青岛": "370200",
"哈尔滨":"230100",
"石家庄":"130100"
},
channelTypeCode : {
"gszc" : "baidu.gszc",
"kzfw" : "baidu.kzfw",
"gsbg" : "baidu.gsbg",
"gsnb" : "baidu.gsnb",
"sksq" : "baidu.sksq",
"swbd" : "baidu.swbd"
},
//区分渠道的uappid
uappId : {
'ali':18,
'baidu':44
},
//返回结果配置
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
},
getResultSuccess(requestId) {
return {
"status": 0,
"msg": "success",
"data":null,
"requestId": requestId
};
},
getResultFail(errmsg) {
return {
"status":-1,
"msg": errmsg,
"requestId": this.getUUID(),
"data":null,
"bizmsg":"empty"
};
}
}
module.exports = regCfg;
\ No newline at end of file
//百度工商注册
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
const regCfg = require("./regCfg");
class Tool extends APIBase {
constructor() {
super();
this.gatewaypushlogSve = system.getObject("service.common.gatewaypushlogSve");
}
async icname(params, req) {
let url = settings.icNameUrl() + 'api/icName/CheckName';
if (!params.cityName) {
return system.getResult(-1, 'cityName 不能为空!');
}
if (!params.keyWord) {
return system.getResult(-1, 'keyWord 不能为空!');
}
if (!params.industryType) {
return system.getResult(-1, 'industryType 不能为空!');
}
if (!params.organizationType) {
return system.getResult(-1, 'organizationType 不能为空!');
}
let obj = {
cityname: params.cityName, //注册城市地区
keyword: params.keyWord, //公司字号
btname: params.industryType, //行业类型
orgname: params.organizationType, //组织类型
appkey: "5b29981785bd4272966b15ad8e8b9dd3"
};
let result = await this.restPostUrl(obj, url);
console.log('result--工商核名---', result)
return result;
}
}
module.exports = Tool;
\ No newline at end of file
...@@ -6,7 +6,6 @@ class Need extends APIBase { ...@@ -6,7 +6,6 @@ class Need extends APIBase {
super(); super();
this.utilsNeedSve = system.getObject("service.utilsSve.utilsNeedSve"); this.utilsNeedSve = system.getObject("service.utilsSve.utilsNeedSve");
this.centerorderSve = system.getObject("service.common.centerorderSve"); this.centerorderSve = system.getObject("service.common.centerorderSve");
this.utilsNeedSve2 = system.getObject("service.utilsSve.utilsNeedSve2"); this.utilsNeedSve2 = system.getObject("service.utilsSve.utilsNeedSve2");
} }
...@@ -48,6 +47,9 @@ class Need extends APIBase { ...@@ -48,6 +47,9 @@ class Need extends APIBase {
opResult = await this.utilsNeedSve.needDetailByChannelNo(pobj, pobj.actionBody); opResult = await this.utilsNeedSve.needDetailByChannelNo(pobj, pobj.actionBody);
break; break;
case "getItemByChannelNeedNo": case "getItemByChannelNeedNo":
opResult = await this.utilsNeedSve.getItemByChannelNeedNo(pobj,pobj.actionBody);
break;
case "getSolutionByChannelSolutionNo":
opResult = await this.utilsNeedSve.getItemByChannelNeedNo(pobj, pobj.actionBody); opResult = await this.utilsNeedSve.getItemByChannelNeedNo(pobj, pobj.actionBody);
break break
case "getSolutionByChannelSolutionNo": case "getSolutionByChannelSolutionNo":
......
...@@ -361,8 +361,8 @@ class QcCenterOrderService extends AppServiceBase { ...@@ -361,8 +361,8 @@ class QcCenterOrderService extends AppServiceBase {
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
console.log('www+++result', result) console.log('www+++result', result)
if (result.status == 0) { if (result.status == 0) {
if (result.data) { if (result.data && result.data.orderNo) {
pobj.actionBody.orderNo = result.data; pobj.actionBody.orderNo = result.data.orderNo;
var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody); var orderrtn = await self.utilsOrderSve.delOrder(pobj, pobj.actionBody);
if (orderrtn.status < 0) { if (orderrtn.status < 0) {
return system.getResultFail(-5022, "订单关闭失败"); return system.getResultFail(-5022, "订单关闭失败");
......
...@@ -117,6 +117,16 @@ class UtilsOrderService extends AppServiceBase { ...@@ -117,6 +117,16 @@ class UtilsOrderService extends AppServiceBase {
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
return result; return result;
} }
//reg关闭订单2020-12-20
async delOrders(pobj, actionBody) {
if (!actionBody.orderNo) {
return system.getResult(null, "actionBody.orderNo can not be empty,100025");
}
var reqUrl = this.centerOrderUrl + "action/order/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
return result;
}
async getOrderInfo(pobj, actionBody) { async getOrderInfo(pobj, actionBody) {
var reqUrl = this.centerOrderUrl + "action/order/springBoard"; var reqUrl = this.centerOrderUrl + "action/order/springBoard";
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
......
const crypto = require('crypto');
const sha256 = require('sha256');
const system = require("../system");
var settings = require("../../config/settings");
class baiduRegClient {
constructor() {
this.pushlogSve = system.getObject("service.common.pushlogSve");
this.execClient = system.getObject("util.execClient");
this.baiduRegClientParams = settings.baiduRegClientParams();
}
//2020 1027 laolan 调用百度网关
async baiduPost( path, actionBody) {
console.log('actionBody++',actionBody)
let domain = this.baiduRegClientParams.domain;
let url = domain+path;
let version ="bce-auth-v1";
let accessKey = this.baiduRegClientParams.accessKey;
let secretKey = this.baiduRegClientParams.secretKey;
let timestamp = new Date().toISOString()
let site = timestamp.lastIndexOf(".");
timestamp = timestamp.substring(0,site)+"Z"
let signedHeaders = "host";
let extime = 1800;
let canonicalHeaders = "host:"+this.baiduRegClientParams.host;
//中间结果1:规范化请求和前缀字符串
var canonicalRequest = null
var pathParams = path.split("?");
if(pathParams && pathParams.length > 1){
canonicalRequest = "POST" + "\n" + pathParams[0] + "\n" + pathParams[1] + "\n" + canonicalHeaders;
}else{
canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
}
// let canonicalRequest = "POST" + "\n" + path + "\n" + "\n" + canonicalHeaders;
console.log('canonicalRequest+++++++',canonicalRequest)
//authStringPrefix(前缀字符串,由除sk字段外的签名信息生成)
let authStringPrefix = version+"/"+accessKey+"/"+timestamp+"/"+extime;
//中间结果2:派生签名密钥 signingKey
let signingKey = crypto.createHmac('sha256', secretKey)
.update(authStringPrefix)
.digest('hex');
//中间结果3:签名摘要 signature
let signature = crypto.createHmac('sha256', signingKey)
.update(canonicalRequest)
.digest('hex');
//最终结果:认证字符串 authorization
let authorization = authStringPrefix+"/"+signedHeaders+"/"+signature;
var baiduObj={
authorization:authorization,
data:actionBody
}
var rtn = await this.execClient.execBaiduPost(baiduObj, url);
console.log("baiduObj+++++",baiduObj)
console.log("url+++++",url)
console.log("rtn+++++",rtn)
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost data is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
}
//百度接口 2020-10-27 laolan
async baiduReqbyget(obj, cbk) {
var path = obj.path;
var reqbody = obj.reqbody;
try {
var res = await this.baiduPost( path, reqbody, {
timeout: 10000, // default 3000 ms 修改3000为10000,原因ConfirmIcpIntention BizIds 超过5条会超时
formatAction: true, // default true, format the action to Action
formatParams: true, // default true, format the parameter name to first letter upper case
method: 'POST', // set the http method, default is GET
headers: {
host:this.baiduRegClientParams.host
}, // set the http request headers
});
console.log('baidu++++res+++',res)
this.pushlogSve.createDb({
op: "new-baiduRegReqbyget",
content: JSON.stringify(obj),//推送的参数信息
resultInfo: JSON.stringify(res),
returnType: '1',
logLevel: '1',
opTitle: "new-baiduReqbyget推送百度信息返回成功"
});
return system.getResultSuccess(res);
} catch (e) {
this.pushlogSve.createFailLogDb({
appid: obj.appInfo ? obj.appInfo.uapp_id || "" : "",
appkey: obj.appInfo ? obj.appInfo.uapp_key || "" : "",
requestId: obj.requestId || "",
content: JSON.stringify(obj),//推送的参数信息
resultInfo: "error:" + JSON.stringify(e),
clientIp: obj.clientIp || "",
failType: 1,
opTitle: "new-baiduRegReqbyget推送百度信息返回异常",
pushNumber: obj.pushNumber || 1
});
return system.getResultFail(-200, "出现异常,error:" + e.stack);
}
}
}
module.exports = baiduRegClient;
// var task = new baiduRegClient();
// console.log(task.baiduRegClientParams,"11111111111111111");
\ No newline at end of file
...@@ -14,10 +14,12 @@ module.exports = { ...@@ -14,10 +14,12 @@ module.exports = {
"orderTotalSum", "collect", "reg", "orderCheck", "getReOrderList", "getOfficalList", "addReviewList", "opSubmitNeed", "opNeedClose", "opNeedList", "orderTotalSum", "collect", "reg", "orderCheck", "getReOrderList", "getOfficalList", "addReviewList", "opSubmitNeed", "opNeedClose", "opNeedList",
"getItemByNeedNo", "opNeedDetailByChannelNo", "getNeedListUser", "manualEvaluation", "diagnosisInfo", "check", "enterpriseInfo", "diagnosisDetail", "getItemByNeedNo", "opNeedDetailByChannelNo", "getNeedListUser", "manualEvaluation", "diagnosisInfo", "check", "enterpriseInfo", "diagnosisDetail",
"submitIcpIntention", "queryIntentionList", "confirmIcpIntention", "tmAccept", "tmStatus", "needBatchUpload", "submitIcpIntention", "queryIntentionList", "confirmIcpIntention", "tmAccept", "tmStatus", "needBatchUpload",
"ncSubmitMaterial","ncNotification","ncSubmitSolution","ncCloseNeed","ncClosePlan", "ncSubmitMaterial", "ncNotification", "ncSubmitSolution", "ncCloseNeed", "ncClosePlan",
"rtSubmitMaterial","rtNotification","rtSubmitSolution","rtCloseNeed","rtClosePlan", "rtSubmitMaterial", "rtNotification", "rtSubmitSolution", "rtCloseNeed", "rtClosePlan",
"getParamsFor360", "addOrderWeb", "getPayRecords", "getLoginInfo", "putUserMobileByVcode", "getParamsFor360", "addOrderWeb", "getPayRecords", "getLoginInfo", "putUserMobileByVcode",
"putUserPwdByMobile", "icpNotifyNew" "putUserPwdByMobile", "icpNotifyNew",
//百度工商注册
"submitRegSolution","writeRegCommunicationLog","queryExpertRegCommunicationLogs","updateOrdertatus","closeBdRegNeed"
], ],
apiMustUserpinList: [ apiMustUserpinList: [
"icpOrderClose", "icpOrderClose",
...@@ -25,7 +27,23 @@ module.exports = { ...@@ -25,7 +27,23 @@ module.exports = {
"submitService","serviceProviderNotification", "submitService","serviceProviderNotification",
"ncSubmitMaterial","ncNotification","ncSubmitSolution","ncCloseNeed","ncClosePlan", "ncSubmitMaterial","ncNotification","ncSubmitSolution","ncCloseNeed","ncClosePlan",
"rtSubmitMaterial","rtNotification","rtSubmitSolution","rtCloseNeed","rtClosePlan", "rtSubmitMaterial","rtNotification","rtSubmitSolution","rtCloseNeed","rtClosePlan",
//百度工商注册
"submitRegSolution","writeRegCommunicationLog","queryExpertRegCommunicationLogs","updateOrdertatus","closeBdRegNeed"
], ],
apiSecretPathList: ["/api/icp/consultation/submit","/api/icp/feedback/submit","/api/icp/order/notify","/api/opreceive/service/create","/api/icp/order/close","/api/opreceive/service/notify","/api/icp/queueNotify/springBoard",] apiSecretPathList: [
"/api/icp/consultation/submit",
"/api/icp/feedback/submit",
"/api/icp/order/notify",
"/api/opreceive/service/create",
"/api/icp/order/close",
"/api/opreceive/service/notify",
"/api/icp/queueNotify/springBoard",
"/api/ic/consultation/submit",
"/api/ic/feedback/submit",
"/api/ic/order/notify",
"/api/ic/order/close",
"/api/ic/tool/icname"
]
} }
} }
...@@ -204,7 +204,7 @@ module.exports = function (app) { ...@@ -204,7 +204,7 @@ module.exports = function (app) {
app.use('/orderNotify/channelPayNotify', async function (req, res) { app.use('/orderNotify/channelPayNotify', async function (req, res) {
try { try {
var client_ip = system.get_client_ip(req); var client_ip = system.get_client_ip(req);
let result ={}; let result = {};
result = await utilsOrderSve.channelPayNotify(req.body, client_ip); result = await utilsOrderSve.channelPayNotify(req.body, client_ip);
logCtl.info({ logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "渠道支付订单通知 api层", optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "渠道支付订单通知 api层",
...@@ -395,6 +395,23 @@ module.exports = function (app) { ...@@ -395,6 +395,23 @@ module.exports = function (app) {
//-----------------------新的模式---------api---------开始 //-----------------------新的模式---------api---------开始
//百度手动获取签名sign方法
// app.post("/baidu/creatSign", async function (req, res, next) {
// if (!req.body.key) {
// res.end({ code: -200, message: "缺少加签秘钥key参数" });
// return;
// }
// if (!req.body.obj) {
// res.end({ code: -200, message: "缺少obj参数" });
// return;
// }
// let obj = req.body.obj;
// let key = req.body.key;
// let result = await signSve.createSign(obj, key);
// res.end(JSON.stringify(result));
// return;
// });
app.all("/api/*", async function (req, res, next) { app.all("/api/*", async function (req, res, next) {
var result = system.getResult(null, "req method must is post"); var result = system.getResult(null, "req method must is post");
if (req.method != "POST") { if (req.method != "POST") {
...@@ -419,7 +436,7 @@ module.exports = function (app) { ...@@ -419,7 +436,7 @@ module.exports = function (app) {
} }
//1.通过appkey 获取appInfo //1.通过appkey 获取appInfo
var appRes = await signSve.getAppInfoByAppKey(appkey); var appRes = await signSve.getAppInfoByAppKey(appkey);
if(!appRes || appRes.status!=0){ if (!appRes || appRes.status != 0) {
result.msg = "获取应用信息失败"; result.msg = "获取应用信息失败";
result.data = null; result.data = null;
res.end(JSON.stringify(result)); res.end(JSON.stringify(result));
...@@ -429,20 +446,20 @@ module.exports = function (app) { ...@@ -429,20 +446,20 @@ module.exports = function (app) {
//2.通过appsecret 验签 //2.通过appsecret 验签
req.body.sign = sign; req.body.sign = sign;
var signParams = req.body; var signParams = req.body;
var verifyRes = await signSve.verifySign(req.body,appInfo.uapp_secret); var verifyRes = await signSve.verifySign(req.body, appInfo.uapp_secret);
if(verifyRes && verifyRes.status==0){ if (verifyRes && verifyRes.status == 0) {
req.body.appInfo = appInfo; req.body.appInfo = appInfo;
req.appInfo = appInfo; req.appInfo = appInfo;
req.actionProcess = appInfo.app_code; req.actionProcess = appInfo.app_code;
next(); next();
return; return;
}else{ } else {
res.end(JSON.stringify(verifyRes)); res.end(JSON.stringify(verifyRes));
return; return;
} }
} }
if (["getAppTokenByHosts", "getAppTokenByAppKey", "getTmNclFilterSearch","feedback","accountingInfo","booksInfo"].indexOf(req.body.actionType) >= 0) { if (["getAppTokenByHosts", "getAppTokenByAppKey", "getTmNclFilterSearch", "feedback", "accountingInfo", "booksInfo"].indexOf(req.body.actionType) >= 0) {
req.body.actionBody.appHosts = req.host; req.body.actionBody.appHosts = req.host;
next(); next();
return; return;
...@@ -653,7 +670,7 @@ module.exports = function (app) { ...@@ -653,7 +670,7 @@ module.exports = function (app) {
//icp需求推送 //icp需求推送
app.post('/icp/consultation/submit', function (req, res) { app.post('/icp/consultation/submit', function (req, res) {
var p = null; var p = null;
var params = ["icpnotify","icpSubmitNeed",req.body,req.query,req]; var params = ["icpnotify", "icpSubmitNeed", req.body, req.query, req];
// gname, methodname, pobj, query, req // gname, methodname, pobj, query, req
var invokeObj = system.getObject("api.action.icpnotify"); var invokeObj = system.getObject("api.action.icpnotify");
if (invokeObj["doexecMethod"]) { if (invokeObj["doexecMethod"]) {
...@@ -667,7 +684,7 @@ module.exports = function (app) { ...@@ -667,7 +684,7 @@ module.exports = function (app) {
app.post('/icp/feedback/submit', function (req, res) { app.post('/icp/feedback/submit', function (req, res) {
var p = null; var p = null;
req.body.action_type = "icpFeedbackSubmit"; req.body.action_type = "icpFeedbackSubmit";
var params = ["icpnotify","icpFeedbackSubmit",req.body,req.query,req]; var params = ["icpnotify", "icpFeedbackSubmit", req.body, req.query, req];
// gname, methodname, pobj, query, req // gname, methodname, pobj, query, req
var invokeObj = system.getObject("api.action.icpnotify"); var invokeObj = system.getObject("api.action.icpnotify");
if (invokeObj["doexecMethod"]) { if (invokeObj["doexecMethod"]) {
...@@ -681,7 +698,7 @@ module.exports = function (app) { ...@@ -681,7 +698,7 @@ module.exports = function (app) {
app.post('/icp/order/notify', function (req, res) { app.post('/icp/order/notify', function (req, res) {
var p = null; var p = null;
req.body.action_type = "icpNotify"; req.body.action_type = "icpNotify";
var params = ["icpnotify","icpNotify",req.body,req.query,req]; var params = ["icpnotify", "icpNotify", req.body, req.query, req];
// gname, methodname, pobj, query, req // gname, methodname, pobj, query, req
var invokeObj = system.getObject("api.action.icpnotify"); var invokeObj = system.getObject("api.action.icpnotify");
if (invokeObj["doexecMethod"]) { if (invokeObj["doexecMethod"]) {
......
...@@ -30,6 +30,7 @@ var settings = { ...@@ -30,6 +30,7 @@ var settings = {
} }
return "http://43.247.184.94:7200/center_channel_req_log/_doc?pretty"; return "http://43.247.184.94:7200/center_channel_req_log/_doc?pretty";
}, },
//百度icp、edi、nc、rt
baiduClientParams: function () { baiduClientParams: function () {
if (this.env == 'dev') { if (this.env == 'dev') {
return { return {
...@@ -46,6 +47,31 @@ var settings = { ...@@ -46,6 +47,31 @@ var settings = {
host:"gwgp-nbzljnwusrw.i.bdcloudapi.com" host:"gwgp-nbzljnwusrw.i.bdcloudapi.com"
}; };
}, },
//百度工商注册
baiduRegClientParams: function () {
if (this.env == 'dev') {
return {
domain:"https://gwgp-mwnn9gk4o4e.i.bdcloudapi.com",//开发
accessKey:"ed0f5c4c7c2d4e87aa335d9b07bf9bd4",
secretKey:"f600c4e91f6d43998d637401e6e34ef9",
host:"gwgp-mwnn9gk4o4e.i.bdcloudapi.com"
};
}
return {
domain:"https://gwgp-nbzljnwusrw.i.bdcloudapi.com",//线上
accessKey:"0e5abf33ef07457f8dbd779287747c0c",
secretKey:"9d86f04a85db4cdfa95ba8ad28009188",
host:"gwgp-nbzljnwusrw.i.bdcloudapi.com"
};
},
//工商核名请求接口配置
checkIcNameUrl() {
if (this.env === 'localhost') {
return 'http://127.0.0.1:35502/IcName/CheckName';
}
return 'http://ic-name-service/IcName/CheckName';
},
fbQueryUrl: function () { fbQueryUrl: function () {
if (this.env == 'dev' || this.env == 'test') { if (this.env == 'dev' || this.env == 'test') {
return 'http://43.247.184.92:15505' return 'http://43.247.184.92:15505'
......
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