Commit 1dd7e3a8 by 庄冰

policy

parent 6cb184f9
var APIBase = require("../../api.base");
var system = require("../../../system");
class PolicyAPI extends APIBase {
constructor() {
super();
this.policySve = system.getObject("service.policy.policySve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionProcess) {
return system.getResult(null, "actionProcess参数不能为空");
}
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
var result = await this.opActionProcess(pobj,pobj.actionProcess, pobj.actionType, pobj.actionBody, req);
return result;
}
async opActionProcess(pobj,action_process, action_type, action_body, req) {
var opResult = null;
switch (action_type) {
// sy
case "test"://测试
opResult = system.getResultSuccess(null, "测试成功");
break;
case "policyQuery"://政策检索
opResult = await this.policySve.policyQuery(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = PolicyAPI;
\ No newline at end of file
const system = require("../../../system");
var settings = require("../../../../config/settings");
class PolicyService{
constructor() {
this.centerOrderUrl = settings.centerOrderUrl();
this.execClient = system.getObject("util.execClient");
};
async policyQuery(pobj) {
var url = this.centerOrderUrl + "action/policy/springBoard";
var rtn = await this.execClient.execPost(pobj, url);
var data = JSON.parse(rtn.stdout);
return data;
}
}
module.exports = PolicyService;
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