Commit b342d76e by 庄冰

ic

parent d305fac5
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class IcAPI extends APIBase {
constructor() {
super();
// this.utilsProductSve = system.getObject("service.utilsSve.utilsProductSve");
this.centerorderSve = system.getObject("service.common.centerorderSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.actionType) {
return system.getResult(null, "actionType参数不能为空");
}
if(pobj.actionType=='getPolicyNeedList' || pobj.actionType=='submitPolicyNeedNotes' ){
if (!pobj.userInfo) {
return system.getResult(system.noLogin, "user no login!");
}
if (!pobj.appInfo) {
return system.getResult(system.noLogin, "app is null!");
}
}
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
var opResult = null;
switch (action_type) {
case "submitProgramme"://提交公司注册方案
opResult = await this.centerorderSve.submitProgramme(pobj);
break;
case "getProgrammeInfoByNeedNo"://根据需求查看方案列表
opResult = await this.centerorderSve.reqCenterOrderApi(pobj);
break;
case "receiveFeedback"://接收方案反馈信息(即方案作废)
opResult = await this.centerorderSve.reqCenterOrderApi(pobj);
break;
case "abolishProgramme"://服务商方案作废
opResult = await this.centerorderSve.abolishProgramme(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = IcAPI;
\ No newline at end of file
const system = require("../../../system");
const crypto = require('crypto');
var settings = require("../../../../config/settings");
class CenterorderService{
constructor() {
this.centerOrderUrl = settings.centerOrderUrl();
this.execClient = system.getObject("util.execClient");
this.aliclient = system.getObject("util.aliyunClient");
this.cacheManager = system.getObject("db.common.cacheManager");
};
//调用center-order
async reqCenterOrderApi(pobj,reqUrl){
var url = this.centerOrderUrl + "action/icapi/springBoard";
if(reqUrl){
var url = this.centerOrderUrl + reqUrl;
}
var rtn = await this.execClient.execPost(pobj, url);
var data = JSON.parse(rtn.stdout);
return data;
}
//提交公司注册方案
async submitProgramme(pobj){
var res = await this.reqCenterOrderApi(pobj);
if(res && res.status==0 && res.data && res.data.needinfo && res.data.needsolution){
var needinfo = res.data.needinfo;//需求信息
var needsolution = res.data.needsolution;//方案信息
//推送数据至阿
var bizType = pobj.actionBody.solutionContent.bizType || "";//业务类型里
var pushObj = {
intentionBizId:needinfo.channelNeedNo,bizType:bizType,solution:ab.solutionContent.solution
};
// var pushRes = await this.aliclient.reqbyget({action:"",reqbody:pushObj});
// if(pushRes && pushRes.SolutionBizId){
// var reqObj2 = {
// actionType:"receiveProgrammeNo",
// actionBody:{
// solutionNo:needsolution.needsolution,
// solutionBizId:pushRes.SolutionBizId
// }
// };
// await this.reqCenterOrderApi(reqObj2);//保存渠道方案id
// }
}
return system.getResultSuccess();
}
//服务商方案作废
async abolishProgramme(pobj){
var res = await this.reqCenterOrderApi(pobj);
if(res && res.status==0 && res.data && res.data.channelNeedNo){
//推送数据至阿
var pushObj = {
solutionBizId:res.data.channelNeedNo,note:pobj.actionBody.note || ""
};
// var pushRes = await this.aliclient.reqbyget({action:"",reqbody:pushObj});
}
return res;
}
}
module.exports = CenterorderService;
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