Commit d25877b7 by 庄冰

aaa

parent 980034a5
...@@ -260,42 +260,51 @@ class MediaaggregationDao extends Dao { ...@@ -260,42 +260,51 @@ class MediaaggregationDao extends Dao {
async redisInfo(sql, countSql, optionType, functionName, params = "") { async redisInfo(sql, countSql, optionType, functionName, params = "") {
var template = "mediaaggregation";
let shaStr; // 将linkObj转为字符串并计算出sha256的值
let rtn; // 根据shaStr从redis库中查询返回的值。
let rtnObj = { let rtnObj = {
total: 0,//总记录条数 total: 0,//总记录条数
rows: [] rows: []
}; };
// shaStr = await sha256(JSON.stringify(params)); var list = await this.customQuery(sql);
// shaStr = template + "_" + shaStr + "_" + functionName; var dataCount = await this.customQuery(countSql);
shaStr = template + "_" + functionName; rtnObj.rows = list;
rtn = await this.redisClient.get(shaStr); rtnObj.total = dataCount && dataCount.length > 0 ? dataCount[0].dataCount : 0;
if (params) { return rtnObj;
var list = await this.customQuery(sql, params); // var template = "mediaaggregation";
var dataCount = await this.customQuery(countSql, params); // let shaStr; // 将linkObj转为字符串并计算出sha256的值
} else { // let rtn; // 根据shaStr从redis库中查询返回的值。
var list = await this.customQuery(sql); // let rtnObj = {
var dataCount = await this.customQuery(countSql); // total: 0,//总记录条数
} // rows: []
if (optionType == "get") { // };
if (rtn) { // // shaStr = await sha256(JSON.stringify(params));
rtnObj.rows = JSON.parse(rtn); // // shaStr = template + "_" + shaStr + "_" + functionName;
rtnObj.total = dataCount && dataCount.length > 0 ? dataCount[0].dataCount : 0; // shaStr = template + "_" + functionName;
return rtnObj; // // rtn = await this.redisClient.get(shaStr);
} else { // if (params) {
rtnObj.rows = list; // var list = await this.customQuery(sql, params);
rtnObj.total = dataCount && dataCount.length > 0 ? dataCount[0].dataCount : 0; // var dataCount = await this.customQuery(countSql, params);
await this.redisClient.set(shaStr, JSON.stringify(rtnObj)); // } else {
rtn = await this.redisClient.get(shaStr); // var list = await this.customQuery(sql);
if (rtn) { // var dataCount = await this.customQuery(countSql);
return rtnObj; // }
} // if (optionType == "get") {
} // if (rtn) {
} // rtnObj.rows = JSON.parse(rtn);
if (optionType == "del") { // rtnObj.total = dataCount && dataCount.length > 0 ? dataCount[0].dataCount : 0;
await this.redisClient.delete(shaStr); // return rtnObj;
} // } else {
// rtnObj.rows = list;
// rtnObj.total = dataCount && dataCount.length > 0 ? dataCount[0].dataCount : 0;
// await this.redisClient.set(shaStr, JSON.stringify(rtnObj));
// rtn = await this.redisClient.get(shaStr);
// if (rtn) {
// return rtnObj;
// }
// }
// }
// if (optionType == "del") {
// await this.redisClient.delete(shaStr);
// }
} }
} }
module.exports = MediaaggregationDao; module.exports = MediaaggregationDao;
\ No newline at end of file
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