1
0

FriendSystemApi.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. const Api = require('./Api');
  2. class FriendSystemApi {
  3. /**
  4. * 获取我的好友列表
  5. * @param timeline [int] 时间线
  6. * @param count [int] 每页数量
  7. * */
  8. static getFriend(timeline, count, success, fail) {
  9. let url = "/friend/getFriends.do";
  10. let data = {
  11. timeline: timeline,
  12. count: count,
  13. };
  14. let requestBody = {
  15. url: url,
  16. data: data,
  17. success: success,
  18. fail: fail,
  19. complete: () => {
  20. }
  21. };
  22. Api.httpGet(requestBody);
  23. }
  24. /**
  25. * 获取好友推荐列表
  26. * @param timeline [int] 时间线
  27. * @param count [int] 每页数量
  28. * */
  29. static getFriendRecommend(timeline, count, success, fail) {
  30. let url = "/friend/getRecommend.do";
  31. let data = {
  32. timeline: timeline,
  33. count: count,
  34. };
  35. let requestBody = {
  36. url: url,
  37. data: data,
  38. success: success,
  39. fail: fail,
  40. complete: () => {
  41. }
  42. };
  43. Api.httpGet(requestBody);
  44. }
  45. /**
  46. * 向好友提交申请
  47. * @param fid [long] 好友的 uid
  48. * */
  49. static friendApply(fid, success, fail) {
  50. let url = "/friend/apply.do";
  51. let data = {
  52. fid: fid,
  53. };
  54. let requestBody = {
  55. url: url,
  56. data: data,
  57. success: success,
  58. fail: fail,
  59. complete: () => {
  60. }
  61. };
  62. Api.httpPost(requestBody);
  63. }
  64. /**
  65. * 处理好友申请,通过或者拒绝
  66. * @param {} uid
  67. * @param {*} action
  68. */
  69. static processApply(uid, action) {
  70. let url = "/friend/processApply.do";
  71. let data = {
  72. fid: uid,
  73. status: action
  74. };
  75. let requestBody = {
  76. url: url,
  77. data: data
  78. };
  79. Api.httpPost(requestBody);
  80. }
  81. /**
  82. * 点击了别人分享的链接,自动成为对方的好友
  83. * @param {*} uid
  84. * @param {*} action
  85. */
  86. static addFriend(uid, success) {
  87. console.log('addFriend');
  88. let url = "/friend/invite.do";
  89. let data = {
  90. fid: uid
  91. };
  92. let requestBody = {
  93. url: url,
  94. data: data,
  95. success: success
  96. };
  97. Api.httpPost(requestBody);
  98. }
  99. }
  100. module.exports = FriendSystemApi;