Commit d6106ce3 by 宋毅

修改判断

parents c9d8d04d b63258bf
......@@ -3,7 +3,8 @@ FROM registry.cn-beijing.aliyuncs.com/hantang2/node105:v2
MAINTAINER jy "jiangyong@gongsibao.com"
ADD igirl-channel-gateway /apps/igirl-channel-gateway/
WORKDIR /apps/igirl-channel-gateway/
RUN cnpm install -S
RUN yum install gcc-c++.x86_64 -y
RUN npm install --unsafe-perm=true --allow-root
CMD ["node","/apps/igirl-channel-gateway/main.js"]
......
......@@ -52,11 +52,11 @@ class UtilsNeedSve extends AppServiceBase {
var self = this;
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return this.getResult(self.getUUID(),"getTokenInfo fail")
return this.getResult(self.getUUID(), "getTokenInfo fail")
}
var userpin = "";
if(pobj.phone&&!pobj.mobile){
pobj.mobile=pobj.phone;
if (pobj.phone && !pobj.mobile) {
pobj.mobile = pobj.phone;
}
if (pobj.mobile) {
//获取用户userpin
......@@ -93,18 +93,18 @@ class UtilsNeedSve extends AppServiceBase {
if (rtn.status == 0) {
return this.getResult(rtn.requestId)
} else {
return this.getResult(rtn.requestId,rtn.msg)
return this.getResult(rtn.requestId, rtn.msg)
}
}
if (!rtn || !rtn.stdout) {
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
var result = JSON.parse(rtn.stdout);
if (result.status == 0) {
return this.getResult(result.requestId)
} else {
return this.getResult(result.requestId,result.msg)
return this.getResult(result.requestId, result.msg)
}
}
......@@ -140,17 +140,17 @@ class UtilsNeedSve extends AppServiceBase {
"actionType": pobj.action_type,
"actionBody": pobj
}
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return this.getResult(self.getUUID(),"无效应用")
if (!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret) {
return this.getResult(self.getUUID(), "无效应用")
}
var self = this;
var tokenInfo = await this.getCenterTokenByApp(pobj.appInfo);
if (tokenInfo.status != 0) {
return this.getResult(self.getUUID(),"getTokenInfo fail")
return this.getResult(self.getUUID(), "getTokenInfo fail")
}
var userpin = "";
if(pobj.phone&&!pobj.mobile){
pobj.mobile=pobj.phone;
if (pobj.phone && !pobj.mobile) {
pobj.mobile = pobj.phone;
}
if (pobj.mobile) {
//获取用户userpin
......@@ -187,25 +187,31 @@ class UtilsNeedSve extends AppServiceBase {
if (rtn.status == 0) {
return this.getResult(rtn.requestId)
} else {
return this.getResult(rtn.requestId,rtn.msg)
return this.getResult(rtn.requestId, rtn.msg)
}
}
if (!rtn || !rtn.stdout) {
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
var result = JSON.parse(rtn.stdout);
if (result.status == 0) {
return this.getResult(result.requestId)
} else {
return this.getResult(result.requestId,result.msg)
return this.getResult(result.requestId, result.msg)
}
}
//百度icp 2.3 请求
async icpOrderStatus(pobj) {
logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "icpOrderStatus:" + pobj.bizId,
op: "api/action/intentionapi/springBoard",
content: "入参:" + JSON.stringify(pobj),
clientIp: ""
});
var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return this.getResult(self.getUUID(),"无效应用")
if (!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret) {
return this.getResult(self.getUUID(), "无效应用")
}
// 获取app token
// var tokenInfo = await this.getCenterToken();
......@@ -221,7 +227,7 @@ class UtilsNeedSve extends AppServiceBase {
actionType: "getLoginByUserName",
actionBody: {}
};
if (pobj.isDirectBuy==1){//直购
if (pobj.isDirectBuy == 1) {//直购
userparam.actionBody.channelUserId = pobj.phone
userparam.actionBody.mobile = pobj.phone
userparam.actionBody.userName = pobj.phone
......@@ -345,8 +351,26 @@ class UtilsNeedSve extends AppServiceBase {
break;
}
}
if(pobj.appInfo.uapp_id == "52"){ // 易名渠道
if(pobj.consultType =='5'){ // ICP 申请
pobj.province = pobj.area + '-申请';
}else if(pobj.consultType =="7"){ // EDI 申请
pobj.province = pobj.area + '-申请';
}else{
pobj.province = pobj.area;
}
}else{
pobj.province = pobj.area;
}else {
}
logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "直购订单参数处理:" + pobj.bizId,
op: "api/action/intentionapi/springBoard",
content: "处理结果:" + JSON.stringify(pobj),
clientIp: ""
});
} else {
var sobj = {
"actionType": "getItemByChannelSolutionNo",
"actionBody": pobj
......@@ -355,7 +379,7 @@ class UtilsNeedSve extends AppServiceBase {
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)
return this.getResult(result.requestId, result.msg)
}
userparam.actionBody.channelUserId = result.data.channelUserId
userparam.actionBody.mobile = result.data.publishMobile
......@@ -369,7 +393,7 @@ class UtilsNeedSve extends AppServiceBase {
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)
return this.getResult(userpinResultTmp.requestId, userpinResultTmp.msg)
}
// icpNotify
var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
......@@ -377,21 +401,21 @@ class UtilsNeedSve extends AppServiceBase {
"actionType": "icpNotifyNew",
"actionBody": pobj
}
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) {
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
var result = JSON.parse(rtn.stdout);
if (result.status != 0) {
return this.getResult(result.requestId,result.msg)
return this.getResult(result.requestId, result.msg)
}
return this.getResult(result.requestId)
}
//百度icp 2.4 请求 关闭icp订单
async icpOrderClose(pobj) {
var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return this.getResult(self.getUUID(),"无效应用")
if (!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret) {
return this.getResult(self.getUUID(), "无效应用")
}
// 获取app token
// var tokenInfo = await this.getCenterToken();
......@@ -404,45 +428,66 @@ class UtilsNeedSve extends AppServiceBase {
"actionType": "getSolutionByChannelOrderNo",
"actionBody": pobj
}
// getItemByChannelSolutionNo
// getSolutionByChannelOrderNo
var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
var result = await this.execlient.execPostTK(sobj, url, token);
if (result.status != 0 || !result.data) {
return this.getResult(result.requestId,result.msg)
return this.getResult(result.requestId, result.msg)
}
//阿里方案没有手机号,就从订单信息里拿
if (!result.data.solutionContent || !result.data.solutionContent.customerInfo || !result.data.solutionContent.customerInfo.publishMobile) {
// getOrderInfoByChannelOrderNo
var sobj1 = {
"actionType": "getOrderInfoByChannelOrderNo",
"actionBody": pobj
}
if(!result.data.solutionContent || !result.data.solutionContent.customerInfo || !result.data.solutionContent.customerInfo.publishMobile){
return this.getResult(result.requestId,"方案客户信息有误")
var url1 = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
var result1 = await this.execlient.execPostTK(sobj1, url1, token);
if (result1.status != 0 || !result1.data) {
return this.getResult(result1.requestId, result1.msg)
}
// 获取userpin
var userparam = {
actionType: "getLoginByUserName",
actionBody: {
channelUserId:result.data.solutionContent.customerInfo.publishMobile,
mobile:result.data.solutionContent.customerInfo.publishMobile,
userName:result.data.solutionContent.customerInfo.publishMobile
channelUserId: result1.data.channelUserId,
mobile: result1.data.channelUserId,
userName: result1.data.channelUserId
}
};
// return this.getResult(result.requestId, "方案客户信息有误")
} else {
// 获取userpin
var userparam = {
actionType: "getLoginByUserName",
actionBody: {
channelUserId: result.data.solutionContent.customerInfo.publishMobile,
mobile: result.data.solutionContent.customerInfo.publishMobile,
userName: result.data.solutionContent.customerInfo.publishMobile
}
};
}
var url = settings.centerChannelUrl() + "/api/opreceive/accessAuth/springBoard";
var userpinResultTmp = await this.execlient.execPostTK(userparam, url, token);
if (userpinResultTmp.status != 0) {
return this.getResult(userpinResultTmp.requestId,userpinResultTmp.msg)
return this.getResult(userpinResultTmp.requestId, userpinResultTmp.msg)
}
var closeobj = {
"actionType": "icpOrderClose",
"actionBody": pobj
}
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) {
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
var result = JSON.parse(rtn.stdout);
if (result.status != 0) {
return this.getResult(result.requestId,result.msg)
return this.getResult(result.requestId, result.msg)
}
return this.getResult(result.requestId)
}
// -------------提交Icp需求--------庄冰2020.10.21-------百度Icp接入使用--------end------------------
// -------------提交Icp需求--------庄冰2020.10.21-------百度Icp接入使用--------end------------------
async paySuccess(pobj) {
var sobj = {
"actionType": pobj.action_type,
......@@ -471,12 +516,12 @@ class UtilsNeedSve extends AppServiceBase {
var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token);
if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) {
// return { "message": "网络错误", "data": {}, "code": -102 }
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
userpin = userpinResultTmp.data.userpin;
if (!userpin) {
// return { "message": "网络错误", "data": {}, "code": -102 }
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
}
//带userpin请求
......@@ -485,7 +530,7 @@ class UtilsNeedSve extends AppServiceBase {
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) {
// return { "message": "网络错误", "data": {}, "code": -102 }
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
var result = JSON.parse(rtn.stdout);
if (result.status == 0) {
......@@ -493,7 +538,7 @@ class UtilsNeedSve extends AppServiceBase {
return this.getResult(result.requestId)
} else {
// return { "message": result.msg, "data": {}, "code": -102 }
return this.getResult(result.requestId,result.msg)
return this.getResult(result.requestId, result.msg)
}
}
......@@ -514,11 +559,11 @@ class UtilsNeedSve extends AppServiceBase {
if (rtn.status == 0) {
return this.getResult(rtn.requestId)
} else {
return this.getResult(rtn.requestId,rtn.msg)
return this.getResult(rtn.requestId, rtn.msg)
}
}
//商标建案后通知启服通保存TM_单号
async tmNotifyChannel(pobj){
async tmNotifyChannel(pobj) {
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return this.getResult(self.getUUID())
......@@ -538,7 +583,7 @@ class UtilsNeedSve extends AppServiceBase {
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)
return this.getResult(result.requestId, result.msg)
}
userparam.actionBody.channelUserId = result.data.channelUserId
userparam.actionBody.mobile = result.data.publishMobile
......@@ -551,20 +596,20 @@ class UtilsNeedSve extends AppServiceBase {
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)
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);
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpinResultTmp.data.userpin);
if (!rtn || !rtn.stdout) {
return this.getResult(this.getUUID(),"网络错误")
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, result.msg)
}
return this.getResult(result.requestId)
}
......@@ -584,8 +629,8 @@ class UtilsNeedSve extends AppServiceBase {
actionType: "getLoginByUserName",
actionBody: {}
};
if (pobj.isDirectBuy === "true"){//直购
if (!pobj.mobile){
if (pobj.isDirectBuy === "true") {//直购
if (!pobj.mobile) {
var sobj = {
"actionType": "getSolutionByChannelSolutionNo",
"actionBody": pobj
......@@ -593,7 +638,7 @@ class UtilsNeedSve extends AppServiceBase {
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)
return this.getResult(result.requestId, result.msg)
}
pobj.mobile = result.data.solutionContent.customerInfo.publishMobile
}
......@@ -601,10 +646,10 @@ class UtilsNeedSve extends AppServiceBase {
userparam.actionBody.mobile = pobj.mobile
userparam.actionBody.userName = pobj.mobile
pobj.publishMobile = pobj.mobile
pobj.channelTypeCode = pobj.bizId.startsWith("EDI")?7:5;
pobj.channelTypeCode = pobj.bizId.startsWith("EDI") ? 7 : 5;
//pobj.province = pobj.companyLocation+`(${pobj.actionType})`
pobj.province = pobj.area
}else {
} else {
var sobj = {
"actionType": "getItemByChannelSolutionNo",
"actionBody": pobj
......@@ -618,7 +663,7 @@ class UtilsNeedSve extends AppServiceBase {
console.log("商标没查到方案,直接推送fqboos----->",pushres)
return this.getResult(result.requestId, pushres.message)
}
return this.getResult(result.requestId,result.msg)
return this.getResult(result.requestId, result.msg)
}
userparam.actionBody.channelUserId = result.data.channelUserId
userparam.actionBody.mobile = result.data.publishMobile
......@@ -632,7 +677,7 @@ class UtilsNeedSve extends AppServiceBase {
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)
return this.getResult(userpinResultTmp.requestId, userpinResultTmp.msg)
}
// icpNotify
var url = settings.centerChannelUrl() + "/api/opreceive/need/springBoard";
......@@ -640,13 +685,13 @@ class UtilsNeedSve extends AppServiceBase {
"actionType": "icpNotify",
"actionBody": pobj
}
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) {
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
var result = JSON.parse(rtn.stdout);
if (result.status != 0) {
return this.getResult(result.requestId,result.msg)
return this.getResult(result.requestId, result.msg)
}
return this.getResult(result.requestId)
}
......@@ -674,18 +719,18 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/auth/accessAuth/springBoard";
var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token);
if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) {
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
userpin = userpinResultTmp.data.userpin;
if (!userpin) {
// return { "message": "网络错误", "data": {}, "code": -102 }
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
}
//带userpin请求
url = settings.centerChannelUrl() + "/api/opreceive/edi/springBoard";
// 2020 0927 lin 新增 type 由 esp.wangwen 转换为 wangwen
if(pobj.type == "esp.wangwen") {
if (pobj.type == "esp.wangwen") {
pobj.type == "wangwen"
}
var sobj = {
......@@ -694,13 +739,13 @@ class UtilsNeedSve extends AppServiceBase {
}
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) {
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
var result = JSON.parse(rtn.stdout);
if (result.status == 0) {
return this.getResult(result.requestId)
} else {
return this.getResult(result.requestId,result.msg)
return this.getResult(result.requestId, result.msg)
}
}
......@@ -726,12 +771,12 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/auth/accessAuth/springBoard";
var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token);
if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) {
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
userpin = userpinResultTmp.data.userpin;
if (!userpin) {
// return { "message": "网络错误", "data": {}, "code": -102 }
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
}
//带userpin请求
......@@ -742,13 +787,13 @@ class UtilsNeedSve extends AppServiceBase {
}
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) {
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
var result = JSON.parse(rtn.stdout);
if (result.status == 0) {
return this.getResult(result.requestId)
} else {
return this.getResult(result.requestId,result.msg)
return this.getResult(result.requestId, result.msg)
}
}
......@@ -768,13 +813,13 @@ class UtilsNeedSve extends AppServiceBase {
}
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) {
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
var result = JSON.parse(rtn.stdout);
if (result.status == 0) {
return this.getResult(result.requestId)
} else {
return this.getResult(result.requestId,result.msg)
return this.getResult(result.requestId, result.msg)
}
}
......@@ -794,13 +839,13 @@ class UtilsNeedSve extends AppServiceBase {
}
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) {
return this.getResult(self.getUUID(),"网络错误")
return this.getResult(self.getUUID(), "网络错误")
}
var result = JSON.parse(rtn.stdout);
if (result.status == 0) {
return this.getResult(result.requestId)
} else {
return this.getResult(result.requestId,result.msg)
return this.getResult(result.requestId, result.msg)
}
}
}
......
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