Authored by lea guo

yohood抽奖消息发送

@@ -44,8 +44,6 @@ module.exports = { @@ -44,8 +44,6 @@ module.exports = {
44 codeGain(req, res, next) { 44 codeGain(req, res, next) {
45 let params = req.body; 45 let params = req.body;
46 46
47 - logger.info('---------codeGain---------', JSON.stringify(req));  
48 -  
49 params.userName = params.userName || '_'; 47 params.userName = params.userName || '_';
50 params.userThumb = params.userThumb || 'https://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100'; 48 params.userThumb = params.userThumb || 'https://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100';
51 49
@@ -414,7 +414,7 @@ module.exports = class extends global.yoho.BaseModel { @@ -414,7 +414,7 @@ module.exports = class extends global.yoho.BaseModel {
414 })).then(response => { 414 })).then(response => {
415 if (+response.code === 200) { 415 if (+response.code === 200) {
416 if (shareUid) { 416 if (shareUid) {
417 - this.sendPrizeCode(shareUid, actPrizeId, {isShareTake: true}); 417 + this.sendPrizeCode(shareUid, actPrizeId, {isShareTake: true, channel: productInfo.channel });
418 } 418 }
419 419
420 // 参与人数满时更新活动状态 420 // 参与人数满时更新活动状态
@@ -575,8 +575,13 @@ module.exports = class extends global.yoho.BaseModel { @@ -575,8 +575,13 @@ module.exports = class extends global.yoho.BaseModel {
575 * @param actPrizeId 575 * @param actPrizeId
576 * @param extra 576 * @param extra
577 * @returns {*} 577 * @returns {*}
  578 + * CHANNELTYPE: {'yoluck渠道': 0, 'UFO渠道': 1,'YOHOOD渠道': 2}
578 */ 579 */
579 sendWechatMessage(uid, actPrizeId, extra = {}) { 580 sendWechatMessage(uid, actPrizeId, extra = {}) {
  581 + if (extra.channel === 2) {
  582 + this.sendYohoodWechatMessage(uid, actPrizeId, extra = {});
  583 + return;
  584 + }
580 let info = {}; 585 let info = {};
581 let baseUri = 'pages/zeroSell/detail'; 586 let baseUri = 'pages/zeroSell/detail';
582 587
@@ -601,4 +606,38 @@ module.exports = class extends global.yoho.BaseModel { @@ -601,4 +606,38 @@ module.exports = class extends global.yoho.BaseModel {
601 logger.error(e); 606 logger.error(e);
602 }); 607 });
603 } 608 }
  609 +
  610 + /**
  611 + * 向用户发送获得抽奖码消息
  612 + * @param uid
  613 + * @param actPrizeId
  614 + * @param extra
  615 + * @returns {*}
  616 + * CHANNELTYPE: {'yoluck渠道': 0, 'UFO渠道': 1,'YOHOOD渠道': 2}
  617 + */
  618 + sendYohoodWechatMessage(uid, actPrizeId, extra = {}) {
  619 + const { actStartTime, actEndTime, actName, miniAppType } = extra;
  620 + const activityTime = `${moment(actStartTime).format('YYYY.MM.DD HH:mm:ss')} - ${moment(actEndTime).format('YYYY.MM.DD HH:mm:ss')}`;
  621 +
  622 + return this.get({
  623 + data: {
  624 + method: 'wechat.message.send',
  625 + sendScene: 'MINI_ACTIVITY_JOIN',
  626 + miniAppType: +miniAppType === 63 ? +miniAppType : 29,
  627 + params: JSON.stringify({
  628 + activityTitle: actName,
  629 + activityTime,
  630 + pageUrl: `pages/zeroSell/originalPriceSell?actPrizeId=${actPrizeId}`
  631 + }),
  632 + uidList: [uid]
  633 + }
  634 + }).then(result => {
  635 + if (result.code !== 200) {
  636 + logger.info(`zerobuy_join_notice send fail uid: ${uid}`);
  637 + }
  638 + })
  639 + .catch(e => {
  640 + logger.error(e);
  641 + });
  642 + }
604 }; 643 };
@@ -76,7 +76,6 @@ const zeroBuy = { @@ -76,7 +76,6 @@ const zeroBuy = {
76 .then(res.json).catch(next); 76 .then(res.json).catch(next);
77 }, 77 },
78 zeroBuyPublish(req, res, next) { 78 zeroBuyPublish(req, res, next) {
79 - logger.info('------zeroBuyPublish--------', JSON.stringify(req));  
80 79
81 let ctx = req.ctx(ActivityModel); 80 let ctx = req.ctx(ActivityModel);
82 let id = req.body.id; 81 let id = req.body.id;