Commit db369724 by 宋毅

tj

parent 65d350a1
......@@ -29,7 +29,7 @@ class OpProductAPI extends APIBase {
opResult = await this.productSve.getProductDetail(pobj.actionBody, pobj.appInfo);
break;
case "getProductInterface"://获取产品接口信息
opResult = await this.productSve.getProductInterface(pobj.actionBody);
opResult = await this.productSve.getProductInterface(pobj, pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
......
const system = require("../../../system");
const Dao = require("../../dao.base");
class InterfaceinfoDao extends Dao {
constructor() {
super(Dao.getModelName(InterfaceinfoDao));
}
}
module.exports = InterfaceinfoDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
class OpinterfaceDao extends Dao {
constructor() {
super(Dao.getModelName(OpinterfaceDao));
}
}
module.exports = OpinterfaceDao;
const system = require("../../../system");
const Dao = require("../../dao.base");
class ProductInterfaceDao extends Dao {
constructor() {
super(Dao.getModelName(ProductInterfaceDao));
}
async getListByProductPriceId(productPriceId) {
return await this.model.findAll({
where: {
product_price_id: productPriceId
},
attributes: [
"id",
"interface_url",
"method_name",
"params",
"interface_type",
"interface_type_name",
"op_type",
"op_type_name",
"desc"],
raw: true
});
}
}
module.exports = ProductInterfaceDao;
......@@ -29,7 +29,7 @@ module.exports = {
//接口类型
"interface_type": { "bd": "本地", "yc": "远程" },
//操作类型
"op_type": { "addOrder": "添加订单", "pushOrder": "推送订单", "pushBusiness": "推送商机", "pushUpdateOrder": "推送修改订单", "pushUpdateContacts": "推送修改订单联系人" },
"op_type": { "addOrder": "添加订单", "pushOrder": "推送订单", "pushUpdateOrder": "推送修改订单", "pushUpdateOrderContacts": "推送修改订单联系人", "pushOrderBusiness": "推送订单商机", "pushOrderRefund": "推送订单退款", "pushNeedBusiness": "推送需求商机", "pushNeedNote": "推送需求小计", "pushCloseNeed": "推送关闭需求", "pushNeedSolution": "推送需求方案", "pushCloseNeedSolution": "推送关闭需求方案" },
//---------
"logLevel": { "debug": 0, "info": 1, "warn": 2, "error": 3, "fatal": 4 },
......
......@@ -2,8 +2,7 @@ const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("productinterface", {
product_id: DataTypes.INTEGER,
return db.define("interfaceinfo", {
interface_url: DataTypes.STRING(255),
method_name: DataTypes.STRING(100),
params: DataTypes.STRING(1024),
......@@ -33,7 +32,7 @@ module.exports = (db, DataTypes) => {
freezeTableName: true,
timestamps: true,
updatedAt: false,
tableName: 'p_product_interface',
tableName: 'p_interface_info',
validate: {
},
......
const system = require("../../../system");
const settings = require("../../../../config/settings");
const uiconfig = system.getUiConfig2(settings.appKey);
module.exports = (db, DataTypes) => {
return db.define("opinterface", {
uapp_id: DataTypes.INTEGER,
interface_id: DataTypes.INTEGER,
product_id: DataTypes.INTEGER,
is_enabled: { //状态 0禁用 1启用
type: DataTypes.BOOLEAN,
defaultValue: true,
},
}, {
paranoid: false,//假的删除
underscored: true,
version: true,
freezeTableName: true,
timestamps: true,
updatedAt: false,
tableName: 'p_op_interface',
validate: {
},
indexes: [
]
});
}
......@@ -2,9 +2,9 @@ const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class ProductInterfaceService extends ServiceBase {
class InterfaceinfoService extends ServiceBase {
constructor() {
super("dbproduct", ServiceBase.getDaoName(ProductInterfaceService));
super("dbapp", ServiceBase.getDaoName(InterfaceinfoService));
}
}
module.exports = ProductInterfaceService;
module.exports = InterfaceinfoService;
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class OpinterfaceService extends ServiceBase {
constructor() {
super("dbproduct", ServiceBase.getDaoName(OpinterfaceService));
}
}
module.exports = OpinterfaceService;
......@@ -6,7 +6,6 @@ class ProductService extends ServiceBase {
constructor() {
super("dbproduct", ServiceBase.getDaoName(ProductService));
this.productpriceDao = system.getObject("db.dbproduct.productpriceDao");
this.productinterfaceDao = system.getObject("db.dbproduct.productinterfaceDao");
}
/**
* 通过产品类别编码路径获取产品列表
......@@ -48,13 +47,19 @@ class ProductService extends ServiceBase {
* 获取产品接口信息
* @param {*} actionBody productId产品id
*/
async getProductInterface(actionBody) {
var list = await this.productinterfaceDao.getListByProductPriceId(actionBody.productPriceId);
// if (!item) {
// return system.getResult(null, "product to interface is data empty !");
// }
async getProductInterface(pobj, actionBody) {
var sql = "select * from v_op_interface where is_enabled=1 and uapp_id=" + pobj.appInfo.uapp_id + " and product_id=" + actionBody.product_id;
var list = await this.customQuery(sql);
return system.getResultSuccess(list);
}
/**
* 获取产品接口信息
* @param {*} actionBody productId产品id
*/
async getAppInterface(pobj, actionBody) {
var sql = "select * from v_op_interface where is_enabled=1 and product_id is null and uapp_id=" + pobj.appInfo.uapp_id;
var list = await this.customQuery(sql);
return system.getResultSuccess(list);
}
}
module.exports = ProductService;
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