Authored by 陈轩

FIX vip-day bugs

... ... @@ -5,27 +5,41 @@
*/
'use strict';
const inviteModel = require('../models/invite');
const inviteTitle = '有货 邀请好友赢福利';
const inviteTitle = {
vipDay: '有货会员日 赢更多福利',
normal: '有货 邀请好友赢福利'
};
const _ = require('lodash');
const md5 = require('md5');
const secretKey = '5466ee572bcbc75830d044e66ab429bc';// 秘钥
/*
判断邀请 好友 类型
*/
exports.checkType = function(req, res, next) {
inviteModel.checkType()
.then(function(result) {
if (result.code === 200 && result.data) {
res.locals.isVipDay = true;
res.locals.title = inviteTitle.vipDay;
} else {
res.locals.isNormal = true;
res.locals.title = inviteTitle.normal;
}
return next();
})
.catch(next);
};
// 简介、好友领取列表页面
exports.index = (req, res, next) => {
let actId = req.query.act_id * 1 || 0;
let uid = req.query.uid || 0;
let renderPage = 'invite/list';
// return res.render('invite/list', {
// module: 'activity',
// page: 'invite',
// width750: true,
// result: {
// // isEmpty: true
// isFive: true
// }
// });
inviteModel.index({
uid: uid,
activityId: actId
... ... @@ -45,27 +59,13 @@ exports.index = (req, res, next) => {
module: 'activity',
page: 'invite',
width750: true,
result: result,
title: inviteTitle
result: result
});
}).catch(next);
};
// 微信好友获取红包方法(即分享出去的地址)页面
exports.share = (req, res, next) => {
// res.render('invite/myshare', {
// module: 'activity',
// page: 'invite',
// // result: {
// // shareUid: shareUid,
// // nums: nums,
// // actId: actId,
// // openId: wxUserInfo.unionid
// // },
// // title: inviteTitle
// });
// return;
let shareUid = req.params[0];
let actId = req.params[1];
... ... @@ -103,16 +103,14 @@ exports.share = (req, res, next) => {
nums: nums,
actId: actId,
openId: wxUserInfo.unionid
},
title: inviteTitle
}
});
} else {
// 是自己分享的连接
res.render('invite/list', {
module: 'activity',
page: 'invite',
result: result.data.list,
title: inviteTitle
result: result.data.list
});
}
... ... @@ -229,8 +227,7 @@ exports.myCoupons = (req, res, next) => {
page: 'invite',
result: result[0],
userInfo: result[1],
amount: amount,
title: inviteTitle
amount: amount
});
}).catch(next);
};
... ... @@ -240,18 +237,12 @@ exports.shareover = (req, res) => {
let amount = req.query.amount * 1 || 5;
let sign = req.query.sign;
// if (md5(amount + secretKey) !== sign) {
// res.redirect('/');
// return false;
// }
res.render('invite/shareover', {
module: 'activity',
page: 'invite',
result: {
amount: amount
},
title: inviteTitle
}
});
};
... ... @@ -279,8 +270,7 @@ exports.over = (req, res) => {
res.render('invite/over', {
module: 'activity',
page: 'invite',
result: [],
title: inviteTitle
result: []
});
};
... ...
'use strict';
const api = global.yoho.API;
const serviceAPI = global.yoho.ServiceAPI;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
... ... @@ -341,8 +342,20 @@ const getWxUserInfo = (params) => {
});
};
/**
* 获取 邀请好友赢福利的类型:
* 1. 普通的要求好友赢福利
* 2. 会员日的邀请好友 赢福利
*/
const checkType = () => {
const url = '/activity/UserdaySigninController/isUserday';
return serviceAPI.get(url, {});
};
module.exports = {
index,
checkType,
shareModel,
getBindLogByOpenId,
sendRegCodeToMobile,
... ...
... ... @@ -49,18 +49,18 @@ router.get('/live/replay/barrage', live.replayBarrage);
router.get('/live/replay/:id', live.main);
router.get('/live/:id', live.main);
router.get('/invite', invite.index);
router.get('/invite/index', invite.index);
router.get('/invite', invite.checkType, invite.index);
router.get('/invite/index', invite.checkType, invite.index);
router.get('/market', market.index);// 市场推广活动
router.get(/\/invite\/share_([\d]+)_([\d]+)_([\d]+).html/, invite.share);
router.get(/\/invite\/share_([\d]+)_([\d]+)_([\d]+).html/, invite.checkType, invite.share);
router.get('/invite/sendRegCodeToMobile', invite.sendRegCodeToMobile);
router.get('/invite/checkOldUserCoupon', invite.checkOldUserCoupon);
router.get('/invite/validRegCode', invite.validRegCode);
router.get('/invite/register', invite.register);
router.get('/invite/receiveCoupons', invite.receiveCoupons);
router.get(/\/invite\/mycoupons_([\d]+)_([\d]+)_([\d]+)_([\d]+).html/, invite.myCoupons); // 好友领取完优惠券的页面
router.get(/\/invite\/mycoupons_([\d]+)_([\d]+)_([\d]+)_([\d]+).html/, invite.checkType, invite.myCoupons); // 好友领取完优惠券的页面
router.get('/invite/getwxinfo', invite.getwxinfo);
router.get('/invite/shareover', invite.shareover);
router.get('/invite/over', invite.over);
... ...
... ... @@ -7,7 +7,11 @@
只需1位小伙伴领取,<br/>
即得<strong class="fz17">10元现金券</strong><br/>
全部领完,可继续发,上不封顶!<br/>
<strong class="fz17">每月28日,会员潮集狂欢</strong>
{{#if isVipDay}}
<strong class="fz17">每月28日,会员潮集狂欢</strong>
{{else}}
<strong class="fz17">奔跑吧,潮人们</strong>
{{/if}}
</p>
<a href="javascript:void(0)" class="weal-btn fz16" id="send_gift">立刻发福利</a>
<h2 class="rule-tit fz15">活动细则</h2>
... ...
... ... @@ -77,7 +77,7 @@
{{/each}}
</ul>
<div class="text-center">
<a href="http://sale.yohobuy.com/?channel=&specialsale_id=7?openby:yohobuy={'action':'go.vippro'}" class="vip-goods-more">点击查看更多</a>
<a href='http://sale.yohobuy.com/?channel=&specialsale_id=7?openby:yohobuy={"action":"go.vippro"}' class="vip-goods-more">点击查看更多</a>
</div>
</div>
</div>
... ...
... ... @@ -19,5 +19,5 @@
<h6 class="vip-good-name line-clamp-2">{{productName}}</h6>
<button class="vip-good-fav" type="button">马上购买</button>
</div>
<a class="vip-good-link" href="{{url}}"></a>
<a class="vip-good-link" href='{{url}}'></a>
</li>
\ No newline at end of file
... ...
... ... @@ -135,6 +135,7 @@ var page = {
content: content
})
.done(function(res) {
$msgContent.val('');
if (res.code !== 200) {
if (res.redirect) {
location.href = res.redirect;
... ...