Commit d292349e by 兰国旗

laolan

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