FriendSystemApi.js 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 {*} success
  85. */
  86. static addFriend(uid, success) {
  87. let url = "/friend/invite.do";
  88. let data = {
  89. fid: uid
  90. };
  91. let requestBody = {
  92. url: url,
  93. data: data,
  94. success: success
  95. };
  96. Api.httpPost(requestBody);
  97. }
  98. /**
  99. * 点击了别人分享的链接,自动成为对方的艺人
  100. * @param {*} uid
  101. * @param {*} success
  102. */
  103. static becomeArtist(uid, success) {
  104. let url = "/friend/beMyArtist.do";
  105. let data = {
  106. fid: uid
  107. };
  108. let requestBody = {
  109. url: url,
  110. data: data,
  111. success: success
  112. };
  113. Api.httpPost(requestBody);
  114. }
  115. }
  116. module.exports = FriendSystemApi;