123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- const Api = require('./Api');
- class FriendSystemApi {
- /**
- * 获取我的好友列表
- * @param timeline [int] 时间线
- * @param count [int] 每页数量
- * */
- static getFriend(timeline, count, success, fail) {
- let url = "/friend/getFriends.do";
- let data = {
- timeline: timeline,
- count: count,
- };
- let requestBody = {
- url: url,
- data: data,
- success: success,
- fail: fail,
- complete: () => {
- }
- };
- Api.httpGet(requestBody);
- }
- /**
- * 获取好友推荐列表
- * @param timeline [int] 时间线
- * @param count [int] 每页数量
- * */
- static getFriendRecommend(timeline, count, success, fail) {
- let url = "/friend/getRecommend.do";
- let data = {
- timeline: timeline,
- count: count,
- };
- let requestBody = {
- url: url,
- data: data,
- success: success,
- fail: fail,
- complete: () => {
- }
- };
- Api.httpGet(requestBody);
- }
- /**
- * 向好友提交申请
- * @param fid [long] 好友的 uid
- * */
- static friendApply(fid, success, fail) {
- let url = "/friend/apply.do";
- let data = {
- fid: fid,
- };
- let requestBody = {
- url: url,
- data: data,
- success: success,
- fail: fail,
- complete: () => {
- }
- };
- Api.httpPost(requestBody);
- }
- /**
- * 处理好友申请,通过或者拒绝
- * @param {} uid
- * @param {*} action
- */
- static processApply(uid, action) {
- let url = "/friend/processApply.do";
- let data = {
- fid: uid,
- status: action
- };
- let requestBody = {
- url: url,
- data: data
- };
- Api.httpPost(requestBody);
- }
- /**
- * 点击了别人分享的链接,自动成为对方的好友
- * @param {*} uid
- * @param {*} success
- */
- static addFriend(uid, success) {
- let url = "/friend/invite.do";
- let data = {
- fid: uid
- };
- let requestBody = {
- url: url,
- data: data,
- success: success
- };
- Api.httpPost(requestBody);
- }
- /**
- * 点击了别人分享的链接,自动成为对方的艺人
- * @param {*} uid
- * @param {*} success
- */
- static becomeArtist(uid, success) {
- let url = "/friend/beMyArtist.do";
- let data = {
- fid: uid
- };
- let requestBody = {
- url: url,
- data: data,
- success: success
- };
- Api.httpPost(requestBody);
- }
- static becomeArtistPromise(uid) {
- return Api.httpPostPromise('/friend/beMyArtist.do', { fid: uid });
- }
- static shareSuccessNotice() {
- Api.httpPostPromise('/friend/share.do').then(() => {
- console.log('调用好友分享奖励接口成功');
- });
- }
- }
- module.exports = FriendSystemApi;
|