Authored by hongyong.zhao

修改达到人数事没有更新is_full字段的bug

... ... @@ -387,11 +387,7 @@ module.exports = class extends global.yoho.BaseModel {
let productInfo = _.get(info, '[0][0]');
let joinNum = _.get(info, '[1].join_num', 0);
// 参与人数满时更新活动状态
if (+info.is_full === 0 && joinNum >= info.limit) {
mysqlCli.update(`update ${TABLE_ACT_PRIZE_PRODUCT} set is_full = 1
where id = :actPrizeId and is_full = 0 limit 1`, {actPrizeId});
}
let status = getActivityStatus(productInfo, joinNum);
... ... @@ -407,12 +403,25 @@ module.exports = class extends global.yoho.BaseModel {
this.sendPrizeCode(extra.shareUid, actPrizeId, {isShareTake: true});
}
return this.sendPrizeCode(uid, actPrizeId, Object.assign(extra, {
isShareTake: false,
actName: productInfo.name,
actStartTime: productInfo.start_time,
actEndTime: productInfo.end_time
}));
return new Promise((resolve, reject) => {
this.sendPrizeCode(uid, actPrizeId, Object.assign(extra, {
isShareTake: false,
actName: productInfo.name,
actStartTime: productInfo.start_time,
actEndTime: productInfo.end_time
})).then(response => {
// 参与人数满时更新活动状态
if (+response.code === 200 && (+productInfo.is_full === 0) && (joinNum + 1) >= productInfo.limit) {
mysqlCli.update(`update ${TABLE_ACT_PRIZE_PRODUCT} set is_full = 1
where id = :actPrizeId and is_full = 0 limit 1`, {actPrizeId});
}
resolve(response);
})
.catch(error => {
reject(error);
});
});
}
/**
... ...