...
|
...
|
@@ -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: []
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
|