Commit 8957a52f by 王栋源

wdy

parent d2f2642f
......@@ -7,6 +7,7 @@ class TradetransferAPI extends APIBase {
super();
this.execlient = system.getObject("util.execClient");
this.channelApiUrl = settings.channelApiUrl();
this.utilsNeedSve = system.getObject("service.utilsSve.utilsNeedSve");
}
/**
......@@ -18,31 +19,36 @@ class TradetransferAPI extends APIBase {
async springBoard(pobj, qobj, req) {
console.log(pobj);
console.log(req);
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
}
if (!pobj.action_type) {
return system.getResult(null, "actionType参数不能为空");
}
console.log(pobj);
// var result = await this.opActionProcess(pobj.actionProcess, pobj.actionType, pobj.actionBody, req);
// return result;
var result = await this.opActionProcess(pobj, pobj.action_type);
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;
}
// 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;
// }
return opResult;
}
......
......@@ -142,13 +142,13 @@ class UtilsNeedSve extends AppServiceBase {
}
var tokenInfo = await this.getCenterToken();
if (tokenInfo.status != 0) {
// return {
// "requestId": self.getUUID(),
// "success": true,
// "errorMsg": "",
// "errorCode": "ok"
// };
return { "message": "success", "data": {}, "code": 200 }
return {
"requestId": self.getUUID(),
"success": true,
"errorMsg": "",
"errorCode": "ok"
};
// return { "message": "success", "data": {}, "code": 200 }
}
var userpin = "";
if (pobj.phone) {
......@@ -167,23 +167,23 @@ class UtilsNeedSve extends AppServiceBase {
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": self.getUUID(),
// "success": false,
// "errorMsg": "网络错误",
// "errorCode": "ok"
// };
// return { "message": "网络错误", "data": {}, "code": -102 }
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"
// };
// return { "message": "网络错误", "data": {}, "code": -102 }
return {
"requestId": self.getUUID(),
"success": false,
"errorMsg": "网络错误",
"errorCode": "ok"
};
}
}
//带userpin请求
......@@ -191,31 +191,31 @@ class UtilsNeedSve extends AppServiceBase {
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": self.getUUID(),
// "success": false,
// "errorMsg": "网络错误",
// "errorCode": "ok"
// };
// return { "message": "网络错误", "data": {}, "code": -102 }
return {
"requestId": self.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"
// };
// 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"
// };
// return { "message": result.msg, "data": {}, "code": -102 }
return {
"requestId": result.requestId,
"success": false,
"errorMsg": result.msg,
"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