Commit 8957a52f by 王栋源

wdy

parent d2f2642f
...@@ -7,6 +7,7 @@ class TradetransferAPI extends APIBase { ...@@ -7,6 +7,7 @@ class TradetransferAPI extends APIBase {
super(); super();
this.execlient = system.getObject("util.execClient"); this.execlient = system.getObject("util.execClient");
this.channelApiUrl = settings.channelApiUrl(); this.channelApiUrl = settings.channelApiUrl();
this.utilsNeedSve = system.getObject("service.utilsSve.utilsNeedSve");
} }
/** /**
...@@ -18,33 +19,38 @@ class TradetransferAPI extends APIBase { ...@@ -18,33 +19,38 @@ class TradetransferAPI extends APIBase {
async springBoard(pobj, qobj, req) { async springBoard(pobj, qobj, req) {
console.log(pobj); console.log(pobj);
console.log(req); console.log(req);
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
}
if (!pobj.action_type) { if (!pobj.action_type) {
return system.getResult(null, "actionType参数不能为空"); return system.getResult(null, "actionType参数不能为空");
} }
console.log(pobj); console.log(pobj);
// var result = await this.opActionProcess(pobj.actionProcess, pobj.actionType, pobj.actionBody, req); var result = await this.opActionProcess(pobj, pobj.action_type);
// return result; return result;
}
async opActionProcess(pobj, action_type) {
var opResult = null;
switch (action_type) {
case "submitNeed"://提交需求
opResult = await this.utilsNeedSve.reqcenterchannel(pobj);
break;
case "needClose"://关闭需求
opResult = await this.utilsNeedSve.reqcenterchannel(pobj);
break;
case "receiveFeedback"://接收方案反馈信息
opResult = await this.utilsNeedSve.reqcenterchannel(pobj);
break;
case "paySuccess"://支付回调
opResult = await this.utilsNeedSve.paySuccess(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
} }
// async opActionProcess(action_process, action_type, action_body, req) {
// var opResult = null;
// settings.channelApiUrl+""
// var sobj = {
// "actionProcess": "aliyuntmtransfer",
// "actionType": "aliclient",
// "sign": "2FviZ9PGws8Pt1fBhq0t90mjUvI",
// "isUser": "yes",
// "actionBody": action_body
// }
// var tokenInfo = await this.getToken();
// var url = this.centerChannelUrl + "/action/tradetransfer/createtransfer";
// var rtn = await this.execlient.execPostTK(sobj, url, tokenInfo.data.token);
// return rtn;
// }
} }
module.exports = TradetransferAPI; module.exports = TradetransferAPI;
...@@ -142,13 +142,13 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -142,13 +142,13 @@ class UtilsNeedSve extends AppServiceBase {
} }
var tokenInfo = await this.getCenterToken(); var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) { if (tokenInfo.status != 0) {
// return { return {
// "requestId": self.getUUID(), "requestId": self.getUUID(),
// "success": true, "success": true,
// "errorMsg": "", "errorMsg": "",
// "errorCode": "ok" "errorCode": "ok"
// }; };
return { "message": "success", "data": {}, "code": 200 } // return { "message": "success", "data": {}, "code": 200 }
} }
var userpin = ""; var userpin = "";
if (pobj.phone) { if (pobj.phone) {
...@@ -167,23 +167,23 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -167,23 +167,23 @@ class UtilsNeedSve extends AppServiceBase {
var url = settings.centerChannelUrl() + "/api/auth/accessAuth/springBoard"; var url = settings.centerChannelUrl() + "/api/auth/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 { "message": "网络错误", "data": {}, "code": -102 } // return { "message": "网络错误", "data": {}, "code": -102 }
// return { return {
// "requestId": self.getUUID(), "requestId": self.getUUID(),
// "success": false, "success": false,
// "errorMsg": "网络错误", "errorMsg": "网络错误",
// "errorCode": "ok" "errorCode": "ok"
// }; };
} }
userpin = userpinResultTmp.data.userpin; userpin = userpinResultTmp.data.userpin;
if (!userpin) { if (!userpin) {
return { "message": "网络错误", "data": {}, "code": -102 } // return { "message": "网络错误", "data": {}, "code": -102 }
// return { return {
// "requestId": self.getUUID(), "requestId": self.getUUID(),
// "success": false, "success": false,
// "errorMsg": "网络错误", "errorMsg": "网络错误",
// "errorCode": "ok" "errorCode": "ok"
// }; };
} }
} }
//带userpin请求 //带userpin请求
...@@ -191,31 +191,31 @@ class UtilsNeedSve extends AppServiceBase { ...@@ -191,31 +191,31 @@ class UtilsNeedSve extends AppServiceBase {
var token = tokenInfo.data.token; var token = tokenInfo.data.token;
var rtn = rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin); var rtn = rtn = await this.execlient.execDataPostByTokenUserPin(sobj, url, token, userpin);
if (!rtn || !rtn.stdout) { if (!rtn || !rtn.stdout) {
return { "message": "网络错误", "data": {}, "code": -102 } // return { "message": "网络错误", "data": {}, "code": -102 }
// return { return {
// "requestId": self.getUUID(), "requestId": self.getUUID(),
// "success": false, "success": false,
// "errorMsg": "网络错误", "errorMsg": "网络错误",
// "errorCode": "ok" "errorCode": "ok"
// }; };
} }
var result = JSON.parse(rtn.stdout); var result = JSON.parse(rtn.stdout);
if (result.status == 0) { if (result.status == 0) {
return { "message": "true", "data": {}, "code": 200 } // return { "message": "true", "data": {}, "code": 200 }
// return { return {
// "requestId": result.requestId, "requestId": result.requestId,
// "success": true, "success": true,
// "errorMsg": "", "errorMsg": "",
// "errorCode": "ok" "errorCode": "ok"
// }; };
} else { } else {
return { "message": result.msg, "data": {}, "code": -102 } // return { "message": result.msg, "data": {}, "code": -102 }
// return { return {
// "requestId": result.requestId, "requestId": result.requestId,
// "success": false, "success": false,
// "errorMsg": result.msg, "errorMsg": result.msg,
// "errorCode": "ok" "errorCode": "ok"
// }; };
} }
} }
......
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