Showing
1 changed file
with
3 additions
and
1 deletions
@@ -333,12 +333,14 @@ module.exports = class extends global.yoho.BaseModel { | @@ -333,12 +333,14 @@ module.exports = class extends global.yoho.BaseModel { | ||
333 | let userJoinTimes = userTimesCache.get(TimesCacheKey); | 333 | let userJoinTimes = userTimesCache.get(TimesCacheKey); |
334 | 334 | ||
335 | if (_.isUndefined(userJoinTimes)) { | 335 | if (_.isUndefined(userJoinTimes)) { |
336 | - userJoinTimes = await mysqlCli.query(`select count(*) from ${TABLE_ACT_PRIZE_PRODUCT_USER} | 336 | + let info = await mysqlCli.query(`select count(*) as join_num from ${TABLE_ACT_PRIZE_PRODUCT_USER} |
337 | where act_prize_id = :actPrizeId and uid = :uid`, { | 337 | where act_prize_id = :actPrizeId and uid = :uid`, { |
338 | actPrizeId, | 338 | actPrizeId, |
339 | uid | 339 | uid |
340 | }); | 340 | }); |
341 | 341 | ||
342 | + userJoinTimes = _.get(info, '[0].join_num', 0); | ||
343 | + | ||
342 | // 用户参与次数超限(业务缓存) | 344 | // 用户参与次数超限(业务缓存) |
343 | if (userJoinTimes >= MAX_JOIN_TIMES) { | 345 | if (userJoinTimes >= MAX_JOIN_TIMES) { |
344 | userTimesCache.set(TimesCacheKey, userJoinTimes); | 346 | userTimesCache.set(TimesCacheKey, userJoinTimes); |
-
Please register or login to post a comment