Commit c0a80448 by 兰国旗

laolan

parent c37cf26a
......@@ -65,6 +65,9 @@ class Mediaaggregation extends APIBase {
case "cycleProduct"://周期产品
opResult = await this.mediaaggregationSve.cycleProduct(pobj);
break;
case "secondLevelNeedConfig"://二级留资页
opResult = await this.mediaaggregationSve.secondLevelNeedConfig(pobj);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
......@@ -20,9 +20,9 @@ class MediaaggregationDao extends Dao {
var dataCount = "select count(1) as dataCount from mc_product where deleted_at is null and product_type_code = :product_type_code and company_id = :company_id ";
var sql = "select * from mc_product where deleted_at is null and product_type_code = :product_type_code and company_id = :company_id ";
var list = await this.customQuery(sql,params);
var list = await this.customQuery(sql, params);
returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount,params);
var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -30,7 +30,7 @@ class MediaaggregationDao extends Dao {
/**
* 轮播图
*/
async rotationChartList(req){
async rotationChartList(req) {
var params = {
company_id: req.actionBody.company_id
};
......@@ -41,18 +41,18 @@ class MediaaggregationDao extends Dao {
var dataCount = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null and pic_type = 2 and company_id = :company_id ";
var sql = "select * from mc_rotation_chart where deleted_at is null and pic_type = 2 and company_id = :company_id ";
var list = await this.customQuery(sql,params);
var list = await this.customQuery(sql, params);
returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount,params);
var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
/**
* 留资表单产品
*/
async needProductList(req){
async needProductList(req) {
var params = {
company_id: req.actionBody.company_id
};
......@@ -63,9 +63,9 @@ class MediaaggregationDao extends Dao {
var dataCount = "select count(1) as dataCount from mc_second_level_need_config where deleted_at is null and company_id = :company_id ";
var sql = "select * from mc_second_level_need_config where deleted_at is null and company_id = :company_id ";
var list = await this.customQuery(sql,params);
var list = await this.customQuery(sql, params);
returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount,params);
var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -73,7 +73,7 @@ class MediaaggregationDao extends Dao {
/**
* 热门推荐
*/
async popularRecommendationList(req){
async popularRecommendationList(req) {
var params = {
company_id: req.actionBody.company_id
};
......@@ -84,9 +84,9 @@ class MediaaggregationDao extends Dao {
var dataCount = "select count(1) as dataCount from mc_popular_recommendation where deleted_at is null and company_id = :company_id ";
var sql = "select * from mc_popular_recommendation where deleted_at is null and company_id = :company_id ";
var list = await this.customQuery(sql,params);
var list = await this.customQuery(sql, params);
returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount,params);
var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -94,7 +94,7 @@ class MediaaggregationDao extends Dao {
/**
* 产品分类一类
*/
async productTypeFirst(req){
async productTypeFirst(req) {
var params = {
company_id: req.actionBody.company_id
};
......@@ -105,9 +105,9 @@ class MediaaggregationDao extends Dao {
var dataCount = "select count(1) as dataCount from mc_product_type where deleted_at is null and p_id = 0 and company_id = :company_id ";
var sql = "select * from mc_product_type where deleted_at is null and p_id = 0 and company_id = :company_id ";
var list = await this.customQuery(sql,params);
var list = await this.customQuery(sql, params);
returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount,params);
var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -115,7 +115,7 @@ class MediaaggregationDao extends Dao {
/**
* 产品分类二类
*/
async productTypeSecend(req){
async productTypeSecend(req) {
var params = {
product_type_code: req.actionBody.product_type_code,
company_id: req.actionBody.company_id
......@@ -127,9 +127,9 @@ class MediaaggregationDao extends Dao {
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 product_type_code = :product_type_code and mc_product_type.company_id = :company_id ";
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 product_type_code = :product_type_code and mc_product_type.company_id = :company_id ";
var list = await this.customQuery(sql,params);
var list = await this.customQuery(sql, params);
returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount,params);
var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -140,16 +140,16 @@ class MediaaggregationDao extends Dao {
var params = {
code: req.actionBody.code,
company_id: req.actionBody.company_id
};
var sql = "select * from mc_product where deleted_at is null and code = :code and company_id = :company_id ";
var list = await this.customQuery(sql, params);
return list;
}
/**
* 吸底菜单
*/
/**
* 吸底菜单
*/
async bottomMenuConfig(req) {
var params = {
company_id: req.actionBody.company_id
......@@ -161,9 +161,9 @@ class MediaaggregationDao extends Dao {
var dataCount = "select count(1) as dataCount from mc_bottom_menu_config where deleted_at is null and company_id = :company_id ";
var sql = "select * from mc_bottom_menu_config where deleted_at is null and company_id = :company_id ";
var list = await this.customQuery(sql,params);
var list = await this.customQuery(sql, params);
returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount,params);
var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -173,7 +173,7 @@ class MediaaggregationDao extends Dao {
*/
async cycleProduct(req) {
var params = {
company_id: 10
company_id: req.actionBody.company_id
};
var returnRes = {
total: 0,//总记录条数
......@@ -182,12 +182,35 @@ class MediaaggregationDao extends Dao {
var dataCount = "select count(1) as dataCount from mc_cycle_product where deleted_at is null and company_id = :company_id ";
var sql = "select * from mc_cycle_product where deleted_at is null and company_id = :company_id ";
var list = await this.customQuery(sql,params);
var list = await this.customQuery(sql, params);
returnRes.rows = list;
var tmpResultCount = await this.customQuery(dataCount,params);
var tmpResultCount = await this.customQuery(dataCount, params);
returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
/**
* 二级留资页热门推荐
*/
async secondLevelNeedConfig(req) {
var params = {
company_id: req.actionBody.company_id,
code: req.actionBody.code
};
var returnRes = {
total: 0,//总记录条数
rows: []
};
var dataCount = "select count(1) as dataCount from mc_second_level_need_config where deleted_at is null and company_id = :company_id and code = :code ";
var sql = "select * from mc_second_level_need_config where deleted_at is null and company_id = :company_id and code = :code";
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;
}
}
module.exports = MediaaggregationDao;
\ No newline at end of file
......@@ -3,14 +3,14 @@ const mediaaggregationDao = system.getObject("db.mediaaggregation.mediaaggregati
class MediaaggregationSve {
constructor() {
}
//服务列表
async productList(pobj) {
if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id || !pobj.actionBody.product_type_code) {
return system.getResultFail(-100, "参数错误");
}
var res =await mediaaggregationDao.productList(pobj);
var res = await mediaaggregationDao.productList(pobj);
return system.getResultSuccess(res);
}
......@@ -19,8 +19,8 @@ class MediaaggregationSve {
if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误");
}
var res =await mediaaggregationDao.rotationChartList(pobj);
var res = await mediaaggregationDao.rotationChartList(pobj);
return system.getResultSuccess(res);
}
//留资表单产品
......@@ -28,8 +28,8 @@ class MediaaggregationSve {
if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误");
}
var res =await mediaaggregationDao.needProductList(pobj);
var res = await mediaaggregationDao.needProductList(pobj);
return system.getResultSuccess(res);
}
......@@ -39,8 +39,8 @@ class MediaaggregationSve {
if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误");
}
var res =await mediaaggregationDao.popularRecommendationList(pobj);
var res = await mediaaggregationDao.popularRecommendationList(pobj);
return system.getResultSuccess(res);
}
......@@ -51,18 +51,18 @@ class MediaaggregationSve {
if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误");
}
var res =await mediaaggregationDao.productTypeFirst(pobj);
var res = await mediaaggregationDao.productTypeFirst(pobj);
return system.getResultSuccess(res);
}
//产品分类二类
async productTypeSecend(pobj) {
if (!pobj || !pobj.actionBody || !pobj.actionBody.product_type_code || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误");
}
var res =await mediaaggregationDao.productTypeSecend(pobj);
var res = await mediaaggregationDao.productTypeSecend(pobj);
return system.getResultSuccess(res);
}
//产品详情
......@@ -70,30 +70,42 @@ class MediaaggregationSve {
if (!pobj || !pobj.actionBody || !pobj.actionBody.code || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误");
}
var res =await mediaaggregationDao.productDetail(pobj);
var res = await mediaaggregationDao.productDetail(pobj);
return system.getResultSuccess(res);
}
//吸底菜单
async bottomMenuConfig(pobj) {
if (!pobj || !pobj.actionBody|| !pobj.actionBody.company_id) {
if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误");
}
var res =await mediaaggregationDao.bottomMenuConfig(pobj);
var res = await mediaaggregationDao.bottomMenuConfig(pobj);
return system.getResultSuccess(res);
}
//周期产品
async cycleProduct(pobj) {
if (!pobj || !pobj.actionBody|| !pobj.actionBody.company_id) {
//周期产品
async cycleProduct(pobj) {
if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误");
}
var res = await mediaaggregationDao.cycleProduct(pobj);
return system.getResultSuccess(res);
}
//二级留资页
async secondLevelNeedConfig(pobj) {
if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id || !pobj.actionBody.code) {
return system.getResultFail(-100, "参数错误");
}
var res =await mediaaggregationDao.cycleProduct(pobj);
var res = await mediaaggregationDao.secondLevelNeedConfig(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