...
|
...
|
@@ -68,6 +68,14 @@ function getActivityStatus(info = {}, num, now) { |
|
|
return resStatus;
|
|
|
}
|
|
|
|
|
|
function replaceHttp(url) {
|
|
|
if (url && url.indexOf('http:') > -1) {
|
|
|
url = url.replace(/http:/ig, 'https:');
|
|
|
}
|
|
|
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
function handelActivityList(list, nums) {
|
|
|
let now = new Date().getTime() / 1000;
|
|
|
|
...
|
...
|
@@ -75,6 +83,7 @@ function handelActivityList(list, nums) { |
|
|
nums = _.concat([], nums);
|
|
|
|
|
|
_.forEach(list, (value, index) => {
|
|
|
value.cover_img = replaceHttp(value.cover_img);
|
|
|
value.price = '¥' + (value.price || 0).toFixed(2);
|
|
|
value.status = getActivityStatus(value, nums[index], now);
|
|
|
});
|
...
|
...
|
@@ -100,11 +109,27 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
page = parseInt(page, 10) || 1;
|
|
|
|
|
|
let limit = `${(page - 1) * PAGE_SIZE},${PAGE_SIZE}`;
|
|
|
let where = ['act_id = :actId'];
|
|
|
|
|
|
let now = new Date().getTime() / 1000;
|
|
|
|
|
|
switch (+extra.type) {
|
|
|
case 1:
|
|
|
where.push('status > 0 and start_time > :now');
|
|
|
break;
|
|
|
case 2:
|
|
|
where.push('status > 0');
|
|
|
where.push('(end_time < :now or is_full > 0)');
|
|
|
break;
|
|
|
default:
|
|
|
where.push('status = 1 and start_time <= :now and end_time >= :now and is_full = 0');
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
return mysqlCli.query(`select * from ${TABLE_ACT_PRIZE_PRODUCT}
|
|
|
where act_id = :actId and status > 0
|
|
|
order by sort desc limit ${limit}`, {
|
|
|
actId
|
|
|
where ${where.join(' and ')} order by sort desc limit ${limit}`, {
|
|
|
actId,
|
|
|
now
|
|
|
}, {
|
|
|
cache: PRODUCT_CACHE_TIMES
|
|
|
}).then(result => {
|
...
|
...
|
@@ -216,11 +241,16 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
if (product && product.length) {
|
|
|
resData = product[0] || {};
|
|
|
resData.content = _.sortBy(content || [], o => {
|
|
|
if (+o.floor_type === 2) {
|
|
|
o.content = replaceHttp(o.content);
|
|
|
}
|
|
|
|
|
|
return o.sort;
|
|
|
});
|
|
|
|
|
|
let joinNum = _.get(count, 'join_num', 0);
|
|
|
|
|
|
resData.cover_img = replaceHttp(resData.cover_img);
|
|
|
resData.price = '¥' + resData.price.toFixed(2);
|
|
|
resData.joinNum = joinNum;
|
|
|
resData.status = getActivityStatus(resData, joinNum);
|
...
|
...
|
@@ -492,7 +522,7 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
params: JSON.stringify({
|
|
|
activityTitle: extra.actName,
|
|
|
activityTime: `${timeFormat(extra.actStartTime)} - ${timeFormat(extra.actEndTime)}`,
|
|
|
pageUrl: '/page/subPackage/pages/zeroSell/detail?actPrizeId=' + actPrizeId
|
|
|
pageUrl: 'page/subPackage/pages/zeroSell/detail?actPrizeId=' + actPrizeId
|
|
|
}),
|
|
|
uidList: [uid]
|
|
|
}
|
...
|
...
|
|