...
|
...
|
@@ -16,7 +16,7 @@ const MINUTE_TIMES = 60; |
|
|
const PRODUCT_CACHE_TIMES = MINUTE_TIMES * 5; // 商品(列表&详情)缓存时间
|
|
|
const RECENT_CODE_CACHE_TIME = MINUTE_TIMES; // 最近获取记录缓存时间
|
|
|
const MAX_JOIN_TIMES = 5; // 最大活动参与次数
|
|
|
|
|
|
const MAX_RECOMEND_NUM = 10; // 最大推荐活动数目
|
|
|
const PAGE_SIZE = 10;
|
|
|
|
|
|
const userTimesCache = new MemoryCache();
|
...
|
...
|
@@ -140,13 +140,11 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
getListRecommend(actPrizeId, extra = {}) {
|
|
|
const actId = parseInt(extra.actId, 10) || 0;
|
|
|
|
|
|
let lid = parseInt(actPrizeId, 10) || 0;
|
|
|
|
|
|
return mysqlCli.query(`select * from ${TABLE_ACT_PRIZE_PRODUCT}
|
|
|
where act_id = :actId and id > :actPrizeId and status > 0
|
|
|
order by sort desc limit 5`, {
|
|
|
where act_id = :actId and status > 0
|
|
|
order by sort desc limit ${MAX_RECOMEND_NUM + 1}`, {
|
|
|
actId,
|
|
|
actPrizeId: lid - 3
|
|
|
actPrizeId
|
|
|
}, {
|
|
|
cache: PRODUCT_CACHE_TIMES
|
|
|
}).then(result => {
|
...
|
...
|
@@ -154,7 +152,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
return +n.id === +actPrizeId;
|
|
|
});
|
|
|
|
|
|
return handelResult(handelActivityList(_.takeRight(result, 2)));
|
|
|
return handelResult(handelActivityList(_.take(result, MAX_RECOMEND_NUM)));
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
|