...
|
...
|
@@ -11,9 +11,9 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
/**
|
|
|
* 首页数据
|
|
|
*/
|
|
|
shareIndex(activityId, isApp, uid, isStudent, protocol) {
|
|
|
shareIndex(activityId, isApp, uid) {
|
|
|
|
|
|
return api.all([this._CouponInfo(activityId, uid, isStudent), this._redeatList(),
|
|
|
return api.all([this._CouponInfo(activityId, uid), this._redeatList(),
|
|
|
this._banner()]).then(result => {
|
|
|
|
|
|
const indexData = {
|
...
|
...
|
@@ -23,8 +23,6 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
const rebeatUrl = '//m.yohobuy.com/activity/share-buy/my-rebeat',
|
|
|
strategyUrl = 'http://activity.yoho.cn/feature/115.html?share_id=2023&title=分享购攻略';
|
|
|
|
|
|
indexData.isStudent = isStudent;
|
|
|
|
|
|
if (result[0] && result[0].data && result[0].data.userCouponBoList) {
|
|
|
_.forEach(result[0].data.userCouponBoList, function(val) {
|
|
|
|
...
|
...
|
@@ -39,22 +37,6 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
} else if (val.shareCoupon === '商品券') {
|
|
|
val.couponDescribe = '指定商品可用';
|
|
|
}
|
|
|
|
|
|
val.detailUrl = helpers.urlFormat('/activity/share-buy/detail', {
|
|
|
couponId: val.couponId,
|
|
|
couponCode: val.couponCode
|
|
|
});
|
|
|
|
|
|
if (isApp) {
|
|
|
val.detailUrl = protocol + val.detailUrl +
|
|
|
'&openby:yohobuy={"action":"go.h5","params":{"islogin":"N","url":"' + protocol +
|
|
|
val.detailUrl + '","params":{"couponId":"' + val.couponId + '","couponCode":"' +
|
|
|
val.couponCode + '"}}}';
|
|
|
}
|
|
|
|
|
|
if (!indexData.isStudent) {
|
|
|
val.detailUrl = '';
|
|
|
}
|
|
|
});
|
|
|
|
|
|
indexData.userCouponBoList = result[0].data.userCouponBoList;
|
...
|
...
|
@@ -104,12 +86,11 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
/**
|
|
|
* 首页获取优惠券信息
|
|
|
*/
|
|
|
_CouponInfo(activityId, uid, isStudent) {
|
|
|
_CouponInfo(activityId, uid) {
|
|
|
return api.get('', {
|
|
|
method: 'app.activity.getActivityCouponInfo',
|
|
|
activity_id: activityId,
|
|
|
uid: uid,
|
|
|
isStudent: isStudent
|
|
|
uid: uid
|
|
|
}, {
|
|
|
code: 200
|
|
|
}).then((result) => {
|
...
|
...
|
@@ -198,22 +179,23 @@ module.exports = class extends global.yoho.BaseModel { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 判断是不是学生
|
|
|
* 获取分享码
|
|
|
*/
|
|
|
checkStudent(uid) {
|
|
|
getCouponCode(uid, couponId, protocol) {
|
|
|
return api.get('', {
|
|
|
method: 'app.student.checkIsStudent',
|
|
|
uid: uid
|
|
|
method: 'app.activity.getActivityCouponCode',
|
|
|
uid: uid,
|
|
|
coupon_id: couponId
|
|
|
}).then(result => {
|
|
|
|
|
|
let isStudent;
|
|
|
|
|
|
if (result && result.data && result.code === 200) {
|
|
|
isStudent = parseInt(result.data.isStudent, 10) === 1 ? true : false;
|
|
|
if (result && result.code === 200 && result.data) {
|
|
|
result.data.detailUrl = helpers.urlFormat('/activity/share-buy/detail', {
|
|
|
couponId: couponId,
|
|
|
couponCode: result.data.couponCode
|
|
|
});
|
|
|
result.data.protocol = protocol;
|
|
|
}
|
|
|
|
|
|
return isStudent;
|
|
|
|
|
|
return result;
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
|