|
|
/**
|
|
|
* Created by PhpStorm.
|
|
|
* User: Targaryen
|
|
|
* Date: 2016/7/15
|
|
|
* Time: 13:47
|
|
|
*/
|
|
|
'use strict';
|
|
|
const api = global.yoho.API;
|
|
|
|
|
|
/**
|
|
|
* 根据 ID 获取活动信息 tar note 待处理
|
|
|
* @param actId
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
exports.getInfoById = (actId) => {
|
|
|
return api.get('', {
|
|
|
method: '',
|
|
|
actId: actId
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取一条用户的分享信息 tar note 待处理
|
|
|
* @param shareUid
|
|
|
* @param actId
|
|
|
* @param shareUrl
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
exports.getOne = (shareUid, actId, shareUrl) => {
|
|
|
return api.get('', {
|
|
|
method: '',
|
|
|
shareUid: shareUid,
|
|
|
actId: actId,
|
|
|
shareUrl: shareUrl
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 通过opend_id 获取用户uid
|
|
|
* @param openId
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
exports.getByOpenId = (openId) => {
|
|
|
if (!openId) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
return api.get('', {
|
|
|
method: '',
|
|
|
openId: openId
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 添加绑定信息
|
|
|
* @param uid
|
|
|
* @param openId
|
|
|
* @param snsNick
|
|
|
* @param snsHeadImg
|
|
|
* @param snsType
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
exports.set = (uid, openId, snsNick, snsHeadImg, snsType) => {
|
|
|
if (!openId || parseInt(snsType, 10) < 1) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
return api.get('', {
|
|
|
method: '',
|
|
|
uid: uid,
|
|
|
openId: openId,
|
|
|
snsNick: snsNick,
|
|
|
snsHeadImg: snsHeadImg,
|
|
|
snsType: snsType || '1'
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 更新头像
|
|
|
* @param id
|
|
|
* @param nick
|
|
|
* @param headImg
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
exports.updateHeadimg = (id, nick, headImg) => {
|
|
|
if (parseInt(id, 10) < 1) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
return api.get('', {
|
|
|
id: id,
|
|
|
nick: nick,
|
|
|
headImg: headImg
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取分享数量
|
|
|
* @param uid
|
|
|
* @param activityId
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
exports.getCount = (uid, activityId) => {
|
|
|
return api.get('', {
|
|
|
uid: uid || '0',
|
|
|
activityId: activityId
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 根据分享者id获取领券列表
|
|
|
* @param shareUid
|
|
|
* @param activityId
|
|
|
* @param offset
|
|
|
* @param size
|
|
|
* @param couponType
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
exports.getListByShareUid = (shareUid, activityId, offset, size, couponType) => {
|
|
|
if (parseInt(shareUid, 10) < 1 || parseInt(activityId, 10) < 1) {
|
|
|
return;
|
|
|
}
|
|
|
return api.get('', {
|
|
|
method: '',
|
|
|
shareUid: shareUid,
|
|
|
activityId: activityId,
|
|
|
offset: offset,
|
|
|
size: size,
|
|
|
couponType: couponType
|
|
|
});
|
|
|
}; |