Commit 6f265110 by 兰国旗

laolan

parent 980034a5
...@@ -100,8 +100,8 @@ class MediaaggregationDao extends Dao { ...@@ -100,8 +100,8 @@ class MediaaggregationDao extends Dao {
total: 0,//总记录条数 total: 0,//总记录条数
rows: [] rows: []
}; };
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 countSql = "select count(1) as dataCount from mc_product_type where deleted_at is null and p_id = 0 order by sequence asc";
var sql = "select * 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 asc";
var optionType = "get"; var optionType = "get";
var functionName = "productTypeFirst"; var functionName = "productTypeFirst";
var returnRes = this.redisInfo(sql, countSql, optionType, functionName); var returnRes = this.redisInfo(sql, countSql, optionType, functionName);
...@@ -269,7 +269,7 @@ class MediaaggregationDao extends Dao { ...@@ -269,7 +269,7 @@ class MediaaggregationDao extends Dao {
}; };
// shaStr = await sha256(JSON.stringify(params)); // shaStr = await sha256(JSON.stringify(params));
// shaStr = template + "_" + shaStr + "_" + functionName; // shaStr = template + "_" + shaStr + "_" + functionName;
shaStr = template + "_" + functionName; shaStr = template + "_" + params + "_" + functionName;
rtn = await this.redisClient.get(shaStr); rtn = await this.redisClient.get(shaStr);
if (params) { if (params) {
var list = await this.customQuery(sql, params); var list = await this.customQuery(sql, params);
...@@ -280,13 +280,13 @@ class MediaaggregationDao extends Dao { ...@@ -280,13 +280,13 @@ class MediaaggregationDao extends Dao {
} }
if (optionType == "get") { if (optionType == "get") {
if (rtn) { if (rtn) {
rtnObj.rows = JSON.parse(rtn); rtnObj = JSON.parse(rtn);
rtnObj.total = dataCount && dataCount.length > 0 ? dataCount[0].dataCount : 0;
return rtnObj; return rtnObj;
} else { } else {
rtnObj.rows = list; rtnObj.rows = list;
rtnObj.total = dataCount && dataCount.length > 0 ? dataCount[0].dataCount : 0; rtnObj.total = dataCount && dataCount.length > 0 ? dataCount[0].dataCount : 0;
await this.redisClient.set(shaStr, JSON.stringify(rtnObj)); await this.redisClient.set(shaStr, JSON.stringify(rtnObj));
await this.redisClient.client.expire(shaStr, 5);
rtn = await this.redisClient.get(shaStr); rtn = await this.redisClient.get(shaStr);
if (rtn) { if (rtn) {
return rtnObj; return rtnObj;
......
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