Authored by yyq

fix

... ... @@ -19,7 +19,7 @@ module.exports = {
req.query.noCache = true;
}
req.ctx(zerobuyModel).getContent(req.query.prizeId, req.query)
req.ctx(zerobuyModel).getContent(req.query.actPrizeId, req.query)
.then(res.json).catch(next);
},
listMine(req, res, next) {
... ... @@ -31,9 +31,9 @@ module.exports = {
.then(res.json).catch(next);
},
codeMine(req, res, next) {
let {uid, prizeId} = req.query;
let {uid, actPrizeId} = req.query;
req.ctx(zerobuyModel).getCodeMine(uid, prizeId)
req.ctx(zerobuyModel).getCodeMine(uid, actPrizeId)
.then(res.json).catch(next);
},
codeGain(req, res, next) {
... ...
... ... @@ -136,7 +136,7 @@ module.exports = class extends global.yoho.BaseModel {
return mysqlCli.query(`select user_name, user_thumb, create_time
from ${TABLE_ACT_PRIZE_PRODUCT_USER} where act_id = :actId
order by u.create_time desc limit 10;`, {
order by create_time desc limit 10;`, {
actId
}, {
cache: RECENT_CODE_CACHE_TIME
... ...
... ... @@ -6,7 +6,6 @@
const _ = require('lodash');
module.exports = class memoryCache {
constructor(options) {
this.options = Object.assign({}, options);
... ...
... ... @@ -65,11 +65,14 @@ class SqlHelper {
// 读取缓存
if (cache) {
cacheKey = md5(`${sql}${qs.stringify(params)}${cache}`);
let cacheString = `${sql} {${qs.stringify(params)}} ${cache}`;
cacheKey = md5(cacheString);
let cacheResult = this.memoryCache.get(cacheKey);
if (!_.isUndefined(cacheResult)) {
this.logger.debug('get success from memory cache.' + cacheString)
return Promise.resolve(cacheResult);
}
}
... ...