Commit 07b7c7ad by 兰国旗

laolan

parent f7a0fa02
......@@ -18,18 +18,14 @@ class MediaaggregationDao extends Dao {
total: 0,//总记录条数
rows: []
};
var countSql = "select count(1) as dataCount from mc_product where deleted_at is null and product_type_code = :product_type_code and is_enabled = 1 ";
var sql = "select * from mc_product where deleted_at is null and product_type_code = :product_type_code and is_enabled = 1 ";
var optionType = "get";
var countSql = "select count(1) as dataCount from mc_product where deleted_at is null and product_type_code = :product_type_code and is_enabled = 1 order by sequence desc";
var sql = "select * from mc_product where deleted_at is null and product_type_code = :product_type_code and is_enabled = 1 order by sequence desc";
// var optionType = "get";
var functionName = "productList";
//删除
var optionType = "del";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName, params);
// var dataCount = "select count(1) as dataCount from mc_product where deleted_at is null and product_type_code = :product_type_code and is_enabled = 1 ";
// var sql = "select * from mc_product where deleted_at is null and product_type_code = :product_type_code and is_enabled = 1 ";
// 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;
// var returnRes = this.redisInfo(sql, countSql, optionType, functionName, params);
return returnRes;
}
......@@ -41,18 +37,11 @@ class MediaaggregationDao extends Dao {
total: 0,//总记录条数
rows: []
};
var countSql = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null and pic_type = 2 and is_enabled = 1 ";
var sql = "select * from mc_rotation_chart where deleted_at is null and pic_type = 2 and is_enabled = 1 ";
var countSql = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null and pic_type = 2 and is_enabled = 1 order by sequence desc";
var sql = "select * from mc_rotation_chart where deleted_at is null and pic_type = 2 and is_enabled = 1 order by sequence desc";
var optionType = "get";
var functionName = "rotationChartList";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName);
// var dataCount = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null and pic_type = 2 and is_enabled = 1 ";
// var sql = "select * from mc_rotation_chart where deleted_at is null and pic_type = 2 and is_enabled = 1 ";
// var list = await this.customQuery(sql);
// returnRes.rows = list;
// var tmpResultCount = await this.customQuery(dataCount);
// returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -65,18 +54,11 @@ class MediaaggregationDao extends Dao {
rows: []
};
var countSql = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null and pic_type = 1 and is_enabled = 1 ";
var sql = "select * from mc_rotation_chart where deleted_at is null and pic_type = 1 and is_enabled = 1 ";
var countSql = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null and pic_type = 1 and is_enabled = 1 order by sequence desc";
var sql = "select * from mc_rotation_chart where deleted_at is null and pic_type = 1 and is_enabled = 1 order by sequence desc";
var optionType = "get";
var functionName = "tablePicList";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName);
// var dataCount = "select count(1) as dataCount from mc_rotation_chart where deleted_at is null and pic_type = 1 and is_enabled = 1 ";
// var sql = "select * from mc_rotation_chart where deleted_at is null and pic_type = 1 and is_enabled = 1 ";
// var list = await this.customQuery(sql);
// returnRes.rows = list;
// var tmpResultCount = await this.customQuery(dataCount);
// returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -93,13 +75,6 @@ class MediaaggregationDao extends Dao {
var optionType = "get";
var functionName = "needProductList";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName);
// 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 list = await this.customQuery(sql);
// returnRes.rows = list;
// var tmpResultCount = await this.customQuery(dataCount);
// returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -117,13 +92,6 @@ class MediaaggregationDao extends Dao {
var optionType = "get";
var functionName = "popularRecommendationList";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName);
// var dataCount = "select count(1) as dataCount from mc_popular_recommendation where deleted_at is null and is_enabled = 1 ";
// var sql = "select * from mc_popular_recommendation where deleted_at is null and is_enabled = 1 ";
// var list = await this.customQuery(sql);
// returnRes.rows = list;
// var tmpResultCount = await this.customQuery(dataCount);
// returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -135,18 +103,11 @@ class MediaaggregationDao extends Dao {
total: 0,//总记录条数
rows: []
};
var countSql = "select count(1) as dataCount from mc_product_type where deleted_at is null and p_id = 0 ";
var sql = "select * from mc_product_type where deleted_at is null and p_id = 0 ";
var countSql = "select count(1) as dataCount from mc_product_type where deleted_at is null and p_id = 0 order by sequence desc";
var sql = "select * from mc_product_type where deleted_at is null and p_id = 0 order by sequence desc";
var optionType = "get";
var functionName = "productTypeFirst";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName);
// var dataCount = "select count(1) as dataCount from mc_product_type where deleted_at is null and p_id = 0 ";
// var sql = "select * from mc_product_type where deleted_at is null and p_id = 0 ";
// var list = await this.customQuery(sql);
// returnRes.rows = list;
// var tmpResultCount = await this.customQuery(dataCount);
// returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -161,18 +122,11 @@ class MediaaggregationDao extends Dao {
total: 0,//总记录条数
rows: []
};
var countSql = "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 countSql = "select count(1) as dataCount from mc_product_type where deleted_at is null and p_code = :p_code order by sequence desc";
var sql = "select * from mc_product_type where deleted_at is null and p_code = :p_code order by sequence desc";
var optionType = "get";
var functionName = "productTypeSecend";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName, params);
// 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;
// var tmpResultCount = await this.customQuery(dataCount, params);
// returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
/**
......@@ -187,9 +141,6 @@ class MediaaggregationDao extends Dao {
var optionType = "get";
var functionName = "productDetail";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName, params);
// 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);
return returnRes;
}
......@@ -206,13 +157,6 @@ class MediaaggregationDao extends Dao {
var optionType = "get";
var functionName = "bottomMenuConfig";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName);
// var dataCount = "select count(1) as dataCount from mc_bottom_menu_config where deleted_at is null ";
// var sql = "select * from mc_bottom_menu_config where deleted_at is null ";
// var list = await this.customQuery(sql);
// returnRes.rows = list;
// var tmpResultCount = await this.customQuery(dataCount);
// returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -224,18 +168,11 @@ class MediaaggregationDao extends Dao {
total: 0,//总记录条数
rows: []
};
var countSql = "select count(1) as dataCount from mc_cycle_product where deleted_at is null ";
var sql = "select * from mc_cycle_product where deleted_at is null ";
var countSql = "select count(1) as dataCount from mc_cycle_product where deleted_at is null order by sequence desc";
var sql = "select * from mc_cycle_product where deleted_at is null order by sequence desc";
var optionType = "get";
var functionName = "cycleProduct";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName);
// var dataCount = "select count(1) as dataCount from mc_cycle_product where deleted_at is null ";
// var sql = "select * from mc_cycle_product where deleted_at is null ";
// var list = await this.customQuery(sql);
// returnRes.rows = list;
// var tmpResultCount = await this.customQuery(dataCount);
// returnRes.total = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return returnRes;
}
......@@ -257,13 +194,6 @@ class MediaaggregationDao extends Dao {
var optionType = "get";
var functionName = "secondLevelNeedConfig"
var returnRes = this.redisInfo(sql, countSql, optionType, functionName, params);
// var dataCount = "select count(1) as dataCount from mc_second_level_need_config where deleted_at is null and code = :code ";
// var sql = "select * from mc_second_level_need_config where deleted_at is null 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;
}
......@@ -293,20 +223,6 @@ class MediaaggregationDao extends Dao {
}
var optionType = "get";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName, params);
// if (apiType && apiType == '1') {//二类产品资质选项(选取数据线索的数据)
// var dataCount = "select count(1) as dataCount from mc_clue_maintenance where deleted_at is null";
// var sql = "select clue_info 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 clue_info from mc_clue_maintenance where deleted_at is null 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;
}
......@@ -340,17 +256,8 @@ class MediaaggregationDao extends Dao {
var optionType = "get";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName, params);
//删除
// var optionType = "del";
// var returnRes = this.redisInfo(sql, countSql, optionType, functionName, params);
// 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;
}
......@@ -359,7 +266,10 @@ class MediaaggregationDao extends Dao {
var template = "mediaaggregation";
let shaStr; // 将linkObj转为字符串并计算出sha256的值
let rtn; // 根据shaStr从redis库中查询返回的值。
let rtnObj; // 1.如果从redis中查到数据,则是redis中返回的数据,2.否则就是将要储存到redis中的数据。
let rtnObj = {
total: 0,//总记录条数
rows: []
};
// shaStr = await sha256(JSON.stringify(params));
// shaStr = template + "_" + shaStr + "_" + functionName;
shaStr = template + "_" + functionName;
......@@ -373,22 +283,22 @@ class MediaaggregationDao extends Dao {
}
if (optionType == "get") {
if (rtn) {
rtnObj = JSON.parse(rtn);
rtnObj.rows = JSON.parse(rtn);
rtnObj.total = dataCount && dataCount.length > 0 ? dataCount[0].dataCount : 0;
return rtnObj;
} else {
list.total = dataCount;
await this.redisClient.set(shaStr, JSON.stringify(list));
await this.redisClient.set(shaStr, JSON.stringify(rtnObj));
rtn = await this.redisClient.get(shaStr);
if (rtn) {
rtnObj = JSON.parse(rtn);
rtnObj.rows = JSON.parse(rtn);
rtnObj.total = dataCount && dataCount.length > 0 ? dataCount[0].dataCount : 0;
return rtnObj;
}
}
}
if (optionType == "del") {
if (rtn) {
await this.redisClient.delete(shaStr);
}
var res = await this.redisClient.delete(shaStr);
return 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