Commit 0245c298 by 兰国旗

laolan

parent e25dabb9
......@@ -81,7 +81,7 @@ class TradetransferAPI extends APIBase {
case "submitRegNeed"://提交reg需求
opResult = await this.regCenterOrderSve.reqcenterchannel2(pobj);
break;
case "regFeedbackSubmit"://接收方案反馈信息
case "regFeedbackSubmit"://接收方案需求信息
opResult = await this.regCenterOrderSve.reqcenterchannel2(pobj);
break;
case "regOrderStatus"://接收方案反馈信息
......
......@@ -46,17 +46,16 @@ class RegCenterOrderService extends AppServiceBase {
}
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "无效应用",
"errorCode": "ok"
};
}
var self = this;
var tokenInfo = await this.getCenterTokenByApp(pobj.appInfo);
if (tokenInfo.status != 0) {
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "getTokenInfo fail",
"errorCode": "ok"
......@@ -93,11 +92,10 @@ class RegCenterOrderService extends AppServiceBase {
url = settings.centerChannelUrl() + "/api/action/regapi/springBoard";
var token = tokenInfo.data.token;
var rtn = null;
var self = this;
if (userpin) {
rtn = await self.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
} else {
rtn = await self.execlient.execPostTK(sobj, url, token);
rtn = await this.execlient.execPostTK(sobj, url, token);
if (rtn.status == 0) {
return {
"requestId": rtn.requestId,
......@@ -116,7 +114,7 @@ class RegCenterOrderService extends AppServiceBase {
}
if (!rtn || !rtn.stdout) {
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
......@@ -142,10 +140,9 @@ class RegCenterOrderService extends AppServiceBase {
}
//百度reg 2.3 请求
async regOrderStatus(pobj) {
var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "无效应用",
"errorCode": "ok"
......@@ -156,7 +153,7 @@ class RegCenterOrderService extends AppServiceBase {
var tokenInfo = await this.getCenterTokenByApp(pobj.appInfo);
if (tokenInfo.status != 0) {
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "",
"errorCode": "ok"
......@@ -168,22 +165,18 @@ class RegCenterOrderService extends AppServiceBase {
actionType: "getLoginByUserName",
actionBody: {}
};
var i=0;
var orderLength = pobj.Length
for(i=0;i<=orderLength;i++){
// 引用属性,channel依赖bizId order依赖intentionBizId
pobj[i].intentionBizId = pobj[i].bizId
pobj.intentionBizId = pobj.bizId
if (pobj.isDirectBuy==1){//直购
userparam.actionBody.channelUserId = pobj.phone
userparam.actionBody.mobile = pobj.phone
userparam.actionBody.userName = pobj.phone
pobj.publishMobile = pobj.phone
pobj.channelTypeCode = pobj.consultType;
if (pobj[i].area) {
pobj[i].area = regCfg.baiduArea[pobj[i].area]
if (pobj.area) {
pobj.area = regCfg.baiduArea[pobj.area]
}
pobj[i].province = pobj[i].area;
pobj.province = pobj.area;
}else {
var sobj = {
"actionType": "getItemByChannelSolutionNo",
......@@ -203,13 +196,12 @@ class RegCenterOrderService extends AppServiceBase {
userparam.actionBody.channelUserId = result.data.channelUserId
userparam.actionBody.mobile = result.data.publishMobile
userparam.actionBody.userName = result.data.publishMobile
pobj[i].publishMobile = result.data.publishMobile;
pobj[i].channelNeedNo = result.data.channelNeedNo;
pobj.publishMobile = result.data.publishMobile;
pobj.channelNeedNo = result.data.channelNeedNo;
pobj[i].needNo = result.data.needNo;
pobj[i].channelTypeCode = result.data.channelTypeCode;
pobj[i].province = result.data.solutionProvince;//北京(新购)?
}
pobj.needNo = result.data.needNo;
pobj.channelTypeCode = result.data.channelTypeCode;
pobj.province = result.data.solutionProvince;//北京(新购)?
}
var url = settings.centerChannelUrl() + "/api/opreceive/accessAuth/springBoard";
......@@ -231,7 +223,7 @@ class RegCenterOrderService extends AppServiceBase {
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token,userpinResultTmp.data.userpin);
if (!rtn || !rtn.stdout) {
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
......@@ -255,10 +247,9 @@ class RegCenterOrderService extends AppServiceBase {
}
//百度reg 2.4 请求 关闭reg订单
async regOrderClose(pobj) {
var self = this;
if(!pobj.appInfo || !pobj.appInfo.uapp_key || !pobj.appInfo.uapp_secret){
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "无效应用",
"errorCode": "ok"
......@@ -269,7 +260,7 @@ class RegCenterOrderService extends AppServiceBase {
var tokenInfo = await this.getCenterTokenByApp(pobj.appInfo);
if (tokenInfo.status != 0) {
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "",
"errorCode": "ok"
......@@ -326,7 +317,7 @@ class RegCenterOrderService extends AppServiceBase {
var rtn = await this.execlient.execDataPostByTokenUserPin(closeobj, url, token,userpinResultTmp.data.userpin);
if (!rtn || !rtn.stdout) {
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
......@@ -357,7 +348,7 @@ class RegCenterOrderService extends AppServiceBase {
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": true,
"errorMsg": "",
"errorCode": "ok"
......@@ -375,7 +366,6 @@ class RegCenterOrderService extends AppServiceBase {
"userName": pobj.phone
}
};
var self = this;
// pobj.actionBody.channelUserId = pobj.mobile;//渠道用户id,没有则用手机号
// pobj.actionBody.mobile = pobj.mobile;//用户手机号
var url = settings.centerChannelUrl() + "/api/auth/accessAuth/springBoard";
......@@ -383,7 +373,7 @@ class RegCenterOrderService extends AppServiceBase {
if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) {
// return { "message": "网络错误", "data": {}, "code": -102 }
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
......@@ -393,7 +383,7 @@ class RegCenterOrderService extends AppServiceBase {
if (!userpin) {
// return { "message": "网络错误", "data": {}, "code": -102 }
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
......@@ -407,7 +397,7 @@ class RegCenterOrderService extends AppServiceBase {
if (!rtn || !rtn.stdout) {
// return { "message": "网络错误", "data": {}, "code": -102 }
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
......@@ -438,11 +428,10 @@ class RegCenterOrderService extends AppServiceBase {
"actionType": pobj.action_type,
"actionBody": pobj
}
var self = this;
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "",
"errorCode": "ok"
......@@ -451,7 +440,7 @@ class RegCenterOrderService extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/opreceive/ic/springBoard";
var token = tokenInfo.data.token;
var rtn = await self.execlient.execPostTK(sobj, url, token);
var rtn = await this.execlient.execPostTK(sobj, url, token);
if (rtn.status == 0) {
return {
"requestId": rtn.requestId,
......@@ -471,12 +460,11 @@ class RegCenterOrderService extends AppServiceBase {
//icp 2.3 请求
async queryOrderState(pobj) {
var self = this;
// 获取app token
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "",
"errorCode": "ok"
......@@ -559,7 +547,7 @@ class RegCenterOrderService extends AppServiceBase {
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token,userpinResultTmp.data.userpin);
if (!rtn || !rtn.stdout) {
return {
"requestId": self.getUUID(),
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
......@@ -581,258 +569,5 @@ class RegCenterOrderService extends AppServiceBase {
"errorCode": "ok"
};
}
// 2020 0925 lin 新增 阿里文网文 服务商侧提供接口2.1 提交用户需求给服务商
async submitNeedAliEsp(pobj) {
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return {
"requestId": self.getUUID(),
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
}
var token = tokenInfo.data.token;
var userpin = "";
if (pobj.mobile) {
//获取用户userpin
var userparam = {
actionType: "getLoginByUserName",
actionBody: {
// 为什么2.1 有userId 但是不用 还要用mobile。因为模式不支持
"channelUserId": pobj.mobile,
"mobile": pobj.mobile,
"userName": pobj.userName ? pobj.userName : pobj.mobile
}
};
var self = this;
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 {
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
userpin = userpinResultTmp.data.userpin;
if (!userpin) {
// return { "message": "网络错误", "data": {}, "code": -102 }
return {
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
}
//带userpin请求
url = settings.centerChannelUrl() + "/api/opreceive/edi/springBoard";
// 2020 0927 lin 新增 type 由 esp.wangwen 转换为 wangwen
if(pobj.type == "esp.wangwen") {
pobj.type == "wangwen"
}
var sobj = {
"actionType": pobj.action_type,
"actionBody": pobj
}
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) {
return {
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
var result = JSON.parse(rtn.stdout);
if (result.status == 0) {
return {
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else {
return {
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
}
}
// 2020 0926 lin 新增 阿里文网文 服务商侧提供接口2.2 关闭需求通知服务商
async needCloseAliEsp(pobj) {
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return {
"requestId": self.getUUID(),
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
}
var token = tokenInfo.data.token;
var userpin = "";
if (pobj.mobile) {
//获取用户userpin
var userparam = {
actionType: "getLoginByUserName",
actionBody: {
"channelUserId": pobj.mobile,
"mobile": pobj.mobile,
"userName": pobj.userName ? pobj.userName : pobj.mobile
}
};
var self = this;
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 {
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
userpin = userpinResultTmp.data.userpin;
if (!userpin) {
// return { "message": "网络错误", "data": {}, "code": -102 }
return {
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
}
//带userpin请求
url = settings.centerChannelUrl() + "/api/opreceive/edi/springBoard";
var sobj = {
"actionType": pobj.action_type,
"actionBody": pobj
}
var rtn = rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) {
return {
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
var result = JSON.parse(rtn.stdout);
if (result.status == 0) {
return {
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else {
return {
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
}
}
// 2020 0927 lin 新增 阿里文网文 服务商侧提供接口2.3 服务单通知服务商
async produceNoticeAliEsp(pobj) {
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return {
"requestId": this.getUUID(),
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
}
var token = tokenInfo.data.token;
var userpin = "";
//带userpin请求
var url = settings.centerChannelUrl() + "/api/opreceive/edi/springBoard";
var sobj = {
"actionType": pobj.action_type,
"actionBody": pobj
}
var rtn = rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) {
return {
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
var result = JSON.parse(rtn.stdout);
if (result.status == 0) {
return {
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else {
return {
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
}
}
// 2020 0928 lin 新增 阿里文网文 服务商侧提供接口2.4 ⽤户⽅案反馈通知服务商
async soulutionFeebackAliEsp(pobj) {
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return {
"requestId": self.getUUID(),
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
}
var token = tokenInfo.data.token;
var userpin = "";
//带userpin请求
var url = settings.centerChannelUrl() + "/api/opreceive/edi/springBoard";
var sobj = {
"actionType": pobj.action_type,
"actionBody": pobj
}
var rtn = rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) {
return {
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
var result = JSON.parse(rtn.stdout);
if (result.status == 0) {
return {
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else {
return {
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
}
}
}
module.exports = RegCenterOrderService;
......@@ -87,6 +87,12 @@ var regCfg = {
"青岛": "370200",
"哈尔滨": "230100",
"石家庄": "130100"
}
},
//返回结果配置
getUUID() {
var uuid = uuidv4();
var u = uuid.replace(/\-/g, "");
return u;
},
}
module.exports = regCfg;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment