123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- 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;
|