Commit a12b9272 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 516aec8d 2ac5f39c
......@@ -45,7 +45,7 @@ class TradetransferAPI extends APIBase {
case "icpFeedbackSubmitNew"://接收方案反馈信息
opResult = await this.utilsNeedSve.reqcenterchannel2(pobj);
break;
case "icpOrderStatus"://接收方案反馈信息
case "icpOrderStatus"://icp订单状态变更
opResult = await this.utilsNeedSve.icpOrderStatus(pobj);
break;
case "icpOrderClose"://关闭icp订单
......
......@@ -323,7 +323,7 @@ class GatewaypushlogService extends ServiceBase {
return self.getResultSuccess(param.requestId);
}
//icp状态变更
//icp订单状态变更
async icpNotify(pobj) {
var self = this;
if (!pobj.bizId) {
......
......@@ -473,234 +473,5 @@ class RegCenterOrderService extends AppServiceBase {
};
}
// -------------提交reg需求--------laolan 2020.12.17-------百度reg接入使用--------end------------------
async paySuccess(pobj) {
var sobj = {
"actionType": pobj.action_type,
"actionBody": pobj
}
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return {
"requestId": regCfg.getUUID(),
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
// return { "message": "success", "data": {}, "code": 200 }
}
var userpin = "";
if (pobj.phone) {
//获取用户userpin
var userparam = {
actionType: "getLoginByUserName",
actionBody: {
"channelUserId": pobj.phone,
"mobile": pobj.phone,
"userName": pobj.phone
}
};
// pobj.actionBody.channelUserId = pobj.mobile;//渠道用户id,没有则用手机号
// pobj.actionBody.mobile = pobj.mobile;//用户手机号
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 { "message": "网络错误", "data": {}, "code": -102 }
return {
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
userpin = userpinResultTmp.data.userpin;
if (!userpin) {
// return { "message": "网络错误", "data": {}, "code": -102 }
return {
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
}
//带userpin请求
url = settings.centerChannelUrl() + "/api/opreceive/ic/springBoard";
var token = tokenInfo.data.token;
var rtn = rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) {
// return { "message": "网络错误", "data": {}, "code": -102 }
return {
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
var result = JSON.parse(rtn.stdout);
if (result.status == 0) {
// return { "message": "true", "data": {}, "code": 200 }
return {
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else {
// return { "message": result.msg, "data": {}, "code": -102 }
return {
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
}
}
async orderClose(pobj) {
var sobj = {
"actionType": pobj.action_type,
"actionBody": pobj
}
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return {
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "",
"errorCode": "ok"
};
}
var url = settings.centerChannelUrl() + "/api/opreceive/ic/springBoard";
var token = tokenInfo.data.token;
var rtn = await this.execlient.execPostTK(sobj, url, token);
if (rtn.status == 0) {
return {
"requestId": rtn.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
} else {
return {
"requestId": rtn.requestId,
"success": false,
"errorMsg": rtn.msg,
"errorCode": "ok"
};
}
}
//icp 2.3 请求
async queryOrderState(pobj) {
// 获取app token
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
return {
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "",
"errorCode": "ok"
};
}
var token = tokenInfo.data.token;
// 引用属性,channel依赖bizId order依赖intentionBizId
pobj.intentionBizId = pobj.bizId
// 获取userpin
var userparam = {
actionType: "getLoginByUserName",
actionBody: {}
};
if (pobj.isDirectBuy === "true") {//直购
if (!pobj.mobile) {
var sobj = {
"actionType": "getSolutionByChannelSolutionNo",
"actionBody": pobj
}
var url = settings.centerChannelUrl() + "/api/action/regapi/springBoard";
var result = await this.execlient.execPostTK(sobj, url, token);
if (result.status != 0) {
return {
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
}
pobj.mobile = result.data.solutionContent.customerInfo.publishMobile
}
userparam.actionBody.channelUserId = pobj.mobile
userparam.actionBody.mobile = pobj.mobile
userparam.actionBody.userName = pobj.mobile
pobj.publishMobile = pobj.mobile
pobj.channelTypeCode = pobj.bizId.startsWith("EDI") ? 7 : 5;
//pobj.province = pobj.companyLocation+`(${pobj.actionType})`
pobj.province = pobj.area
} else {
var sobj = {
"actionType": "getItemByChannelSolutionNo",
"actionBody": pobj
}
// getItemByChannelSolutionNo
var url = settings.centerChannelUrl() + "/api/action/regapi/springBoard";
var result = await this.execlient.execPostTK(sobj, url, token);
if (result.status != 0) {
return {
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
}
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 {
"requestId": userpinResultTmp.requestId,
"success": false,
"errorMsg": userpinResultTmp.msg,
"errorCode": "ok"
};
}
// icpNotify
var url = settings.centerChannelUrl() + "/api/action/regapi/springBoard";
var sobj = {
"actionType": "icpNotify",
"actionBody": pobj
}
var rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpinResultTmp.data.userpin);
if (!rtn || !rtn.stdout) {
return {
"requestId": regCfg.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
var result = JSON.parse(rtn.stdout);
if (result.status != 0) {
return {
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"errorCode": "ok"
};
}
return {
"requestId": result.requestId,
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
}
}
module.exports = RegCenterOrderService;
......@@ -131,6 +131,10 @@ class UtilsNeedSve extends AppServiceBase {
var tokenResult = JSON.parse(rtn.stdout);
return tokenResult;
}
/**
* @description 与reqcenterchannel方法的差别在于获取token方法不一样
* @param {*} pobj
*/
async reqcenterchannel2(pobj) {
var sobj = {
"actionType": pobj.action_type,
......
......@@ -13,8 +13,8 @@ class ExecClient {
async exec(cmd) {
//await后面表达式返回的promise对象,是then的语法糖,await返回then函数的返回值
//异常需要try/catch自己捕获或外部catch捕获
const {stdout, stderr} = await exec(cmd);
return {stdout, stderr};
const { stdout, stderr } = await exec(cmd);
return { stdout, stderr };
}
getUUID() {
......@@ -59,7 +59,7 @@ class ExecClient {
}
async exec2(cmd) {
return exec(cmd, {encoding: "base64"});
return exec(cmd, { encoding: "base64" });
}
FetchPostCmd(subData, url) {
......@@ -71,9 +71,22 @@ class ExecClient {
}
async execPost(subData, url) {
//本机windows curl json格式
// if (settings.env == 'dev') {
// const rs = await axios.post(url, subData, {
// auth: {
// username: "admines",
// password: "adminGSBes"
// }
// });
// const ret = {
// stdout: JSON.stringify(rs.data)
// }
// return ret;
// }
let cmd = this.FetchPostCmd(subData, url);
var result = await this.exec(cmd);
return result;
}
......@@ -109,8 +122,8 @@ class ExecClient {
var options = {
timeout: timeOut,
};
const {stdout, stderr} = await exec(cmd, options);
return {stdout, stderr};
const { stdout, stderr } = await exec(cmd, options);
return { stdout, stderr };
}
}
......
var settings={
redis:{
var settings = {
redis: {
host: "43.247.184.32",
port: 8967,
password: "Gongsibao2018",
db:10,
db: 10,
},
database:{
dbname : "igirl_api",
database: {
dbname: "igirl_api",
user: "write",
password: "write",
config: {
host: '43.247.184.35',
port: 8899,
dialect: 'mysql',
operatorsAliases: false,
pool: {
max: 5,
min: 0,
acquire: 90000000,
idle: 1000000
},
debug:false,
dialectOptions:{
requestTimeout: 999999,
// instanceName:'DEV'
} //设置MSSQL超时时间
}
},
reqEsDevUrl:"http://192.168.4.249:9200/",
reqHomePageDevUrl:"http://zcapi.apps.com:4002/",
reqAuthUrl:"http://sj.app.com:4002/auth"
operatorsAliases: false,
pool: {
max: 5,
min: 0,
acquire: 90000000,
idle: 1000000
},
debug: false,
dialectOptions: {
requestTimeout: 999999,
// instanceName:'DEV'
} //设置MSSQL超时时间
}
},
reqEsDevUrl: "http://192.168.4.249:9200/",
reqHomePageDevUrl: "http://zcapi.apps.com:4002/",
reqAuthUrl: "http://sj.app.com:4002/auth"
};
module.exports = settings;
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