Commit 9f0b513c by linboxuan

tradetransfer add acceptOrder,tmRefuse

parent 28ba15a1
......@@ -14,11 +14,15 @@ class TradetransferAPI extends APIBase {
async getToken() {
var self = this;
var reqTokenUrl = this.channelApiUrl + "/auth/accessAuth/getToken";
var reqParam = self.appInfo["aliyuntmtransfer"];
if (!reqParam.appkey || !reqParam.secret) {
return system.getResult(null, "reqType类型有误,请求失败");
var reqTokenUrl = this.channelApiUrl + "/web/auth/accessAuth/getAppTokenByHosts";
// var reqParam = self.appInfo["aliyuntmtransfer"];
var reqParam = {
"actionType": "getAppTokenByHosts",
"actionBody": {}
}
// if (!reqParam.appkey || !reqParam.secret) {
// return system.getResult(null, "reqType类型有误,请求失败");
// }
var rtn = await this.execlient.execPost(reqParam, reqTokenUrl);
if (!rtn.stdout) {
return system.getResult(null, "获取token失败");
......@@ -33,108 +37,126 @@ class TradetransferAPI extends APIBase {
//订单创建
// 2020 0828 lin 修改 匹配商标交易
async acceptOrder(pobj,qobj,req) {
if (!pobj.BizId) {
if (!qobj.BizId) {
return {
"ErrorCode": "error",
"ErrorMsg": "订单号不能为空",
"Module": { "orderNumber": "" },
"RequestId": req.requestId,
"Success": false
"errorCode": "error",
"errorMsg": "订单号不能为空",
"module": { "orderNumber": "" },
"eequestId": req.requestId,
"success": false
}
}
if (!pobj.UserName) {
if (!qobj.UserName) {
return {
"ErrorCode": "error",
"ErrorMsg": "用户不能为空",
"Module": { "orderNumber": "" },
"RequestId": req.requestId,
"Success": false
"errorCode": "error",
"errorMsg": "用户不能为空",
"module": { "orderNumber": "" },
"requestId": req.requestId,
"success": false
}
}
if (!pobj.Mobile) {
if (!qobj.Mobile) {
return {
"ErrorCode": "error",
"ErrorMsg": "用户手机号不能为空",
"Module": { "orderNumber": "" },
"RequestId": req.requestId,
"Success": false
"errorCode": "error",
"errorMsg": "用户手机号不能为空",
"module": { "orderNumber": "" },
"requestId": req.requestId,
"success": false
}
}
if (!pobj.Price) {
if (!qobj.Price) {
return {
"ErrorCode": "error",
"ErrorMsg": "价格不能为空",
"Module": { "orderNumber": "" },
"RequestId": req.requestId,
"Success": false
"errorCode": "error",
"errorMsg": "价格不能为空",
"module": { "orderNumber": "" },
"requestId": req.requestId,
"success": false
}
}
if (!pobj.RegisterNumber) {
if (!qobj.RegisterNumber) {
return {
"ErrorCode": "error",
"ErrorMsg": "商标注册号不能为空",
"Module": { "orderNumber": "" },
"RequestId": req.requestId,
"Success": false
"errorCode": "error",
"errorMsg": "商标注册号不能为空",
"module": { "orderNumber": "" },
"requestId": req.requestId,
"success": false
}
}
if (!pobj.Classification) {
if (!qobj.Classification) {
return {
"ErrorCode": "error",
"ErrorMsg": "商标国际一级分类不能为空",
"Module": { "orderNumber": "" },
"RequestId": req.requestId,
"Success": false
"errorCode": "error",
"errorMsg": "商标国际一级分类不能为空",
"module": { "orderNumber": "" },
"requestId": req.requestId,
"success": false
}
}
var sobj = {
"actionProcess": "aliyuntmtransfer",
"actionType": "aliclient",
"actionType": "tmAccept",
"actionBody": {
"bizId": pobj.BizId,
"userName": pobj.UserName,
"mobile": pobj.Mobile,
"registerNumber": pobj.RegisterNumber,
"classification": pobj.Classification,
"price": pobj.price
"bizId": qobj.BizId,
"userName": qobj.UserName,
"mobile": qobj.Mobile,
"registerNumber": qobj.RegisterNumber,
"classification": qobj.Classification,
"price": qobj.Price,
"channelItemCode":"tmjy",
"payCode": "tmjy-1",
"quantity":1,
"totalSum": qobj.Price,
"payTotalSum": qobj.Price,
"channelOrder":{
"channelServiceNo": qobj.BizId,
"channelOrderNo": qobj.BizId
}
}
}
// 获取token
var tokenInfo = await this.getToken();
if (tokenInfo.status != 0) {
return {
"ErrorCode": "error",
"ErrorMsg": "网络错误",
"Module": { "orderNumber": "" },
"RequestId": req.requestId,
"Success": false
"errorCode": "error",
"errorMsg": "渠道验证失败",
"module": { "orderNumber": "" },
"requestId": req.requestId,
"success": false
};
}
// 获取userpin
var userparam = {
actionType: "getLoginByUserName",
actionBody: {
"channelUserId": pobj.Mobile,
"mobile": pobj.Mobile,
"userName": pobj.Mobile
"channelUserId": qobj.Mobile,
"mobile": qobj.Mobile,
"userName": qobj.UserName
}
};
var url = settings.centerChannelUrl() + "/api/opreceive/accessAuth/springBoard";
var userpinResultTmp = await this.execlient.execPostTK(userparam, url, tokenInfo.data.token);
if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) {
return {
"ErrorCode": "error",
"ErrorMsg": "网络错误",
"Module": { "orderNumber": "" },
"RequestId": req.requestId,
"Success": false
"errorCode": "error",
"errorMsg": "用户验证失败",
"module": { "orderNumber": "" },
"requestId": req.requestId,
"success": false
};
}
// 调取channel 开始业务
var url = this.channelApiUrl + "/action/tradetransfer/createtransfer";
var url = this.channelApiUrl + "/web/opaction/tmOrder/springBoard";
// var rtn = await this.execlient.execPostTK(sobj, url, tokenInfo.data.token);
var rtn = rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, tokenInfo.data.token, userpinResultTmp.data.userpin);
return rtn;
if (!rtn.stdout) {
return {
"errorCode": "error",
"errorMsg": "建立订单失败",
"module": { "orderNumber": "" },
"requestId": req.requestId,
"success": false
};
}
return JSON.parse(rtn.stdout);
}
//订单查询
async queryOrderState(p,obj) {
......@@ -154,15 +176,16 @@ class TradetransferAPI extends APIBase {
}
//订单关闭
async closeOrder(p,obj) {
async tmRefuse(p,obj,req) {
var sobj = {
"actionProcess": "aliyuntmtransfer",
"actionType": "aliclient",
"sign": "2FviZ9PGws8Pt1fBhq0t90mjUvI",
"actionBody": p
"actionType": "tmRefuse",
"actionBody": {
bizId: obj.BizId
}
}
var tokenInfo = await this.getToken();
var url = this.channelApiUrl + "/action/tradetransfer/orderclose";
var url = this.channelApiUrl + "/web/opaction/tmOrder/springBoard";
var rtn = await this.execlient.execPostTK(sobj, url, tokenInfo.data.token);
// var rtn = await this.execlient.execPostTK(sobj, url,"token");
return rtn;
......
......@@ -33,14 +33,17 @@ var settings = {
},
channelApiUrl: function () {//----igirl-channel
if (this.env == "dev") {
return "http://192.168.210.192:4003";
// return "http://192.168.210.192:4003";
return "http://ali.qifu.gongsibao.com:4012";
} else {
return "http://zc-channel-service";
// return "http://zc-channel-service";
return "http://ali.qifu.gongsibao.com";
}
},
centerChannelUrl: function () {//---------center-channel
if (this.env == "dev") {
return "http://gsbweb.qifu-dev.gongsibao.com";//localsettings.reqEsDevUrl;
// return "http://gsbweb.qifu-dev.gongsibao.com";//localsettings.reqEsDevUrl;
return "http://gsbweb.qifu-dev.gongsibao.com:4012";
} else {
return "http://center-channel-service";
}
......
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