Commit d292349e by 兰国旗

laolan

parent 9c5f0aed
......@@ -28,8 +28,8 @@ class Mediaaggregation extends APIBase {
var self = this;
pobj.xctx = req.xctx;
pobj.clientIp = req.clientIp;
if(pobj.company_id){
pobj["actionBody"]["company_id"] = pobj.company_id ||"10";
if (pobj.company_id) {
pobj["actionBody"]["company_id"] = pobj.company_id || "10";
}
switch (action_type) {
case "test"://测试
......@@ -80,9 +80,12 @@ class Mediaaggregation extends APIBase {
case "secondLevelNeedConfig"://二级留资页
opResult = await this.mediaaggregationSve.secondLevelNeedConfig(pobj);
break;
case "clueMaintenance"://二类产品资质选项(选取数据线索的数据)
case "clueMaintenance"://二类产品资质选项(选取数据线索的数据)、留资表单产品列表(我需要)
opResult = await this.mediaaggregationSve.clueMaintenance(pobj);
break;
case "cycleProductSecend"://周期产品二类
opResult = await this.mediaaggregationSve.cycleProductSecend(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -121,14 +121,14 @@ class MediaaggregationDao extends Dao {
*/
async productTypeSecend(req) {
var params = {
p_product_type_code: req.actionBody.p_product_type_code
p_code: req.actionBody.p_code
};
var returnRes = {
total: 0,//总记录条数
rows: []
};
var dataCount = "select count(1) as dataCount from mc_product left join mc_product_type on mc_product.product_type_id = mc_product_type.id where mc_product.deleted_at is null and mc_product_type.deleted_at is null and mc_product.is_enabled = 1 and p_product_type_code = :p_product_type_code ";
var sql = "select * from mc_product left join mc_product_type on mc_product.product_type_id = mc_product_type.id where mc_product.deleted_at is null and mc_product_type.deleted_at is null and mc_product.is_enabled = 1 and mc_product.p_product_type_code = :p_product_type_code ";
var dataCount = "select count(1) as dataCount from mc_product_type where deleted_at is null and p_code = :p_code ";
var sql = "select * from mc_product_type where deleted_at is null and p_code = :p_code ";
var list = await this.customQuery(sql, params);
returnRes.rows = list;
......@@ -142,7 +142,6 @@ class MediaaggregationDao extends Dao {
async productDetail(req) {
var params = {
code: req.actionBody.code
};
var sql = "select * from mc_product where deleted_at is null and is_enabled = 1 and code = :code ";
var list = await this.customQuery(sql, params);
......@@ -185,13 +184,13 @@ class MediaaggregationDao extends Dao {
return returnRes;
}
/**
* 二级留资页热门推荐
*/
async secondLevelNeedConfig(req) {
var params = {
code: req.actionBody.code
};
var returnRes = {
total: 0,//总记录条数
......@@ -209,19 +208,52 @@ class MediaaggregationDao extends Dao {
/**
* 二级产品资质选项
* 二类产品资质选项(选取数据线索的数据)、留资表单产品列表(我需要)
*/
async clueMaintenance(req) {
var params = {
code: req.actionBody.code,
};
var apiType = req.actionBody.apiType;
var returnRes = {
total: 0,//总记录条数
rows: []
};
var dataCount = "select count(1) as dataCount from mc_clue_maintenance where deleted_at is null ";
var sql = "select * from mc_clue_maintenance where deleted_at is null ";
if(apiType && apiType == '1'){//二类产品资质选项(选取数据线索的数据)
var dataCount = "select count(1) as dataCount from mc_clue_maintenance where deleted_at is null";
var sql = "select * from mc_clue_maintenance where deleted_at is null";
}
if(apiType && apiType == '2'){//留资表单产品列表(我需要)
var dataCount = "select count(1) as dataCount from mc_clue_maintenance where deleted_at is null and code = :code ";
var sql = "select * from mc_clue_maintenance where deleted_at is null and code = :code ";
}
var list = await this.customQuery(sql);
var list = await this.customQuery(sql, params);
returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount);
var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
/**
*周期产品二类
*/
async cycleProductSecend(req) {
var params = {
cycle_type: req.actionBody.cycle_type
};
var returnRes = {
total: 0,//总记录条数
rows: []
};
var dataCount = "select count(1) as dataCount from mc_cycle_product where deleted_at is null and cycle_type = :cycle_type ";
var sql = "select * from mc_cycle_product where deleted_at is null and cycle_type = :cycle_type ";
var list = await this.customQuery(sql, params);
returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......
......@@ -68,7 +68,7 @@ class MediaaggregationSve {
//产品分类二类
async productTypeSecend(pobj) {
if (!pobj || !pobj.actionBody || !pobj.actionBody.p_product_type_code) {
if (!pobj || !pobj.actionBody || !pobj.actionBody.p_code) {
return system.getResultFail(-100, "参数错误");
}
......@@ -104,8 +104,7 @@ class MediaaggregationSve {
var res = await mediaaggregationDao.cycleProduct(pobj);
return system.getResultSuccess(res);
}
//二级留资页
async secondLevelNeedConfig(pobj) {
if (!pobj || !pobj.actionBody.code) {
......@@ -116,15 +115,25 @@ class MediaaggregationSve {
return system.getResultSuccess(res);
}
//二级产品资质选项
//二类产品资质选项(选取数据线索的数据)、留资表单产品列表(我需要)
async clueMaintenance(pobj) {
if (!pobj) {
if (!pobj || !pobj.actionBody.apiType) {
return system.getResultFail(-100, "参数错误");
}
var res = await mediaaggregationDao.clueMaintenance(pobj);
return system.getResultSuccess(res);
}
//周期产品二类
async cycleProductSecend(pobj) {
if (!pobj) {
return system.getResultFail(-100, "参数错误");
}
var res = await mediaaggregationDao.cycleProductSecend(pobj);
return system.getResultSuccess(res);
}
}
......
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