Commit 9cdebda9 by 兰国旗

laolan

parent bda0c1cf
...@@ -67,7 +67,7 @@ class Mediaaggregation extends APIBase { ...@@ -67,7 +67,7 @@ class Mediaaggregation extends APIBase {
case "test"://测试 case "test"://测试
opResult = system.getResultSuccess("测试接口"); opResult = system.getResultSuccess("测试接口");
break; break;
case "productList"://首页产品列表 case "productList"://服务列表
opResult = await this.mediaaggregationSve.productList(pobj); opResult = await this.mediaaggregationSve.productList(pobj);
break; break;
case "rotationChartList"://首页轮播图 case "rotationChartList"://首页轮播图
......
...@@ -6,9 +6,12 @@ class MediaaggregationDao extends Dao { ...@@ -6,9 +6,12 @@ class MediaaggregationDao extends Dao {
} }
/** /**
* 获取产品列表 * 服务列表
*/ */
async productList() { async productList(req) {
var params = {
company_id: req.actionBody.company_id
};
var returnRes = { var returnRes = {
total: 0,//总记录条数 total: 0,//总记录条数
rows: [] rows: []
...@@ -16,10 +19,10 @@ class MediaaggregationDao extends Dao { ...@@ -16,10 +19,10 @@ class MediaaggregationDao extends Dao {
var dataCount = "select count(1) as dataCount from mc_product where deleted_at is null "; var dataCount = "select count(1) as dataCount from mc_product where deleted_at is null ";
var sql = "select * from mc_product where deleted_at is null "; var sql = "select * from mc_product where deleted_at is null ";
var list = await this.customQuery(sql); var list = await this.customQuery(sql,params);
returnRes.rows = list; returnRes.rows = list;
// var result = system.getResultSuccess(list); // var result = system.getResultSuccess(list);
var tmpResultCount = await this.customQuery(dataCount); 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;
var result = system.getResultSuccess(returnRes); var result = system.getResultSuccess(returnRes);
return result; return result;
...@@ -28,18 +31,22 @@ class MediaaggregationDao extends Dao { ...@@ -28,18 +31,22 @@ class MediaaggregationDao extends Dao {
/** /**
* 轮播图 * 轮播图
*/ */
async rotationChartList(){ async rotationChartList(req){
var params = {
// company_id: req.actionBody.company_id
company_id: 10
};
var returnRes = { var returnRes = {
total: 0,//总记录条数 total: 0,//总记录条数
rows: [] rows: []
}; };
var dataCount = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null "; var dataCount = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null and pic_type = 2 ";
var sql = "select * from mc_rotation_chart where deleted_at is null "; var sql = "select * from mc_rotation_chart where deleted_at is null and pic_type = 2 ";
var list = await this.customQuery(sql); var list = await this.customQuery(sql,params);
returnRes.rows = list; returnRes.rows = list;
// var result = system.getResultSuccess(list); // var result = system.getResultSuccess(list);
var tmpResultCount = await this.customQuery(dataCount); 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;
var result = system.getResultSuccess(returnRes); var result = system.getResultSuccess(returnRes);
return result; return result;
...@@ -49,7 +56,10 @@ class MediaaggregationDao extends Dao { ...@@ -49,7 +56,10 @@ class MediaaggregationDao extends Dao {
/** /**
* 留资表单产品 * 留资表单产品
*/ */
async needProductList(){ async needProductList(req){
var params = {
company_id: req.actionBody.company_id
};
var returnRes = { var returnRes = {
total: 0,//总记录条数 total: 0,//总记录条数
rows: [] rows: []
...@@ -57,10 +67,10 @@ class MediaaggregationDao extends Dao { ...@@ -57,10 +67,10 @@ class MediaaggregationDao extends Dao {
var dataCount = "select count(1) as dataCount from mc_second_level_need_config where deleted_at is null "; var dataCount = "select count(1) as dataCount from mc_second_level_need_config where deleted_at is null ";
var sql = "select * from mc_second_level_need_config where deleted_at is null "; var sql = "select * from mc_second_level_need_config where deleted_at is null ";
var list = await this.customQuery(sql); var list = await this.customQuery(sql,params);
returnRes.rows = list; returnRes.rows = list;
// var result = system.getResultSuccess(list); // var result = system.getResultSuccess(list);
var tmpResultCount = await this.customQuery(dataCount); 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;
var result = system.getResultSuccess(returnRes); var result = system.getResultSuccess(returnRes);
return result; return result;
...@@ -69,7 +79,10 @@ class MediaaggregationDao extends Dao { ...@@ -69,7 +79,10 @@ class MediaaggregationDao extends Dao {
/** /**
* 热门推荐 * 热门推荐
*/ */
async popularRecommendationList(){ async popularRecommendationList(req){
var params = {
company_id: req.actionBody.company_id
};
var returnRes = { var returnRes = {
total: 0,//总记录条数 total: 0,//总记录条数
rows: [] rows: []
...@@ -77,10 +90,10 @@ class MediaaggregationDao extends Dao { ...@@ -77,10 +90,10 @@ class MediaaggregationDao extends Dao {
var dataCount = "select count(1) as dataCount from mc_popular_recommendation where deleted_at is null "; var dataCount = "select count(1) as dataCount from mc_popular_recommendation where deleted_at is null ";
var sql = "select * from mc_popular_recommendation where deleted_at is null "; var sql = "select * from mc_popular_recommendation where deleted_at is null ";
var list = await this.customQuery(sql); var list = await this.customQuery(sql,params);
returnRes.rows = list; returnRes.rows = list;
// var result = system.getResultSuccess(list); // var result = system.getResultSuccess(list);
var tmpResultCount = await this.customQuery(dataCount); 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;
var result = system.getResultSuccess(returnRes); var result = system.getResultSuccess(returnRes);
return result; return result;
...@@ -89,18 +102,21 @@ class MediaaggregationDao extends Dao { ...@@ -89,18 +102,21 @@ class MediaaggregationDao extends Dao {
/** /**
* 产品分类一类 * 产品分类一类
*/ */
async productTypeFirst(){ async productTypeFirst(req){
var params = {
company_id: req.actionBody.company_id
};
var returnRes = { var returnRes = {
total: 0,//总记录条数 total: 0,//总记录条数
rows: [] rows: []
}; };
var dataCount = "select count(1) as dataCount from mc_product_type where deleted_at is null and p_id is null"; var dataCount = "select count(1) as dataCount from mc_product_type where deleted_at is null and (p_id is null or p_id = '' ) ";
var sql = "select * from mc_product_type where deleted_at is null and p_id is null"; var sql = "select * from mc_product_type where deleted_at is null and ( p_id is null or p_id = '' ) ";
var list = await this.customQuery(sql); var list = await this.customQuery(sql,params);
returnRes.rows = list; returnRes.rows = list;
// var result = system.getResultSuccess(list); // var result = system.getResultSuccess(list);
var tmpResultCount = await this.customQuery(dataCount); 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;
var result = system.getResultSuccess(returnRes); var result = system.getResultSuccess(returnRes);
return result; return result;
...@@ -111,7 +127,8 @@ class MediaaggregationDao extends Dao { ...@@ -111,7 +127,8 @@ class MediaaggregationDao extends Dao {
*/ */
async productTypeSecend(req){ async productTypeSecend(req){
var params = { var params = {
product_type_code: req.actionBody.product_type_code product_type_code: req.actionBody.product_type_code,
company_id: req.actionBody.company_id
}; };
var returnRes = { var returnRes = {
total: 0,//总记录条数 total: 0,//总记录条数
...@@ -133,7 +150,9 @@ class MediaaggregationDao extends Dao { ...@@ -133,7 +150,9 @@ class MediaaggregationDao extends Dao {
*/ */
async productDetail(req) { async productDetail(req) {
var params = { var params = {
product_type_code: req.actionBody.product_type_code product_type_code: req.actionBody.product_type_code,
company_id: req.actionBody.company_id
}; };
var sql = "select * from mc_product where deleted_at is null and product_type_code = :product_type_code"; var sql = "select * from mc_product where deleted_at is null and product_type_code = :product_type_code";
var list = await this.customQuery(sql, params); var list = await this.customQuery(sql, params);
...@@ -145,8 +164,7 @@ class MediaaggregationDao extends Dao { ...@@ -145,8 +164,7 @@ class MediaaggregationDao extends Dao {
*/ */
async bottomMenuConfig(req) { async bottomMenuConfig(req) {
var params = { var params = {
// company_id: req.actionBody.company_id, company_id: req.actionBody.company_id
company_id: 10
}; };
var returnRes = { var returnRes = {
total: 0,//总记录条数 total: 0,//总记录条数
...@@ -163,14 +181,6 @@ class MediaaggregationDao extends Dao { ...@@ -163,14 +181,6 @@ class MediaaggregationDao extends Dao {
var result = system.getResultSuccess(returnRes); var result = system.getResultSuccess(returnRes);
return result; return result;
} }
/**
*方案一
*/
// async firstAction(){
// }
} }
module.exports = MediaaggregationDao; module.exports = MediaaggregationDao;
\ No newline at end of file
...@@ -5,9 +5,9 @@ class MediaaggregationSve { ...@@ -5,9 +5,9 @@ class MediaaggregationSve {
constructor() { constructor() {
} }
//首页产品列表 //服务列表
async productList(pobj) { async productList(pobj) {
if (!pobj || !pobj.actionBody) { if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误"); return system.getResultFail(-100, "参数错误");
} }
var res =await mediaaggregationDao.productList(pobj); var res =await mediaaggregationDao.productList(pobj);
...@@ -16,7 +16,7 @@ class MediaaggregationSve { ...@@ -16,7 +16,7 @@ class MediaaggregationSve {
//首页轮播图 //首页轮播图
async rotationChartList(pobj) { async rotationChartList(pobj) {
if (!pobj || !pobj.actionBody) { if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误"); return system.getResultFail(-100, "参数错误");
} }
...@@ -25,7 +25,7 @@ class MediaaggregationSve { ...@@ -25,7 +25,7 @@ class MediaaggregationSve {
} }
//留资表单产品 //留资表单产品
async needProductList(pobj) { async needProductList(pobj) {
if (!pobj || !pobj.actionBody) { if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误"); return system.getResultFail(-100, "参数错误");
} }
...@@ -36,7 +36,7 @@ class MediaaggregationSve { ...@@ -36,7 +36,7 @@ class MediaaggregationSve {
//热门推荐 //热门推荐
async popularRecommendationList(pobj) { async popularRecommendationList(pobj) {
if (!pobj || !pobj.actionBody) { if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误"); return system.getResultFail(-100, "参数错误");
} }
...@@ -48,7 +48,7 @@ class MediaaggregationSve { ...@@ -48,7 +48,7 @@ class MediaaggregationSve {
//产品分类一类 //产品分类一类
async productTypeFirst(pobj) { async productTypeFirst(pobj) {
if (!pobj || !pobj.actionBody) { if (!pobj || !pobj.actionBody || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误"); return system.getResultFail(-100, "参数错误");
} }
...@@ -58,7 +58,7 @@ class MediaaggregationSve { ...@@ -58,7 +58,7 @@ class MediaaggregationSve {
//产品分类二类 //产品分类二类
async productTypeSecend(pobj) { async productTypeSecend(pobj) {
if (!pobj || !pobj.actionBody) { if (!pobj || !pobj.actionBody || !pobj.actionBody.product_type_code || !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误"); return system.getResultFail(-100, "参数错误");
} }
...@@ -67,7 +67,7 @@ class MediaaggregationSve { ...@@ -67,7 +67,7 @@ class MediaaggregationSve {
} }
//产品详情 //产品详情
async productDetail(pobj) { async productDetail(pobj) {
if (!pobj || !pobj.actionBody) { if (!pobj || !pobj.actionBody || !pobj.actionBody.product_type_code) {
return system.getResultFail(-100, "参数错误"); return system.getResultFail(-100, "参数错误");
} }
...@@ -77,7 +77,7 @@ class MediaaggregationSve { ...@@ -77,7 +77,7 @@ class MediaaggregationSve {
//吸底菜单 //吸底菜单
async bottomMenuConfig(pobj) { async bottomMenuConfig(pobj) {
if (!pobj || !pobj.actionBody) { if (!pobj || !pobj.actionBody|| !pobj.actionBody.company_id) {
return system.getResultFail(-100, "参数错误"); return system.getResultFail(-100, "参数错误");
} }
......
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