Authored by lea guo

yohood抽奖消息发送

... ... @@ -44,8 +44,6 @@ module.exports = {
codeGain(req, res, next) {
let params = req.body;
logger.info('---------codeGain---------', JSON.stringify(req));
params.userName = params.userName || '_';
params.userThumb = params.userThumb || 'https://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100';
... ...
... ... @@ -414,7 +414,7 @@ module.exports = class extends global.yoho.BaseModel {
})).then(response => {
if (+response.code === 200) {
if (shareUid) {
this.sendPrizeCode(shareUid, actPrizeId, {isShareTake: true});
this.sendPrizeCode(shareUid, actPrizeId, {isShareTake: true, channel: productInfo.channel });
}
// 参与人数满时更新活动状态
... ... @@ -575,8 +575,13 @@ module.exports = class extends global.yoho.BaseModel {
* @param actPrizeId
* @param extra
* @returns {*}
* CHANNELTYPE: {'yoluck渠道': 0, 'UFO渠道': 1,'YOHOOD渠道': 2}
*/
sendWechatMessage(uid, actPrizeId, extra = {}) {
if (extra.channel === 2) {
this.sendYohoodWechatMessage(uid, actPrizeId, extra = {});
return;
}
let info = {};
let baseUri = 'pages/zeroSell/detail';
... ... @@ -601,4 +606,38 @@ module.exports = class extends global.yoho.BaseModel {
logger.error(e);
});
}
/**
* 向用户发送获得抽奖码消息
* @param uid
* @param actPrizeId
* @param extra
* @returns {*}
* CHANNELTYPE: {'yoluck渠道': 0, 'UFO渠道': 1,'YOHOOD渠道': 2}
*/
sendYohoodWechatMessage(uid, actPrizeId, extra = {}) {
const { actStartTime, actEndTime, actName, miniAppType } = extra;
const activityTime = `${moment(actStartTime).format('YYYY.MM.DD HH:mm:ss')} - ${moment(actEndTime).format('YYYY.MM.DD HH:mm:ss')}`;
return this.get({
data: {
method: 'wechat.message.send',
sendScene: 'MINI_ACTIVITY_JOIN',
miniAppType: +miniAppType === 63 ? +miniAppType : 29,
params: JSON.stringify({
activityTitle: actName,
activityTime,
pageUrl: `pages/zeroSell/originalPriceSell?actPrizeId=${actPrizeId}`
}),
uidList: [uid]
}
}).then(result => {
if (result.code !== 200) {
logger.info(`zerobuy_join_notice send fail uid: ${uid}`);
}
})
.catch(e => {
logger.error(e);
});
}
};
... ...
... ... @@ -76,8 +76,7 @@ const zeroBuy = {
.then(res.json).catch(next);
},
zeroBuyPublish(req, res, next) {
logger.info('------zeroBuyPublish--------', JSON.stringify(req));
let ctx = req.ctx(ActivityModel);
let id = req.body.id;
let channel = req.body.channel;
... ...