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 {*} action */ static addFriend(uid, success) { console.log('addFriend'); let url = "/friend/invite.do"; let data = { fid: uid }; let requestBody = { url: url, data: data, success: success }; Api.httpPost(requestBody); } } module.exports = FriendSystemApi;