Authored by yyq

fix

... ... @@ -196,7 +196,7 @@ module.exports = class extends global.yoho.BaseModel {
let [product, content, count] = result;
if (product && product.length) {
resData = product[0];
resData = product[0] || {};
resData.content = _.sortBy(content || [], o => {
return o.sort;
});
... ...
... ... @@ -70,9 +70,17 @@ class SqlHelper {
let cacheResult = await this.cache.get(cacheKey);
if (!_.isUndefined(cacheResult) && !_.isNull(cacheResult)) {
this.logger.debug('get success from cache.' + cacheString);
return Promise.resolve(cacheResult);
if (cacheResult) {
try {
cacheResult = JSON.parse(cacheResult);
this.logger.debug('get success from cache.' + cacheString);
return Promise.resolve(cacheResult);
} catch (e) {
this.logger.debug('cache data parse fail.' + JSON.stringify(e));
}
}
}
... ...