FriendController.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <?php
  2. namespace App\Http\Controllers\V2_17_3\Friends;
  3. use App\Http\Controllers\Controller;
  4. use App\Http\Controllers\Core\Auth;
  5. use App\Managers\FriendManager;
  6. use Illuminate\Http\Request;
  7. class FriendController extends Controller
  8. {
  9. public function getListCnt()
  10. {
  11. $uid = Auth::auth();
  12. $fs = new FriendManager();
  13. $data = $fs->getUnreadCount($uid);
  14. return array(
  15. 'code' => 200,
  16. 'message' => 'success',
  17. 'data' => $data
  18. );
  19. }
  20. public function overview()
  21. {
  22. $uid = Auth::auth();
  23. $data = null;
  24. return array(
  25. 'code' => 200,
  26. 'message' => 'success',
  27. 'data' => $data
  28. );
  29. }
  30. /**
  31. * 获取好友列表
  32. * @param Request $request
  33. * @return array
  34. */
  35. public function getAllList(Request $request)
  36. {
  37. $uid = Auth::auth();
  38. $pages = array(
  39. 'limit' => 20,
  40. 'page' => $request->get('page', 1)
  41. );
  42. $fs = new FriendManager();
  43. $data = $fs->getAllList($uid, $pages);
  44. return array(
  45. 'code' => 200,
  46. 'message' => 'success',
  47. 'data' => $data
  48. );
  49. }
  50. /**
  51. * 获取相互喜欢好友列表
  52. * @param Request $request
  53. * @return array
  54. * @deprecated Friend/GetEachLikeList
  55. */
  56. public function getEachLikeList(Request $request)
  57. {
  58. $uid = Auth::auth();
  59. $pages = array(
  60. 'limit' => 20,
  61. 'page' => $request->get('page', 1)
  62. );
  63. $fs = new FriendManager();
  64. $data = $fs->getEachLikeList($uid, $pages);
  65. return array(
  66. 'code' => 200,
  67. 'message' => 'success',
  68. 'data' => $data
  69. );
  70. }
  71. /**
  72. * @param Request $request
  73. * @return array
  74. * @deprecated Friend/GetStarList
  75. */
  76. public function getStarList(Request $request)
  77. {
  78. $uid = Auth::auth();
  79. $pages = array(
  80. 'limit' => 20,
  81. 'page' => $request->get('page', 1)
  82. );
  83. $fs = new FriendManager();
  84. $data = $fs->getStarList($uid, $pages);
  85. return array(
  86. 'code' => 200,
  87. 'message' => 'success',
  88. 'data' => $data
  89. );
  90. }
  91. /**
  92. * 好友交互历史
  93. * @param int $friend_uid
  94. * @param Request $request
  95. * @return array
  96. * @deprecated Friend/GetChatHistory
  97. */
  98. public function getHistory(int $friend_uid, Request $request)
  99. {
  100. $uid = Auth::auth();
  101. $pages = array(
  102. 'limit' => 1000,
  103. 'page' => $request->get('page', 1)
  104. );
  105. $fs = new FriendManager();
  106. $data = $fs->getHistory($uid, $friend_uid, $pages);
  107. return array(
  108. 'code' => 200,
  109. 'message' => 'success',
  110. 'data' => $data
  111. );
  112. }
  113. }