Commit c35cc259 by 兰国旗

laolan

parent 5bb39aef
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class QcAPI2 extends APIBase {
constructor() {
super();
this.centerorderSve = system.getObject("service.common.qcCenterOrderSve");
this.baseOrderSve = system.getObject("service.common.baseCenterOrderSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "getNeedSolutionDetailByUser"://获取方案详情
opResult = await this.baseOrderSve.reqCenterOrderApi(pobj, "action/baseapi/springBoard");
break;
case "submitIcpProgramme"://icp方案提交
opResult = await this.baseOrderSve.submitIcpProgramme(pobj);
break;
case "receiveProgrammeNo"://接收渠道方案号(测试)
opResult = await this.baseOrderSve.reqCenterOrderApi(pobj);
break;
// case "submitIcpMaterial"://icp材料提交
// opResult = await this.baseOrderSve.submitIcpMaterial(pobj);
// break;
// case "acceptIcpPartnerNotification"://icp通知状态变更
// opResult = await this.baseOrderSve.acceptIcpPartnerNotification(pobj);
// break;
case "abolishIcpProgramme"://服务商icp方案关闭
opResult = await this.baseOrderSve.abolishIcpProgramme(pobj);
break;
case "getProgrammeInfoByChannelNeedNo"://获取需求方案列表
opResult = await this.baseOrderSve.reqCenterOrderApi(pobj, "action/baseapi/springBoard");
break;
case "serviceProviderSubmitMaterial"://交付商提交材料信息
opResult = await this.baseOrderSve.serviceProviderSubmitMaterial(pobj);
break;
case "serviceProviderNotification"://交付商通知状态变更
opResult = await this.baseOrderSve.serviceProviderNotification(pobj);
break;
case "closeOrderDelivery"://交付商关闭交付单
opResult = await this.baseOrderSve.closeOrderDelivery(pobj);
break;
// --------- 文网文 ---------
case "serviceSubmitOption"://服务商提交服务操作(文网文)2020-9-26
opResult = await this.baseOrderSve.serviceSubmitOption(pobj);
break;
case "submitWangwenSolution"://提交方案(文网文)2020-9-26
opResult = await this.baseOrderSve.submitWangwenSolution(pobj);
break;
case "closeNeed"://关闭需求(文网文)2020-9-28
opResult = await this.baseOrderSve.closeNeed(pobj);
break;
case "recordLog"://提交沟通记录(文网文)2020-9-28
opResult = await this.baseOrderSve.recordLog(pobj);
break;
case "recordLogList"://查询沟通记录(文网文)2020-9-29
opResult = await this.baseOrderSve.recordLogList(pobj);
break;
// --------- 食品 ---------
case "foodServiceSubmitOption"://服务商提交服务操作(文网文)2020-9-26
opResult = await this.baseOrderSve.foodServiceSubmitOption(pobj);
break;
case "submitFoodSolution"://提交方案(文网文)2020-9-26
opResult = await this.baseOrderSve.submitFoodSolution(pobj);
break;
case "foodCloseNeed"://关闭需求(文网文)2020-9-28
opResult = await this.baseOrderSve.foodCloseNeed(pobj);
break;
case "foodRecordLog"://提交沟通记录(文网文)2020-9-28
opResult = await this.baseOrderSve.foodRecordLog(pobj);
break;
case "foodRecordLogList"://查询沟通记录(文网文)2020-9-29
opResult = await this.baseOrderSve.foodRecordLogList(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = QcAPI2;
\ No newline at end of file
const system = require("../system");
class baiduClient {
constructor() {
this.pushlogSve = system.getObject("service.common.pushlogSve");
}
//2020 1027 laolan 调用百度网关
async baiduPost(baidRreqUrl, accessKeyId, accessKeySecret, endpoint, actionBody) {
accessKeyId = "ff2571490b4c4fb5add57385dc5e8f66";
accessKeySecret = "9d86f04a85db4cdfa95ba8ad28009188";
endpoint = "https://iam.bj.baidubce.com";
var param = {
data: actionBody,
timeout: 20000,
headers: {
accept: 'application/json'
}
};
console.log(JSON.stringify(param), "______________峰擎---百度云参数_______");
var result = await this.baiduPost(baidRreqUrl, param);
console.log(JSON.stringify(result), "______________峰擎---百度云返回结果_______");
return result;
}
//百度接口 2020-10-27 laolan
async baiduReqbyget(obj, cbk) {
var action = obj.action;
var reqbody = obj.reqbody;
try {
var reqBaiduClient = null;// { ... this.baiduClient };
var res = await reqBaiduClient.request(action, reqbody, {
timeout: 10000, // default 3000 ms 修改3000为10000,原因ConfirmIcpIntention BizIds 超过5条会超时
formatAction: true, // default true, format the action to Action
formatParams: true, // default true, format the parameter name to first letter upper case
method: 'GET', // set the http method, default is GET
headers: {}, // set the http request headers
});
this.pushlogSve.createDb({
op: "new-baiduReqbyget",
content: JSON.stringify(obj),//推送的参数信息
resultInfo: JSON.stringify(res),
returnType: '1',
logLevel: '1',
opTitle: "new-baiduReqbyget推送百度信息返回成功"
});
return system.getResultSuccess(res);
} catch (e) {
this.pushlogSve.createFailLogDb({
appid: obj.appInfo ? obj.appInfo.uapp_id || "" : "",
appkey: obj.appInfo ? obj.appInfo.uapp_key || "" : "",
requestId: obj.requestId || "",
content: JSON.stringify(obj),//推送的参数信息
resultInfo: "error:" + JSON.stringify(e),
clientIp: obj.clientIp || "",
failType: 1,
opTitle: "new-baiduReqbyget推送百度信息返回异常",
pushNumber: obj.pushNumber || 1
});
return system.getResultFail(-200, "出现异常,error:" + e.stack);
}
}
}
module.exports = baiduClient;
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