Commit 3f40e2a5 by 宋毅

Merge branch 'igirl-channel-gateway' of gitlab.gongsibao.com:jiangyong/zhichan…

Merge branch 'igirl-channel-gateway' of gitlab.gongsibao.com:jiangyong/zhichan into igirl-channel-gateway
parents b3dcd9e2 d1a82021
...@@ -12,7 +12,7 @@ class springboard { ...@@ -12,7 +12,7 @@ class springboard {
// this.setofbooksModel = CommSetofbooks.model(); // this.setofbooksModel = CommSetofbooks.model();
this.isAddPay = false; this.isAddPay = false;
this.paymentids = []; this.paymentids = [];
this.topic = require("../../utils").topic; //this.topic = require("../../utils").topic;
} }
/** /**
......
...@@ -10,7 +10,7 @@ class AppServiceBase { ...@@ -10,7 +10,7 @@ class AppServiceBase {
} }
/** /**
* 验证签名 * 验证签名
* @param {*} params 要验证的参数 * @param {*} params 要验证的参数
* @param {*} app_key 应用的校验key * @param {*} app_key 应用的校验key
*/ */
async verifySign(params, app_key) { async verifySign(params, app_key) {
...@@ -98,5 +98,13 @@ class AppServiceBase { ...@@ -98,5 +98,13 @@ class AppServiceBase {
} }
return uuid.join(''); return uuid.join('');
} }
getResult(uuid,msg){
return {
"requestId": uuid,
"success": !msg,
"errorMsg": msg||"",
"errorCode": "ok"
};
}
} }
module.exports = AppServiceBase; module.exports = AppServiceBase;
...@@ -279,9 +279,6 @@ class GatewaypushlogService extends ServiceBase { ...@@ -279,9 +279,6 @@ class GatewaypushlogService extends ServiceBase {
case "34": case "34":
pobj.area = "海南"; pobj.area = "海南";
break; break;
default:
pobj.area = "";
break;
} }
} }
if (!pobj.area) { if (!pobj.area) {
......
...@@ -52,12 +52,7 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -52,12 +52,7 @@ class UtilsNeedSve extends AppServiceBase {
var self = this; var self = this;
var tokenInfo = await this.getCenterToken(); var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) { if (tokenInfo.status != 0) {
return { return this.getResult(self.getUUID(),"getTokenInfo fail")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "getTokenInfo fail",
"errorCode": "ok"
};
} }
var userpin = ""; var userpin = "";
if(pobj.phone&&!pobj.mobile){ if(pobj.phone&&!pobj.mobile){
...@@ -96,45 +91,20 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -96,45 +91,20 @@ class UtilsNeedSve extends AppServiceBase {
} else { } else {
rtn = await self.execlient.execPostTK(sobj, url, token); rtn = await self.execlient.execPostTK(sobj, url, token);
if (rtn.status == 0) { if (rtn.status == 0) {
return { return this.getResult(rtn.requestId)
"requestId": rtn.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else { } else {
return { return this.getResult(rtn.requestId,rtn.msg)
"requestId": rtn.requestId,
"success": false,
"errorMsg": rtn.msg,
"errorCode": "ok"
};
} }
} }
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if (result.status == 0) { if (result.status == 0) {
return { return this.getResult(result.requestId)
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else { } else {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
} }
...@@ -167,22 +137,12 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -167,22 +137,12 @@ class UtilsNeedSve extends AppServiceBase {
"actionBody": pobj "actionBody": pobj
} }
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){ if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return { return this.getResult(self.getUUID(),"无效应用")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "无效应用",
"errorCode": "ok"
};
} }
var self = this; var self = this;
var tokenInfo = await this.getCenterTokenByApp(pobj.appInfo); var tokenInfo = await this.getCenterTokenByApp(pobj.appInfo);
if (tokenInfo.status != 0) { if (tokenInfo.status != 0) {
return { return this.getResult(self.getUUID(),"getTokenInfo fail")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "getTokenInfo fail",
"errorCode": "ok"
};
} }
var userpin = ""; var userpin = "";
if(pobj.phone&&!pobj.mobile){ if(pobj.phone&&!pobj.mobile){
...@@ -221,68 +181,33 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -221,68 +181,33 @@ class UtilsNeedSve extends AppServiceBase {
} else { } else {
rtn = await self.execlient.execPostTK(sobj, url, token); rtn = await self.execlient.execPostTK(sobj, url, token);
if (rtn.status == 0) { if (rtn.status == 0) {
return { return this.getResult(rtn.requestId)
"requestId": rtn.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else { } else {
return { return this.getResult(rtn.requestId,rtn.msg)
"requestId": rtn.requestId,
"success": false,
"errorMsg": rtn.msg,
"errorCode": "ok"
};
} }
} }
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if (result.status == 0) { if (result.status == 0) {
return { return this.getResult(result.requestId)
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else { } else {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
} }
//百度icp 2.3 请求 //百度icp 2.3 请求
async icpOrderStatus(pobj) { async icpOrderStatus(pobj) {
var self = this; var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){ if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return { return this.getResult(self.getUUID(),"无效应用")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "无效应用",
"errorCode": "ok"
};
} }
// 获取app token // 获取app token
// var tokenInfo = await this.getCenterToken(); // var tokenInfo = await this.getCenterToken();
var tokenInfo = await this.getCenterTokenByApp(pobj.appInfo); var tokenInfo = await this.getCenterTokenByApp(pobj.appInfo);
if (tokenInfo.status != 0) { if (tokenInfo.status != 0) {
return { return this.getResult(self.getUUID())
"requestId": self.getUUID(),
"success": false,
"errorMsg": "",
"errorCode": "ok"
};
} }
var token = tokenInfo.data.token; var token = tokenInfo.data.token;
// 引用属性,channel依赖bizId order依赖intentionBizId // 引用属性,channel依赖bizId order依赖intentionBizId
...@@ -426,12 +351,7 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -426,12 +351,7 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard"; var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
var result = await this.execlient.execPostTK(sobj, url, token); var result = await this.execlient.execPostTK(sobj, url, token);
if (result.status != 0) { if (result.status != 0) {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
userparam.actionBody.channelUserId = result.data.channelUserId userparam.actionBody.channelUserId = result.data.channelUserId
userparam.actionBody.mobile = result.data.publishMobile userparam.actionBody.mobile = result.data.publishMobile
...@@ -445,12 +365,7 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -445,12 +365,7 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/opreceive/accessAuth/springBoard"; var url = settings.centerChannelUrl() + "/api/opreceive/accessAuth/springBoard";
var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token); var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token);
if (userpinResultTmp.status != 0) { if (userpinResultTmp.status != 0) {
return { return this.getResult(userpinResultTmp.requestId,userpinResultTmp.msg)
"requestId": userpinResultTmp.requestId,
"success": false,
"errorMsg": userpinResultTmp.msg,
"errorCode": "ok"
};
} }
// icpNotify // icpNotify
var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard"; var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
...@@ -460,50 +375,25 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -460,50 +375,25 @@ class UtilsNeedSve extends AppServiceBase {
} }
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token,userpinResultTmp.data.userpin); var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token,userpinResultTmp.data.userpin);
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if (result.status != 0) { if (result.status != 0) {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
return { return this.getResult(result.requestId)
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} }
//百度icp 2.4 请求 关闭icp订单 //百度icp 2.4 请求 关闭icp订单
async icpOrderClose(pobj) { async icpOrderClose(pobj) {
var self = this; var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){ if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return { return this.getResult(self.getUUID(),"无效应用")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "无效应用",
"errorCode": "ok"
};
} }
// 获取app token // 获取app token
// var tokenInfo = await this.getCenterToken(); // var tokenInfo = await this.getCenterToken();
var tokenInfo = await this.getCenterTokenByApp(pobj.appInfo); var tokenInfo = await this.getCenterTokenByApp(pobj.appInfo);
if (tokenInfo.status != 0) { if (tokenInfo.status != 0) {
return { return this.getResult(self.getUUID())
"requestId": self.getUUID(),
"success": false,
"errorMsg": "",
"errorCode": "ok"
};
} }
var token = tokenInfo.data.token; var token = tokenInfo.data.token;
var sobj = { var sobj = {
...@@ -514,20 +404,10 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -514,20 +404,10 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard"; var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
var result = await this.execlient.execPostTK(sobj, url, token); var result = await this.execlient.execPostTK(sobj, url, token);
if (result.status != 0 || !result.data) { if (result.status != 0 || !result.data) {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
if(!result.data.solutionContent || !result.data.solutionContent.customerInfo || !result.data.solutionContent.customerInfo.publishMobile){ if(!result.data.solutionContent || !result.data.solutionContent.customerInfo || !result.data.solutionContent.customerInfo.publishMobile){
return { return this.getResult(result.requestId,"方案客户信息有误")
"requestId": result.requestId,
"success": false,
"errorMsg": "方案客户信息有误",
"errorCode": "ok"
};
} }
// 获取userpin // 获取userpin
var userparam = { var userparam = {
...@@ -541,12 +421,7 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -541,12 +421,7 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/opreceive/accessAuth/springBoard"; var url = settings.centerChannelUrl() + "/api/opreceive/accessAuth/springBoard";
var userpinResultTmp = await this.execlient.execPostTK(userparam, url, token); var userpinResultTmp = await this.execlient.execPostTK(userparam, url, token);
if (userpinResultTmp.status != 0) { if (userpinResultTmp.status != 0) {
return { return this.getResult(userpinResultTmp.requestId,userpinResultTmp.msg)
"requestId": userpinResultTmp.requestId,
"success": false,
"errorMsg": userpinResultTmp.msg,
"errorCode": "ok"
};
} }
var closeobj = { var closeobj = {
"actionType": "icpOrderClose", "actionType": "icpOrderClose",
...@@ -555,28 +430,13 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -555,28 +430,13 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard"; var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
var rtn = await this.execlient.execDataPostByTokenUserPin(closeobj, url, token,userpinResultTmp.data.userpin); var rtn = await this.execlient.execDataPostByTokenUserPin(closeobj, url, token,userpinResultTmp.data.userpin);
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if (result.status != 0) { if (result.status != 0) {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
return { return this.getResult(result.requestId)
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} }
// -------------提交Icp需求--------庄冰2020.10.21-------百度Icp接入使用--------end------------------ // -------------提交Icp需求--------庄冰2020.10.21-------百度Icp接入使用--------end------------------
async paySuccess(pobj) { async paySuccess(pobj) {
...@@ -586,12 +446,7 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -586,12 +446,7 @@ class UtilsNeedSve extends AppServiceBase {
} }
var tokenInfo = await this.getCenterToken(); var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) { if (tokenInfo.status != 0) {
return { return this.getResult(self.getUUID())
"requestId": self.getUUID(),
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
// return { "message": "success", "data": {}, "code": 200 } // return { "message": "success", "data": {}, "code": 200 }
} }
var userpin = ""; var userpin = "";
...@@ -612,54 +467,29 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -612,54 +467,29 @@ class UtilsNeedSve extends AppServiceBase {
var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token); var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token);
if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) { if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) {
// return { "message": "网络错误", "data": {}, "code": -102 } // return { "message": "网络错误", "data": {}, "code": -102 }
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
userpin = userpinResultTmp.data.userpin; userpin = userpinResultTmp.data.userpin;
if (!userpin) { if (!userpin) {
// return { "message": "网络错误", "data": {}, "code": -102 } // return { "message": "网络错误", "data": {}, "code": -102 }
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
} }
//带userpin请求 //带userpin请求
url = settings.centerChannelUrl() + "/api/opreceive/ic/springBoard"; url = settings.centerChannelUrl() + "/api/opreceive/ic/springBoard";
var token = tokenInfo.data.token; var token = tokenInfo.data.token;
var rtn = rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin); var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
// return { "message": "网络错误", "data": {}, "code": -102 } // return { "message": "网络错误", "data": {}, "code": -102 }
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if (result.status == 0) { if (result.status == 0) {
// return { "message": "true", "data": {}, "code": 200 } // return { "message": "true", "data": {}, "code": 200 }
return { return this.getResult(result.requestId)
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else { } else {
// return { "message": result.msg, "data": {}, "code": -102 } // return { "message": result.msg, "data": {}, "code": -102 }
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
} }
...@@ -671,46 +501,76 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -671,46 +501,76 @@ class UtilsNeedSve extends AppServiceBase {
var self = this; var self = this;
var tokenInfo = await this.getCenterToken(); var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) { if (tokenInfo.status != 0) {
return { return this.getResult(self.getUUID())
"requestId": self.getUUID(),
"success": false,
"errorMsg": "",
"errorCode": "ok"
};
} }
var url = settings.centerChannelUrl() + "/api/opreceive/ic/springBoard"; var url = settings.centerChannelUrl() + "/api/opreceive/ic/springBoard";
var token = tokenInfo.data.token; var token = tokenInfo.data.token;
var rtn = await self.execlient.execPostTK(sobj, url, token); var rtn = await self.execlient.execPostTK(sobj, url, token);
if (rtn.status == 0) { if (rtn.status == 0) {
return { return this.getResult(rtn.requestId)
"requestId": rtn.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else { } else {
return { return this.getResult(rtn.requestId,rtn.msg)
"requestId": rtn.requestId,
"success": false,
"errorMsg": rtn.msg,
"errorCode": "ok"
};
} }
} }
//商标建案后通知启服通保存TM_单号
async tmNotifyChannel(pobj){
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return this.getResult(self.getUUID())
}
var token = tokenInfo.data.token;
pobj.intentionBizId = pobj.bizId
// 获取userpin
var userparam = {
actionType: "getLoginByUserName",
actionBody: {}
};
var sobj = {
"actionType": "getItemByChannelNeedNo",
"actionBody": pobj
}
// getItemByChannelSolutionNo
var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
var result = await this.execlient.execPostTK(sobj, url, token);
if (result.status != 0) {
return this.getResult(result.requestId,result.msg)
}
userparam.actionBody.channelUserId = result.data.channelUserId
userparam.actionBody.mobile = result.data.publishMobile
userparam.actionBody.userName = result.data.publishMobile
pobj.publishMobile = result.data.publishMobile;
pobj.channelNeedNo = result.data.channelNeedNo;
pobj.needNo = result.data.needNo;
pobj.channelTypeCode = result.data.channelTypeCode;
pobj.province = result.data.solutionProvince;
var url = settings.centerChannelUrl() + "/api/opreceive/accessAuth/springBoard";
var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token);
if (userpinResultTmp.status != 0) {
return this.getResult(userpinResultTmp.requestId,userpinResultTmp.msg)
}
var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
var sobj = {
"actionType": "tmNotifySub",
"actionBody": pobj
}
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token,userpinResultTmp.data.userpin);
if (!rtn || !rtn.stdout) {
return this.getResult(this.getUUID(),"网络错误")
}
var result = JSON.parse(rtn.stdout);
if (result.status != 0) {
return this.getResult(result.requestId,result.msg)
}
return this.getResult(result.requestId)
}
//icp 2.3 请求 //icp 2.3 请求
async queryOrderState(pobj) { async queryOrderState(pobj) {
var self = this; var self = this;
// 获取app token // 获取app token
var tokenInfo = await this.getCenterToken(); var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) { if (tokenInfo.status != 0) {
return { return this.getResult(self.getUUID())
"requestId": self.getUUID(),
"success": false,
"errorMsg": "",
"errorCode": "ok"
};
} }
var token = tokenInfo.data.token; var token = tokenInfo.data.token;
// 引用属性,channel依赖bizId order依赖intentionBizId // 引用属性,channel依赖bizId order依赖intentionBizId
...@@ -729,12 +589,7 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -729,12 +589,7 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard"; var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
var result = await this.execlient.execPostTK(sobj, url, token); var result = await this.execlient.execPostTK(sobj, url, token);
if (result.status != 0) { if (result.status != 0) {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
pobj.mobile = result.data.solutionContent.customerInfo.publishMobile pobj.mobile = result.data.solutionContent.customerInfo.publishMobile
} }
...@@ -754,12 +609,7 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -754,12 +609,7 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard"; var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
var result = await this.execlient.execPostTK(sobj, url, token); var result = await this.execlient.execPostTK(sobj, url, token);
if (result.status != 0) { if (result.status != 0) {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
userparam.actionBody.channelUserId = result.data.channelUserId userparam.actionBody.channelUserId = result.data.channelUserId
userparam.actionBody.mobile = result.data.publishMobile userparam.actionBody.mobile = result.data.publishMobile
...@@ -773,12 +623,7 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -773,12 +623,7 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/opreceive/accessAuth/springBoard"; var url = settings.centerChannelUrl() + "/api/opreceive/accessAuth/springBoard";
var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token); var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token);
if (userpinResultTmp.status != 0) { if (userpinResultTmp.status != 0) {
return { return this.getResult(userpinResultTmp.requestId,userpinResultTmp.msg)
"requestId": userpinResultTmp.requestId,
"success": false,
"errorMsg": userpinResultTmp.msg,
"errorCode": "ok"
};
} }
// icpNotify // icpNotify
var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard"; var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
...@@ -788,40 +633,20 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -788,40 +633,20 @@ class UtilsNeedSve extends AppServiceBase {
} }
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token,userpinResultTmp.data.userpin); var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token,userpinResultTmp.data.userpin);
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if (result.status != 0) { if (result.status != 0) {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
return { return this.getResult(result.requestId)
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} }
// 2020 0925 lin 新增 阿里文网文 服务商侧提供接口2.1 提交用户需求给服务商 // 2020 0925 lin 新增 阿里文网文 服务商侧提供接口2.1 提交用户需求给服务商
async submitNeedAliEsp(pobj) { async submitNeedAliEsp(pobj) {
var tokenInfo = await this.getCenterToken(); var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) { if (tokenInfo.status != 0) {
return { return this.getResult(this.getUUID())
"requestId": self.getUUID(),
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} }
var token = tokenInfo.data.token; var token = tokenInfo.data.token;
var userpin = ""; var userpin = "";
...@@ -840,22 +665,12 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -840,22 +665,12 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/auth/accessAuth/springBoard"; var url = settings.centerChannelUrl() + "/api/auth/accessAuth/springBoard";
var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token); var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token);
if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) { if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) {
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
userpin = userpinResultTmp.data.userpin; userpin = userpinResultTmp.data.userpin;
if (!userpin) { if (!userpin) {
// return { "message": "网络错误", "data": {}, "code": -102 } // return { "message": "网络错误", "data": {}, "code": -102 }
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
} }
//带userpin请求 //带userpin请求
...@@ -870,28 +685,13 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -870,28 +685,13 @@ class UtilsNeedSve extends AppServiceBase {
} }
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin); var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if (result.status == 0) { if (result.status == 0) {
return { return this.getResult(result.requestId)
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else { } else {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
} }
...@@ -899,12 +699,7 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -899,12 +699,7 @@ class UtilsNeedSve extends AppServiceBase {
async needCloseAliEsp(pobj) { async needCloseAliEsp(pobj) {
var tokenInfo = await this.getCenterToken(); var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) { if (tokenInfo.status != 0) {
return { return this.getResult(self.getUUID())
"requestId": self.getUUID(),
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} }
var token = tokenInfo.data.token; var token = tokenInfo.data.token;
var userpin = ""; var userpin = "";
...@@ -922,22 +717,12 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -922,22 +717,12 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/auth/accessAuth/springBoard"; var url = settings.centerChannelUrl() + "/api/auth/accessAuth/springBoard";
var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token); var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token);
if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) { if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) {
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
userpin = userpinResultTmp.data.userpin; userpin = userpinResultTmp.data.userpin;
if (!userpin) { if (!userpin) {
// return { "message": "网络错误", "data": {}, "code": -102 } // return { "message": "网络错误", "data": {}, "code": -102 }
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
} }
//带userpin请求 //带userpin请求
...@@ -946,30 +731,15 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -946,30 +731,15 @@ class UtilsNeedSve extends AppServiceBase {
"actionType": pobj.action_type, "actionType": pobj.action_type,
"actionBody": pobj "actionBody": pobj
} }
var rtn = rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin); var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if (result.status == 0) { if (result.status == 0) {
return { return this.getResult(result.requestId)
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else { } else {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
} }
...@@ -977,12 +747,7 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -977,12 +747,7 @@ class UtilsNeedSve extends AppServiceBase {
async produceNoticeAliEsp(pobj) { async produceNoticeAliEsp(pobj) {
var tokenInfo = await this.getCenterToken(); var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) { if (tokenInfo.status != 0) {
return { return this.getResult(this.getUUID())
"requestId": this.getUUID(),
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} }
var token = tokenInfo.data.token; var token = tokenInfo.data.token;
var userpin = ""; var userpin = "";
...@@ -992,30 +757,15 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -992,30 +757,15 @@ class UtilsNeedSve extends AppServiceBase {
"actionType": pobj.action_type, "actionType": pobj.action_type,
"actionBody": pobj "actionBody": pobj
} }
var rtn = rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin); var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if (result.status == 0) { if (result.status == 0) {
return { return this.getResult(result.requestId)
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else { } else {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
} }
...@@ -1023,12 +773,7 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -1023,12 +773,7 @@ class UtilsNeedSve extends AppServiceBase {
async soulutionFeebackAliEsp(pobj) { async soulutionFeebackAliEsp(pobj) {
var tokenInfo = await this.getCenterToken(); var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) { if (tokenInfo.status != 0) {
return { return this.getResult(self.getUUID())
"requestId": self.getUUID(),
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} }
var token = tokenInfo.data.token; var token = tokenInfo.data.token;
var userpin = ""; var userpin = "";
...@@ -1038,30 +783,15 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -1038,30 +783,15 @@ class UtilsNeedSve extends AppServiceBase {
"actionType": pobj.action_type, "actionType": pobj.action_type,
"actionBody": pobj "actionBody": pobj
} }
var rtn = rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin); var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
return { return this.getResult(self.getUUID(),"网络错误")
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if (result.status == 0) { if (result.status == 0) {
return { return this.getResult(result.requestId)
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else { } else {
return { return this.getResult(result.requestId,result.msg)
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
} }
} }
} }
......
...@@ -4,6 +4,7 @@ const verify = require("../../base/utils/verify").Verify; ...@@ -4,6 +4,7 @@ const verify = require("../../base/utils/verify").Verify;
const CtxBody = require("../../base/utils/CtxBody"); const CtxBody = require("../../base/utils/CtxBody");
const tmSpringboard = require("../../base/controller/tm.springboard"); const tmSpringboard = require("../../base/controller/tm.springboard");
// var userCtl = system.getObject("web.auth.userCtl"); // var userCtl = system.getObject("web.auth.userCtl");
const utilsNeedSve = system.getObject("service.utilsSve.utilsNeedSve");
module.exports = function (app) { module.exports = function (app) {
app.post('/tm/springboard', async function(req, res) { app.post('/tm/springboard', async function(req, res) {
let body = req.body || {}; let body = req.body || {};
...@@ -13,6 +14,16 @@ module.exports = function (app) { ...@@ -13,6 +14,16 @@ module.exports = function (app) {
verify.notNull(body.ActionType, 'ActionType 不能为空!'); verify.notNull(body.ActionType, 'ActionType 不能为空!');
verify.notNull(body.ActionBody, 'ActionBody 不能为空!'); verify.notNull(body.ActionBody, 'ActionBody 不能为空!');
let data = await _tmSpringboard.transferRequest(); let data = await _tmSpringboard.transferRequest();
if (body.ActionType === "SaveTradeMarkProductSolution") {//提交注册方案到阿里
body.ActionBody.BizId = data.BizId//TM_单号
body.ActionBody.needNo = body.ActionBody.IntentionBizId
//body.ActionBody.serviceOrderNo//云服单号
//body.ActionBody.IntentionBizId//needid需求号
body.ActionBody.bizId = body.ActionBody.IntentionBizId
let result = await utilsNeedSve.tmNotifyChannel(body.ActionBody)//通知启服通保存
if (!result.success)
return CtxBody.error(res, {});
}
CtxBody.success(res, data); CtxBody.success(res, data);
console.log("----返回成功"); console.log("----返回成功");
} catch (error) { } catch (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