Commit 9f0b513c by linboxuan

tradetransfer add acceptOrder,tmRefuse

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