Commit b1b548a4 by linboxuan

定义优客actiontype

parent f2f5206c
var WEBBase = require("../../web.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class ProductAPI extends WEBBase {
constructor() {
super();
this.utilsUcommuneSve = system.getObject("service.utilsSve.utilsUcommuneSve");
}
/**
* 优客工厂
* 接口跳转-POST请求
* 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 "getIndustryInfo":// 获取行业信息
opResult = await this.utilsUcommuneSve.getUserInfo(pobj, pobj.actionBody);
break;
case "placeOrder":// 提交订单
opResult = await this.utilsUcommuneSve.getOrderList(pobj, pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = ProductAPI;
\ No newline at end of file
......@@ -25,6 +25,8 @@ class ProductAPI extends WEBBase {
case "getUserInfo":// 根据优客token获取用户信息,生成userPin返回前端
opResult = await this.utilsUcommuneSve.getUserInfo(pobj, pobj.actionBody);
break;
case "orderConfirm":// addOrder后调取支付
opResult = await this.utilsUcommuneSve.orderConfirm(pobj, pobj.actionBody);
case "getOrderList":// 优客调取订单列表用
opResult = await this.utilsUcommuneSve.getOrderList(pobj, pobj.actionBody);
break;
......
......@@ -12,13 +12,13 @@ class UtilsUcommuneService extends AppServiceBase {
/**
* 通过产品类别编码路径获取产品列表
* 根据优客token获取用户信息,生成userPin返回前端
* @param {*} pobj
* @param {*} actionBody userToken 为优客工厂的userToken
*/
async getUserInfo(pobj, actionBody) {
if (!actionBody.userToken) {
return system.getResult(null, "actionBody.token can not be empty,100410");
return system.getResult(null, "actionBody.token can not be empty,100410");
}
var url = settings.ucommuneUrl() + "third/getUserInfo"; // 调用优客工场接口 获取用户信息
// 拼接规则curl -k -H 'Content-type: application/json' -H 'authorization:{token}' -X POST {url} pobj作为发生错误时记录日志用
......@@ -33,20 +33,28 @@ class UtilsUcommuneService extends AppServiceBase {
}
return system.getResultSuccess({ userpin: tmpOpResult.data.userpin })
} else {
// 获取用户信息失败
return system.getResult(null, "Failed to get user information, 100420");
}
}
/**
* 获取产品详情
* @param {*} pobj
* @param {*} actionBody channelItemCode 渠道产品编码
* 优客调取订单列表用
* @param {*} pobj
* @param {*} actionBody
*/
async getOrderList(pobj, actionBody) {
if (!actionBody.channelItemCode) {
return system.getResult(null, "actionBody.channelItemCode can not be empty,100340");
}
var url = settings.centerAppUrl() + "action/opProduct/springBoard";
return await this.restPostUrl(pobj, url);
var reqUrl = this.centerOrderUrl + "action/order/springBoard";
var result = await this.restPostUrl(pobj, reqUrl);
return result;
}
/**
* addOrder后前端调取支付用
* @param {*} pobj
* @param {*} actionBody channelItemCode 渠道产品编码
*/
async orderConfirm(pobj, actionBody) {
}
//--------------------------------优客工厂相关接口--end----------------------------------------------------
......
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